Files
.config/fish/config.fish
2025-09-08 13:40:07 +02:00

146 lines
3.6 KiB
Fish

# vim: filetype=sh
# Variables
set -g -x fish_greeting ""
set -U os (uname)
set -U TERMINAL "st"
# Exports
## zoxide
export FZF_DEFAULT_OPTS='--height 40%'
zoxide init fish --cmd z | source
## dwmblocks
fish_add_path /home/(whoami)/.local/bin
fish_add_path /home/(whoami)/.local/bin/statusbar
## DOTNET
fish_add_path $DOTNET_ROOT
fish_add_path $DOTNET_ROOT/tools
export DOTNET_ROOT=$HOME/.dotnet
## Node Version Manager
export NVM_DIR=$HOME/.nvm
## Unison
export UNISON=$HOME/.config/unison
## Spicetify
fish_add_path $HOME/.spicetify
## JOZ tools
export JOZ_PATH=$HOME/Documents/devel
export BTG_IP="192.168.201.128"
export BTG_PASSWORD="btg"
# Internet
## Automatically set a default User-Agent header
alias curl="curl -H \"User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0\" "
alias wget="wget --header=\"User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0\" "
## wget/curl tests
alias ct="curl \"https://httpbin.org/get\" >> curl.json"
alias wt="wget \"https://httpbin.org/get\" -d -O wget.json -o wget.log"
# Aliases / shortcuts
## Exiting / Package management
alias ka="killall"
alias cya="shutdown now"
alias pacman="sudo pacman"
alias upc="sudo pacman -Syu; pkill -RTMIN+8 dwmblocks"
alias lsp="pacman -Qett | less" #--color=always
### Shortcut creation
alias ref="shortcuts >/dev/null; source ~/.config/shortcutrc"
## Lazy / Filebrowsing
alias d="lazydocker"
alias g="lazygit"
alias r="ranger"
alias f="fzf"
alias fn="nvim (fzf)"
### eza, a fork of exa, a coloured ls alternative
alias ls="eza "
alias la="eza -la"
alias ols="/usr/bin/ls"
alias olsc="/usr/bin/ls -hN --color=auto --group-directories-first"
### Set colours default for commands
alias diff="diff --color=auto"
alias grep="grep --color=auto"
alias ccat="highlight --out-format=ansi"
### Show system information
alias show="inxi -vvG && fastfetch"
## Development
### Use neovim for vim if present
command -v nvim >/dev/null && alias vim="nvim" vimdiff="nvim -d"
alias v="vim"
alias vi="vim"
alias py="python"
### GHCup (Haskell)
set -q GHCUP_INSTALL_BASE_PREFIX[1]; or set GHCUP_INSTALL_BASE_PREFIX $HOME ; set -gx PATH $HOME/.cabal/bin /home/wessel/.ghcup/bin $PATH # ghcup-env
## Video downloading
alias yt="yt-dlp --add-metadata -i -o '%(upload_date)s-%(title)s.%(ext)s'"
alias yta="yt -x -f bestaudio/best"
# Set custom prompt
function fish_prompt -d "Write out the prompt"
set_color "c0241e"; printf "["
set_color "d69923"; printf $USER
set_color "99AAB5"; printf "@"
set_color "679D69"; printf $hostname
set_color "c0241e"; printf "]"
set_color grey; printf '%s' (prompt_pwd);
set_color "99AAB5"; printf "\$ "
end
bind -e \cv
# Check if any directory has git updates
function check_git_status
set target_dir $argv[1]
if test -z "$target_dir"
set target_dir (pwd)
end
if test -d $target_dir/.git
set git_status (git -C $target_dir status --porcelain)
if test -n "$git_status"
set dir_name (basename $target_dir)
echo (set_color yellow)"[$dir_name] There are uncommitted changes or untracked files."(set_color normal)
end
end
end
check_git_status $HOME/.config
check_git_status $HOME/.local
# Start tmux by default
# if status is-interactive
# and not set -q TMUX
# exec tmux
# end
#onefetch
function cd -w='cd'
z $argv || return
check_directory_for_new_repository
end
function check_directory_for_new_repository
set current_repository (git rev-parse --show-toplevel 2> /dev/null)
if [ "$current_repository" ] && \
[ "$current_repository" != "$last_repository" ]
onefetch
end
set -gx last_repository $current_repository
end