config/fish/config.fish

86 lines
3.2 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 -x EDITOR nvim
set -x LANG en_US.UTF-8
set -x SBT_OPTS '-Dsbt.supershell=false'
set -x ENHANCD_DISABLE_DOT 1
if command -q most
set -x MANPAGER most
end
if test -x /usr/libexec/java_home
set -x JAVA_HOME (/usr/libexec/java_home -v 1.8)
end
# FZF (https://github.com/junegunn/fzf)
set -x FZF_DEFAULT_OPTS "--height=40% --layout=reverse --multi"
set -x FZF_DEFAULT_COMMAND "fd --type=file"
set -x FZF_CTRL_T_COMMAND "fd --type=file --follow"
set -x FZF_CTRL_T_OPTS "--ansi --no-height --preview 'bat --color=always {}'"
set -x FZF_CTRL_R_OPTS "--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'"
set -x FZF_ALT_C_COMMAND "fd --type=directory --follow"
set -x FZF_ALT_C_OPTS "--preview 'tree -C {} | head -200'"
# 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
# Path
set --erase PATH
test -d $HOME/bin ; and set -x PATH $HOME/bin
test -d /usr/local/bin ; and set -x PATH $PATH /usr/local/bin
test -d /usr/bin ; and set -x PATH $PATH /usr/bin
test -d /bin ; and set -x PATH $PATH /bin
test -d /usr/local/sbin ; and set -x PATH $PATH /usr/local/sbin
test -d /usr/sbin ; and set -x PATH $PATH /usr/sbin
test -d /sbin ; and set -x PATH $PATH /sbin
# Aliases
alias vi='nvim'
alias vim='nvim'
# Fish private configs
set -g fish_private_path ~/.config/fish/private
test -d $fish_private_path/functions ; and set fish_function_path $fish_function_path[1] $fish_private_path/functions $fish_function_path[2..-1]
test -d $fish_private_path/completions ; and set fish_complete_path $fish_complete_path[1] $fish_private_path/completions $fish_complete_path[2..-1]
for file in $fish_private_path/conf.d/*.fish
builtin source $file 2> /dev/null
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 https://git.io/fisher --create-dirs -sLo $fisher_path/functions/fisher.fish
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