config/fish/config.fish

84 lines
2.8 KiB
Fish

# Disable the default shell greeting
set fish_greeting
# Disable the abbreviated directory format
set fish_prompt_pwd_dir_length 0
# Environment variables
set -gx EDITOR nvim
set -gx LANG en_US.UTF-8
set -gx SBT_OPTS '-Dsbt.supershell=false'
if test -x /usr/libexec/java_home
set -gx JAVA_HOME (/usr/libexec/java_home -v 1.8)
end
# FZF (https://github.com/junegunn/fzf)
set -gx FZF_DEFAULT_OPTS "--no-height --layout=reverse --multi"
set -gx FZF_DEFAULT_COMMAND "fd --type=file"
set -gx FZF_CTRL_T_COMMAND "fd --type=file --follow"
set -gx FZF_CTRL_T_OPTS "--ansi --preview 'bat --color=always {}'"
set -gx FZF_CTRL_R_OPTS "--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'"
set -gx FZF_ALT_C_COMMAND "fd --type=directory --follow"
set -gx FZF_ALT_C_OPTS "--preview 'tree -CL 1 {}'"
# Git prompt
set -g __fish_git_prompt_showdirtystate 1
set -g __fish_git_prompt_showstashstate 1
set -g __fish_git_prompt_showuntrackedfiles 1
set -g __fish_git_prompt_showupstream informative
set -g __fish_git_prompt_char_upstream_ahead '↑'
set -g __fish_git_prompt_char_upstream_behind '↓'
set -g __fish_git_prompt_char_upstream_prefix ' '
set -g __fish_git_prompt_color_branch magenta
set -g __fish_git_prompt_color_dirtystate cyan
set -g __fish_git_prompt_color_invalidstate red
set -g __fish_git_prompt_color_stagedstate cyan
set -g __fish_git_prompt_color_stashstate cyan
set -g __fish_git_prompt_color_untrackedfiles cyan
set -g __fish_git_prompt_color_upstream yellow
# Termcap colors (used by less, and therefore man)
set -x LESS_TERMCAP_mb (set_color brmagenta)
set -x LESS_TERMCAP_md (set_color brred)
set -x LESS_TERMCAP_me (set_color normal)
set -x LESS_TERMCAP_se (set_color normal)
set -x LESS_TERMCAP_so (set_color -b blue black)
set -x LESS_TERMCAP_ue (set_color normal)
set -x LESS_TERMCAP_us (set_color brgreen)
# Abbreviations
abbr -a -g d docker
abbr -a -g vi nvim
abbr -a -g vim nvim
# Aliases
alias which='type --all --short'
function ..; cd ..; end
function ...; cd ../..; end
function ....; cd ../../..; end
# Fish package manager
set -g fisher_path ~/.config/fish/fisher
set fish_function_path $fish_function_path[1] $fisher_path/functions $fish_function_path[2..-1]
set fish_complete_path $fish_complete_path[1] $fisher_path/completions $fish_complete_path[2..-1]
for file in $fisher_path/conf.d/*.fish
builtin source $file 2> /dev/null
end
if not functions -q fisher
echo "Installing fish-shell package manager: $fisher_path/functions/fisher.fish"
curl -fsSL -o $fisher_path/functions/fisher.fish --create-dirs https://git.io/fisher
echo "Installing fish-shell packages..."
fish -c fisher
end
# Homebrew package manager
if test -x /home/linuxbrew/.linuxbrew/bin/brew
eval (/home/linuxbrew/.linuxbrew/bin/brew shellenv)
end
# Cheatsheet widget (Ctrl+G)
if command -q navi
navi widget fish | source
end