From f7d89ec6567bfbbd49e33bdb6f3d3209576afb1d Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Wed, 8 Jan 2025 14:44:25 +0100 Subject: [PATCH] very important zsh things --- .zshrc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.zshrc b/.zshrc index bd594a7..91cd045 100644 --- a/.zshrc +++ b/.zshrc @@ -48,9 +48,17 @@ alias home="cd $HOME" alias ff=firefox alias bell="tput bel" alias fd=fdfind +alias nobak="touch .nobackup" # alias shutdown="confirm shutdown" ### 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 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" } @@ -271,13 +279,6 @@ else eval "$(zoxide init zsh)" fi -### load unversioned zsh code -if [ -f ~/.zsh.local ]; then - source ~/.zsh.local -else - touch ~/.zsh.local -fi - ### --- pyenv Config ------------------------------------- export PYENV_ROOT="$HOME/.pyenv" [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" @@ -302,3 +303,10 @@ function load_nvm() { } alias nvim="load_nvm && nvim" # zprof + +### load unversioned zsh code +if [ -f ~/.zsh.local ]; then + source ~/.zsh.local +else + touch ~/.zsh.local +fi