diff --git a/zsh/.zshrc b/zsh/.zshrc index 23a33e6..ca2cf91 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -156,14 +156,11 @@ if [ -d "${HOME}/.fzf/man" ]; then fi # Bat theme -export BAT_THEME="Catppuccin-mocha" +export BAT_THEME="Catppuccin Mocha" # Automatically remove duplicates from these arrays typeset -gU path cdpath manpath fpath -# Source broot -[ -d "${HOME}/.config/broot" ] && source "${HOME}/.config/broot/launcher/bash/br" - # compatibility with vterm-buffer-name-string in Emacs autoload -U add-zsh-hook add-zsh-hook -Uz chpwd() { print -Pn "\e]2;%m:%2~\a" } diff --git a/zsh/.zshrc.d/functions.zsh b/zsh/.zshrc.d/functions.zsh index 0d7756a..212f130 100644 --- a/zsh/.zshrc.d/functions.zsh +++ b/zsh/.zshrc.d/functions.zsh @@ -1,3 +1,8 @@ +# Command checker helper +function check_cmd() { + test -x "$(command -v $1)" +} + ## Nushell and jc functions # nushell: df @@ -47,6 +52,18 @@ function genrand() { openssl rand -base64 16 } +# Remove ~/.ssh/known_hosts* +function rmknownhosts() { + rm -v "${HOME}/.ssh/known_hosts"* +} + +# Empty trash +function rubbish() { + if check_cmd trash-empty; then + trash-empty -f -v + fi +} + # Compatibility with emacs-libvterm function vterm_printf() { if [ -n "$TMUX" ] && ([ "${TERM%%-*}" = "tmux" ] || [ "${TERM%%-*}" = "screen" ]); then @@ -61,7 +78,7 @@ function vterm_printf() { } # Remove all .jpeg .jpg .png .svg files from downloads -function rmimg() { +function rmpics() { find "${HOME}/downloads" \ -maxdepth 1 \ -type f \ @@ -69,6 +86,15 @@ function rmimg() { -delete } +# Remove all ISOs and disc images from downloads +function rmisos() { + find "${HOME}/downloads" \ + -maxdepth 1 \ + -type f \ + \( -name "*.iso" -o -name "*.img" \) \ + -delete +} + # Create a bookmark. function mark() {