From fa08b8e9b8a7f63e3afab91f76702efec2ce1e5f Mon Sep 17 00:00:00 2001 From: Charles Gould Date: Fri, 27 Mar 2020 20:12:31 -0500 Subject: [PATCH] fish: fix paths, making scope explicit --- fish/config.fish | 62 +++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/fish/config.fish b/fish/config.fish index 0e6b89b..ead63e5 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -5,29 +5,34 @@ set fish_greeting 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 +set -gx EDITOR nvim +set -gx LANG en_US.UTF-8 +set -gx SBT_OPTS '-Dsbt.supershell=false' +set -gx ENHANCD_DISABLE_DOT 1 if command -q moar - set -x PAGER moar + set -gx PAGER moar else if command -q most - set -x PAGER most + set -gx PAGER most end if test -x /usr/libexec/java_home - set -x JAVA_HOME (/usr/libexec/java_home -v 1.8) + set -gx JAVA_HOME (/usr/libexec/java_home -v 1.8) +end + +# Path +if not set -q fish_user_paths + set -U fish_user_paths ~/bin ~/go/bin end # FZF (https://github.com/junegunn/fzf) -set -x FZF_DEFAULT_OPTS "--no-height --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 --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'" +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 -C {} | head -200'" # Git prompt set -g __fish_git_prompt_showdirtystate 1 @@ -45,27 +50,12 @@ 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 +function ..; cd ..; end +function ...; cd ../..; end +function ....; cd ../../..; end # Fish package manager set -g fisher_path ~/.config/fish/fisher @@ -89,6 +79,14 @@ if functions -q base16-bright end end +# Fish local configs +set -g _fish_local_path ~/.local/fish +test -d $_fish_local_path/functions ; and set fish_function_path $fish_function_path[1] $_fish_local_path/functions $fish_function_path[2..-1] +test -d $_fish_local_path/completions ; and set fish_complete_path $fish_complete_path[1] $_fish_local_path/completions $fish_complete_path[2..-1] +for file in $_fish_local_path/conf.d/*.fish + builtin source $file 2> /dev/null +end + # Homebrew package manager if test -x /home/linuxbrew/.linuxbrew/bin/brew eval (/home/linuxbrew/.linuxbrew/bin/brew shellenv)