This commit is contained in:
Christoph J. Scherr 2024-09-22 12:40:12 +02:00
parent ab2faa658b
commit acd2a741b1
1 changed files with 30 additions and 4 deletions

26
.zshrc
View File

@ -46,6 +46,7 @@ alias rg="rg --no-ignore"
alias home="cd $HOME" alias home="cd $HOME"
alias ff=firefox alias ff=firefox
alias fd=fdfind alias fd=fdfind
alias shutdown="confirm shutdown"
### Functions ### Functions
function largefiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(G|T|P|E)\s" } function largefiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(G|T|P|E)\s" }
@ -96,6 +97,25 @@ else
fi fi
return $ret return $ret
} }
function confirm() {
echo "To be executed: $@"
read -p "Confirm (Y/N): " -n 1 -r
case "$REPLY" in
y|Y ) echo "es"; eval $@;;
n|N ) echo "o";;
* ) echo -e "\ninvalid";;
esac
}
function confirm-important() {
echo "Write 'yes do as i say' to confirm that you REALLY want to do this: $@"
read
if [[ "${REPLY,,}" = "yes do as i say" ]]
then
eval $@
else
echo "aborting"
fi
}
### ---- zsh options ------------------------------------- ### ---- zsh options -------------------------------------
setopt autocd setopt autocd
@ -271,4 +291,10 @@ export NVM_DIR="$HOME/.config/nvm"
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm # [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion # [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# on demand nvm
function load_nvm() {
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
}
# zprof # zprof