very important zsh things

This commit is contained in:
Christoph J. Scherr 2025-01-08 14:44:25 +01:00
parent 0c51473d17
commit f7d89ec656
1 changed files with 15 additions and 7 deletions

22
.zshrc
View File

@ -48,9 +48,17 @@ alias home="cd $HOME"
alias ff=firefox alias ff=firefox
alias bell="tput bel" alias bell="tput bel"
alias fd=fdfind alias fd=fdfind
alias nobak="touch .nobackup"
# alias shutdown="confirm shutdown" # alias shutdown="confirm shutdown"
### Functions ### Functions
function random() {
if [ $# -ne 1 ] || ! [[ $1 =~ ^[0-9]+$ ]] || [ $1 -lt 1 ]; then
echo "Error: Please provide one positive integer argument" >&2
return 1
fi
echo $(( (RANDOM % $1) + 1 ))
}
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" }
function midfiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(M|G|T|P|E)\s" } function midfiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(M|G|T|P|E)\s" }
function smallfiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(B|K)\s" } function smallfiles () { exec 2>/dev/null; du -ah "$@" | grep -P "^\d+(B|K)\s" }
@ -271,13 +279,6 @@ else
eval "$(zoxide init zsh)" eval "$(zoxide init zsh)"
fi fi
### load unversioned zsh code
if [ -f ~/.zsh.local ]; then
source ~/.zsh.local
else
touch ~/.zsh.local
fi
### --- pyenv Config ------------------------------------- ### --- pyenv Config -------------------------------------
export PYENV_ROOT="$HOME/.pyenv" export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
@ -302,3 +303,10 @@ function load_nvm() {
} }
alias nvim="load_nvm && nvim" alias nvim="load_nvm && nvim"
# zprof # zprof
### load unversioned zsh code
if [ -f ~/.zsh.local ]; then
source ~/.zsh.local
else
touch ~/.zsh.local
fi