1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 13:58:00 +00:00

[utility] Add safe-ops zstyle option to disable safe rm/cp/ln/mv

Currently rm/cp/ln/mv are aliased to rm/cp/ln/mv -i so that it will
prompt before removing files.

Some people would not like this functionality and wish for an easy way to
disable it. This adds a new option:

zstyle ':prezto:module:utility' safe-ops yes/no

It is enabled by default even if zstyle is not set, but can be set to no
to disable these aliases.

This should resolve issue #205
This commit is contained in:
Samantha McVey 2017-07-10 20:40:37 -07:00 committed by Kaleb Elwert
parent 6e1f4ddd19
commit 2a75fba6a8
2 changed files with 12 additions and 4 deletions

View File

@ -66,16 +66,19 @@ alias sftp='noglob sftp'
# Define general aliases. # Define general aliases.
alias _='sudo' alias _='sudo'
alias b='${(z)BROWSER}' alias b='${(z)BROWSER}'
alias cp="${aliases[cp]:-cp} -i"
alias diffu="diff --unified" alias diffu="diff --unified"
alias e='${(z)VISUAL:-${(z)EDITOR}}' alias e='${(z)VISUAL:-${(z)EDITOR}}'
alias ln="${aliases[ln]:-ln} -i"
alias mkdir="${aliases[mkdir]:-mkdir} -p" alias mkdir="${aliases[mkdir]:-mkdir} -p"
alias mv="${aliases[mv]:-mv} -i"
alias p='${(z)PAGER}' alias p='${(z)PAGER}'
alias po='popd' alias po='popd'
alias pu='pushd' alias pu='pushd'
alias rm="${aliases[rm]:-rm} -i" if zstyle -T ':prezto:module:utility' safe-ops; then
alias rm="${aliases[rm]:-rm} -i"
alias mv="${aliases[mv]:-mv} -i"
alias cp="${aliases[cp]:-cp} -i"
alias ln="${aliases[ln]:-ln} -i"
fi
alias sa='alias | grep -i' alias sa='alias | grep -i'
alias type='type -a' alias type='type -a'

View File

@ -171,6 +171,11 @@ zstyle ':prezto:module:prompt' theme 'sorin'
# Set the terminal multiplexer title format. # Set the terminal multiplexer title format.
# zstyle ':prezto:module:terminal:multiplexer-title' format '%s' # zstyle ':prezto:module:terminal:multiplexer-title' format '%s'
# safe-ops is enabled by default. This aliases rm, mv, cp, and ln so that they
# prompt before deleting or copying over files. Set to no to disable this safer
# behavior.
# zstyle ':prezto:module:utility' safe-ops yes
# #
# Tmux # Tmux
# #