## ____ __ ## / __ \_________ _/ /_____ ## / / / / ___/ __ `/ //_/ _ \ ## / /_/ / / / /_/ / ,< / __/ Clay Gomera (Drake) ## /_____/_/ \__,_/_/|_|\___/ My custom fish config ## if status is-interactive # Commands to run in interactive sessions can go here end ### EXPORT set -U fish_greeting "" set EDITOR "nvim" # $EDITOR use neovim set READER "zathura" set TERMINAL "alacritty" set BROWSER "qutebrowser" set WM "dwm" set -x MANPAGER "sh -c 'col -bx | bat -l man -p'" ### ADDING TO THE PATH # First line removes the path; second line sets it. Without the first line, # your path gets massive and fish becomes very slow. set -e fish_user_paths set -U fish_user_paths $HOME/.local/bin $HOME/Applications $fish_user_paths # Vi mode function fish_user_key_bindings # fish_default_key_bindings fish_vi_key_bindings end ### AUTOCOMPLETE AND HIGHLIGHT COLORS ### set fish_color_normal brcyan set fish_color_autosuggestion '#7d7d7d' set fish_color_command brcyan set fish_color_error '#ff6c6b' set fish_color_param brcyan ### FUNCTIONS # Functions needed for !! and !$ function __history_previous_command switch (commandline -t) case "!" commandline -t $history[1]; commandline -f repaint case "*" commandline -i ! end end function __history_previous_command_arguments switch (commandline -t) case "!" commandline -t "" commandline -f history-token-search-backward case "*" commandline -i '$' end end # The bindings for !! and !$ if [ $fish_key_bindings = "fish_vi_key_bindings" ]; bind -Minsert ! __history_previous_command bind -Minsert '$' __history_previous_command_arguments else bind ! __history_previous_command bind '$' __history_previous_command_arguments end # Function for creating a backup file # ex: backup file.txt # result: copies file as file.txt.bak function backup --argument filename cp $filename $filename.bak end # Function for copying files and directories, even recursively. # ex: copy DIRNAME LOCATIONS # result: copies the directory and all of its contents. function copy set count (count $argv | tr -d \n) if test "$count" = 2; and test -d "$argv[1]" set from (echo $argv[1] | trim-right /) set to (echo $argv[2]) command cp -r $from $to else command cp $argv end end # Function for printing a column (splits input on whitespace) # ex: echo 1 2 3 | coln 3 # output: 3 function coln while read -l input echo $input | awk '{print $'$argv[1]'}' end end # Function for printing a row # ex: seq 3 | rown 3 # output: 3 function rown --argument index sed -n "$index p" end # Function for ignoring the first 'n' lines # ex: seq 10 | skip 5 # results: prints everything but the first 5 lines function skip --argument n tail +(math 1 + $n) end # Function for taking the first 'n' lines # ex: seq 10 | take 5 # results: prints only the first 5 lines function take --argument number head -$number end ### ALIASES # navigation alias ..='cd ..' alias .2='cd ../..' alias .3='cd ../../..' alias .4='cd ../../../..' alias .5='cd ../../../../..' # bat as cat alias cat='bat' # editors alias vim='nvim' # Changing "ls" to "exa" alias ls='exa -al --color=always --group-directories-first' # my preferred listing alias la='exa -a --color=always --group-directories-first' # all files and dirs alias ll='exa -l --color=always --group-directories-first' # long format alias lt='exa -aT --color=always --group-directories-first' # tree listing alias l.='exa -a | egrep "^\."' # xbps alias xb-up='sudo xbps-install -Su && xcheckrestart' # Refresh pkglist & update standard pkgs alias xb-get='sudo xbps-install -S' # Install a package alias xb-rmv='sudo xbps-remove -R' # Remove a package with all its dependencies alias xb-rmv-sec='sudo xbps-remove' # Remove a package with all its dependencies (secure way) alias xb-qry='sudo xbps-query' # Repo query alias xb-cln='sudo xbps-remove -o && sudo xbps-remove -O' # remove orphaned packages # Colorize grep output (good for log files) alias grep='grep --color=auto' alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' # confirm before overwriting something alias rm='rm -i' alias mv='mv -i' alias cp='cp -i' # git alias addup='git add -u' alias addall='git add .' alias branch='git branch' alias checkout='git checkout' alias clone='git clone' alias commit='git commit -m' alias fetch='git fetch' alias pull='git pull origin' alias push='git push origin' alias stat='git status' # 'status' is protected name so using 'stat' instead alias tag='git tag' alias newtag='git tag -a' # adding flags alias df='df -h' # human-readable sizes alias free='free -m' # show sizes in MB alias newsboat='newsboat -u ~/.config/newsboat/urls' # start newsboat with my urls file # ani-cli alias ani='ani-cli' alias ani-q='ani-cli -q' # to select video quality # ytfzf alias yt='ytfzf -f -t' # flix-cli alias flix-cli='flix-cli' # mount and unmount drives alias mnt='sudo mount' alias umnt='sudo umount' # mixers alias mx='pulsemixer' alias amx='alsamixer' # music player alias mk='cmus' # power management alias po='loginctl poweroff' alias sp='loginctl suspend' alias rb='loginctl reboot' # file manager alias fm='./.config/vifm/scripts/vifmrun' alias vifm='./.config/vifm/scripts/vifmrun' # ps alias psa="ps auxf" alias psgrep="ps aux | grep -v grep | grep -i -e VSZ -e" alias psmem='ps auxf | sort -nr -k 4' alias pscpu='ps auxf | sort -nr -k 3' # youtube-dl alias yta-aac="yt-dlp --extract-audio --audio-format aac " alias yta-best="yt-dlp --extract-audio --audio-format best " alias yta-flac="yt-dlp --extract-audio --audio-format flac " alias yta-m4a="yt-dlp --extract-audio --audio-format m4a " alias yta-mp3="yt-dlp --extract-audio --audio-format mp3 " alias yta-opus="yt-dlp --extract-audio --audio-format opus " alias yta-vorbis="yt-dlp --extract-audio --audio-format vorbis " alias yta-wav="yt-dlp --extract-audio --audio-format wav " alias ytv-best="yt-dlp -f bestvideo+bestaudio " # Network Manager and bluetooth alias netstats='nmcli dev' alias wfi='nmtui-connect' alias wfi-scan='nmcli dev wifi list' alias wfi-edit='nmtui-edit' alias wfi-on='nmcli radio wifi on' alias wfi-off='nmcli radio wifi off' alias blt='bluetoothctl' ### SETTING THE STARSHIP PROMPT ### eval "$(starship init bash)"