From f7ba268e249e8f8d8da873fdf3673d44d5a134d2 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Sun, 17 Oct 2021 01:30:45 -0700 Subject: [PATCH] zsh: all aliases now use single quotes, unless they shouldn't --- .zshrc | 66 ++++++++++++++++++++++------------------------------------ 1 file changed, 25 insertions(+), 41 deletions(-) diff --git a/.zshrc b/.zshrc index 71e8723..39a72e9 100644 --- a/.zshrc +++ b/.zshrc @@ -4,9 +4,6 @@ ### Basic shell configuration >>> ### Environment variables >>> { - # optionally source an external environment variable file - [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/envrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/envrc" - # Intelligently set $EDITOR if command -v nvim > /dev/null;then export EDITOR=nvim @@ -43,18 +40,19 @@ COMPLETION_WAITING_DOTS=true } # <<< + + # optionally source an external environment variable file + [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/envrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/envrc" } # <<< ### Aliases >>> { - # optionally source an external alias file - [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ## Short hand programs (ex: sc = shellcheck) >>> # use nvim rather than vim if the command exists - [ -x "$(command -v nvim)" ] && alias vim="nvim" vimdiff="nvim -d" + [ -x "$(command -v nvim)" ] && alias vim='nvim' vimdiff='nvim -d' alias vv="$EDITOR" - alias sedit="sudoedit" + alias sedit='sudoedit' # I do this too much by accident smh my head alias :q='exit' \ @@ -79,22 +77,23 @@ # <<< ## Program improvements (ex: ls = ls -h) >>> - alias sudo="sudo " # allow using aliases in sudo commands - alias df='df -h' # Human-readable sizes - alias free='free -m' # Show sizes in MB - alias bc="bc -ql" # Make bc usable for fast math + alias sudo='sudo ' # allow using aliases in sudo commands + alias df='df -h' # Human-readable sizes + alias free='free -m' # Show sizes in MB + alias bc='bc -ql' # Make bc usable for fast math + alias glow='glow -p' # Glow preview in `less` # Colors alias \ - ls="ls -hN --color=auto --group-directories-first" \ - grep="grep --color=auto" \ - diff="diff --color=auto" \ - pacman="pacman --color=auto" \ - paru="paru --color=auto --sudoloop --newsonupgrade --pgpfetch --upgrademenu --bottomup --skipreview" \ + ls='ls -hN --color=auto --group-directories-first' \ + grep='grep --color=auto' \ + diff='diff --color=auto' \ + pacman='pacman --color=auto' \ + paru='paru --color=auto --sudoloop --newsonupgrade --pgpfetch --upgrademenu --bottomup --skipreview' \ command -v lsd > /dev/null && alias \ ls=lsd \ - lsd="lsd --group-dirs=first" \ + lsd='lsd --group-dirs=first' \ # <<< ## Mini short-hand scripts (ex: la = ls -a) >>> @@ -105,29 +104,13 @@ # Edit config files alias \ - nvc="(cd ~/.config/nvim/lua/blake && nvim ../../init.lua)" \ - zshrc="$EDITOR ~/.zshrc" \ - fstab="sudoedit /etc/fstab" \ - sedit="sudoedit" + nvc='(cd ~/.config/nvim/lua/blake && nvim ../../init.lua)' \ + zshrc='$EDITOR ~/.zshrc' \ + fstab='sudoedit /etc/fstab' \ # Git cLONE alias glone="git clone" - # random number generation - alias \ - rnd="echo 'Use the the shuf command:' && echo 'shuf --random-source=\"/dev/random\" -i (range, ex: 0-9) -n (number of random numbers)'" \ - rand=rnd - - # Graphical - alias \ - restart-gnome='killall -SIGQUIT gnome-shell' \ - lsx='ls /tmp/.X11-unix | tr "X" ":"' \ - - # tar is a dumb program... - alias \ - tarc='tar -c --use-compress-program=pigz -f' \ - tarx=ext \ - # Docker alias \ logs='docker-compose logs --tail=200 -f' \ @@ -156,13 +139,12 @@ alias fds='fd --hidden --exclude /run' # <<< + # optionally source an external alias file + [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" } # <<< ### Functions >>> { - # optionally source an external function file - [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/fnrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/fnrc" - # cd search: cd to a directory, given part of its name # (also can take arguments for an `fd` commnd) cds() { @@ -392,6 +374,9 @@ calc() { echo $(($*)) } + + # optionally source an external function file + [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/fnrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/fnrc" } # <<< # <<< @@ -469,7 +454,7 @@ } # <<< ### General ZSH configuration >>> -# This section is (mostly) From manjaro's "manjaro-zsh-config" (/usr/share/zsh/manjaro-zsh-config) # +# This section is (mostly) From manjaro's "manjaro-zsh-config" (/usr/share/zsh/manjaro-zsh-config) [ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history" @@ -705,6 +690,5 @@ cd - > /dev/null # Optionally source the user's customized .zshrc [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshrc.local" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshrc.local" || return 0 -# filetype is sh for language server # vim:fdm=marker:fmr=>>>,<<<:et:ft=sh:sw=3