Files
dotfiles/config/fish/config.fish
T

135 lines
4.2 KiB
Fish

# ==============================================================================
# ENVIRONMENT VARIABLES
# ==============================================================================
set -gx XDG_CONFIG_HOME "$HOME/.config"
set -gx XDG_DATA_HOME "$HOME/.local/share"
set -gx XDG_CACHE_HOME "$HOME/.cache"
set -gx XDG_STATE_HOME "$HOME/.local/state"
set -gx GOOGLE_API_KEY "no"
set -gx GOOGLE_DEFAULT_CLIENT_ID "no"
set -gx GOOGLE_DEFAULT_CLIENT_SECRET "no"
# Core settings
set -gx EDITOR "vim"
set -gx VISUAL "vim"
set -gx MANPAGER "vim +Man!"
set -gx BROWSER "firefox"
set -gx COLORTERM "truecolor"
# Development
set -gx DEBUG 1
set -gx GOPATH "$HOME/.go"
set -gx GOCACHE "$HOME/.go/cache"
set -gx GOROOT /usr/local/go
# Direnv
direnv hook fish | source
# ==============================================================================
# FZF configuration
# ==============================================================================
set -gx FZF_DEFAULT_OPTS "
--height 40%
--layout=reverse
--border
--ansi
--preview-window=down:30%
--bind 'ctrl-d:preview-page-down,ctrl-u:preview-page-up'
--color=fg:#ffffff,header:#f38ba8,info:#cba6ac,pointer:#f5e0dc
--color=marker:#f5e0dc,fg+:#cdd6f4,prompt:#cba6ac,hl+:#f38ba8"
set -gx FZF_DEFAULT_COMMAND "fdfind --exclude={.git,.cache,.xmake,.zig-cache,build,tmp,node_modules,elpa} --type f -H"
# ==============================================================================
# PATH CONFIGURATION
# ==============================================================================
# fish_add_path dedupes + checks existence natively, no helper needed
fish_add_path /var/lib/flatpak/exports/bin
fish_add_path /usr/local/bin
fish_add_path /usr/local/go/bin
fish_add_path $GOPATH/bin
fish_add_path $HOME/bin
fish_add_path $HOME/.local/bin
fish_add_path $HOME/.local/share/flatpak/exports/bin
fish_add_path $HOME/.npm-global/bin
fish_add_path $HOME/.odin/
# ==============================================================================
# ALIASES
# ==============================================================================
# List commands
alias ls 'ls -lh --color=auto --group-directories-first'
alias ll 'ls -lAh --color=auto --group-directories-first'
alias la 'ls -la --color=auto --group-directories-first'
alias l 'ls -CF --color=auto'
alias tree 'tree --dirsfirst -C'
# Safety aliases
alias rm 'rm -I --preserve-root'
alias mv 'mv -i'
alias cp 'cp -i'
alias ln 'ln -i'
# System information
alias df 'df -h'
alias du 'du -h'
alias free 'free -h'
alias bat 'bat --theme="ansi" --paging=never'
# Application shortcuts
alias :q 'exit'
alias files 'thunar .'
alias fetch 'pfetch'
# Custom shortcuts
alias reload 'source ~/.config/fish/config.fish'
alias dots 'cd ~/.dotfiles && vi'
alias doti 'bash ~/.dotfiles/install.sh -i'
alias dotl 'bash ~/.dotfiles/install.sh -l'
alias myip 'curl ipinfo.io/ip; echo ""'
alias query 'xbps-query -Rs'
alias commits 'git log origin/main..HEAD --oneline'
## Basic project picker using fzf
function pp
set -l project (find ~/Projects -mindepth 1 -maxdepth 1 -type d | awk -F/ '{print $NF "\t" $0}' | fzf --with-nth=1)
test -z "$project"; and return
set project (echo $project | cut -f2)
cd $project; and clear
end
# ==============================================================================
# GIT PROMPT CONFIG
# (used by fish_git_prompt, called from fish_prompt.fish below)
# ==============================================================================
set -g __fish_git_prompt_show_informative_status
set -g __fish_git_prompt_char_stagedstate '●'
set -g __fish_git_prompt_char_dirtystate '+'
set -g __fish_git_prompt_char_untrackedstate ''
set -g __fish_git_prompt_color_branch magenta
set -g __fish_git_prompt_color_stagedstate yellow
set -g __fish_git_prompt_color_dirtystate red
# ==============================================================================
# PROMPT
# ==============================================================================
function fish_prompt
set_color green
echo -n (whoami)
set_color normal
echo -n '@'
set_color blue
echo -n (prompt_hostname)
set_color normal
echo -n ':'
set_color cyan
echo -n (prompt_pwd)
set_color normal
fish_git_prompt
echo -n '$ '
end