2023-01-23 22:11:53 +00:00
|
|
|
## ____ __
|
|
|
|
## / __ \_________ _/ /_____
|
|
|
|
## / / / / ___/ __ `/ //_/ _ \
|
|
|
|
## / /_/ / / / /_/ / ,< / __/ Clay Gomera (Drake)
|
|
|
|
## /_____/_/ \__,_/_/|_|\___/ My custom fish config
|
|
|
|
##
|
|
|
|
|
|
|
|
### 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
|
2024-08-11 21:30:43 +00:00
|
|
|
set -U fish_user_paths $HOME/.bin $HOME/.local/bin $HOME/.go/bin $HOME/.cargo/bin $HOME/.local/lib/flutter/bin $HOME/Applications $HOME/.local/share/JetBrains/Toolbox/scripts $HOME/.config/vifm/scripts /var/lib/flatpak/exports/bin/ $fish_user_paths
|
2023-01-23 22:11:53 +00:00
|
|
|
|
|
|
|
### EXPORT ###
|
2023-06-20 14:29:23 +00:00
|
|
|
set fish_greeting # Supresses fish's intro message
|
|
|
|
set TERM "xterm-256color" # Sets the terminal type
|
2023-12-28 04:35:27 +00:00
|
|
|
set EDITOR "$HOME/.local/bin/lvim"
|
2024-08-11 21:30:43 +00:00
|
|
|
set VISUAL "wezterm start --class neovim $HOME/.local/bin/lvim"
|
|
|
|
set GOPATH "$HOME/.go"
|
2023-01-23 22:11:53 +00:00
|
|
|
|
|
|
|
### SET BAT AS MANPAGER
|
2023-12-29 21:55:55 +00:00
|
|
|
#set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"
|
2023-01-23 22:11:53 +00:00
|
|
|
|
|
|
|
### SET EITHER DEFAULT EMACS MODE OR VI MODE ###
|
|
|
|
function fish_user_key_bindings
|
|
|
|
# fish_default_key_bindings
|
|
|
|
fish_vi_key_bindings
|
|
|
|
end
|
|
|
|
### END OF VI MODE ###
|
|
|
|
|
|
|
|
### AUTOCOMPLETE AND HIGHLIGHT COLORS ###
|
|
|
|
set fish_color_normal brcyan
|
|
|
|
set fish_color_autosuggestion '#504945'
|
|
|
|
set fish_color_command brcyan
|
|
|
|
set fish_color_error '#fb4934'
|
|
|
|
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
|
2024-08-11 21:30:43 +00:00
|
|
|
|
|
|
|
# unlock ssh keys
|
|
|
|
function unlock
|
|
|
|
ssh-add "$HOME/.ssh/$argv[1]"
|
|
|
|
end
|
|
|
|
|
2023-01-23 22:11:53 +00:00
|
|
|
### END OF FUNCTIONS ###
|
|
|
|
|
|
|
|
### ALIASES ###
|
|
|
|
# navigation
|
|
|
|
alias ..='cd ..'
|
|
|
|
alias ...='cd ../..'
|
|
|
|
alias .3='cd ../../..'
|
|
|
|
alias .4='cd ../../../..'
|
|
|
|
alias .5='cd ../../../../..'
|
|
|
|
|
2024-08-11 21:30:43 +00:00
|
|
|
# use lunarvim or neovim for vim if present.
|
|
|
|
if test -x "$HOME/.local/bin/lvim"
|
|
|
|
alias vim "$HOME/.local/bin/lvim"
|
|
|
|
else if test -x (command -v nvim)
|
|
|
|
alias vim "nvim"
|
|
|
|
end
|
2023-01-23 22:11:53 +00:00
|
|
|
|
|
|
|
# bat as cat
|
2024-08-11 21:30:43 +00:00
|
|
|
if test -x (command -v bat)
|
|
|
|
alias cat "bat"
|
|
|
|
end
|
2023-01-23 22:11:53 +00:00
|
|
|
|
2023-12-28 04:35:27 +00:00
|
|
|
# Changing "ls" to "eza"
|
|
|
|
alias ls='eza -al --color=always --group-directories-first' # my preferred listing
|
|
|
|
alias la='eza -a --color=always --group-directories-first' # all files and dirs
|
|
|
|
alias ll='eza -l --color=always --group-directories-first' # long format
|
|
|
|
alias lt='eza -aT --color=always --group-directories-first' # tree listing
|
|
|
|
alias l.='eza -a | egrep "^\."'
|
2023-01-23 22:11:53 +00:00
|
|
|
|
2023-06-20 14:29:23 +00:00
|
|
|
# package management
|
2024-08-11 21:30:43 +00:00
|
|
|
alias pkg-update="paru -Syu"
|
|
|
|
alias pkg-install="paru -S"
|
|
|
|
alias pkg-remove="paru -Rcns"
|
|
|
|
alias pkg-remove-sec="paru -R"
|
|
|
|
alias pkg-search="paru -Ss"
|
|
|
|
alias pkg-clean="paru -Scc && paru -Rns (pacman -Qtdq)"
|
2023-02-20 00:41:01 +00:00
|
|
|
|
2023-01-23 22:11:53 +00:00
|
|
|
# Colorize grep output (good for log files)
|
|
|
|
alias grep='grep --color=auto'
|
|
|
|
alias egrep='egrep --color=auto'
|
|
|
|
alias fgrep='fgrep --color=auto'
|
|
|
|
|
|
|
|
# file management
|
2023-12-28 04:35:27 +00:00
|
|
|
alias fm="$HOME/.config/vifm/scripts/vifmrun"
|
|
|
|
alias flm="$HOME/.config/vifm/scripts/vifmrun"
|
|
|
|
alias vifm="$HOME/.config/vifm/scripts/vifmrun"
|
2023-01-23 22:11:53 +00:00
|
|
|
alias cp='cp -iv'
|
|
|
|
alias mv='mv -iv'
|
|
|
|
alias rm='rm -vI'
|
|
|
|
alias mkd='mkdir -pv'
|
|
|
|
alias mkdir='mkdir -pv'
|
|
|
|
|
|
|
|
# audio
|
|
|
|
alias mx='pulsemixer'
|
|
|
|
alias amx='alsamixer'
|
|
|
|
alias mk='cmus'
|
|
|
|
alias ms='cmus'
|
|
|
|
alias music='cmus'
|
|
|
|
|
|
|
|
# multimedia scripts
|
|
|
|
alias fli='flix-cli'
|
|
|
|
alias ani='ani-cli'
|
|
|
|
alias aniq='ani-cli -q'
|
|
|
|
|
|
|
|
# adding flags
|
|
|
|
alias df='df -h' # human-readable sizes
|
|
|
|
alias free='free -m' # show sizes in MB
|
|
|
|
|
|
|
|
# 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'
|
|
|
|
|
|
|
|
# git
|
2024-08-11 21:30:43 +00:00
|
|
|
alias git-adu='git add -u'
|
|
|
|
alias git-adl='git add .'
|
|
|
|
alias git-brn='git branch'
|
|
|
|
alias git-chk='git checkout'
|
|
|
|
alias git-cln='git clone'
|
|
|
|
alias git-cmt='git commit -m'
|
|
|
|
alias git-fth='git fetch'
|
|
|
|
alias git-pll='git pull origin'
|
|
|
|
alias git-psh='git push origin'
|
|
|
|
alias git-sts='git status'
|
|
|
|
alias git-tag='git tag'
|
|
|
|
alias git-ntg='git tag -a'
|
2023-01-23 22:11:53 +00:00
|
|
|
|
|
|
|
# power management
|
|
|
|
alias po='systemctl poweroff'
|
|
|
|
alias sp='systemctl suspend'
|
|
|
|
alias rb='systemctl reboot'
|
|
|
|
|
|
|
|
# youtube-
|
|
|
|
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 "
|
2024-08-11 21:30:43 +00:00
|
|
|
alias yt='ytfzf -ftslT kitty'
|
|
|
|
alias youtube='ytfzf -ftslT kitty'
|
|
|
|
alias ytm='ytfzf -mtslT kitty'
|
|
|
|
alias youtube-music='ytfzf -mtslT kitty'
|
2023-01-23 22:11:53 +00:00
|
|
|
|
|
|
|
# network and bluetooth
|
|
|
|
alias netstats='nmcli dev'
|
|
|
|
alias wfi='nmtui-connect'
|
|
|
|
alias wfi-scan='nmcli dev wifi rescan && 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 ###
|
|
|
|
starship init fish | source
|
2024-08-11 21:30:43 +00:00
|
|
|
zoxide init fish | source
|