From 1a8f4a4864df33d1758cdd135b77c235a477f35c Mon Sep 17 00:00:00 2001 From: Charles Gould Date: Mon, 15 Jun 2020 19:11:55 -0500 Subject: [PATCH] fish: add color settings --- fish/conf.d/abbr.fish | 23 -------- fish/config.fish | 128 ++++++++++++++++++++++++++++++------------ 2 files changed, 91 insertions(+), 60 deletions(-) delete mode 100644 fish/conf.d/abbr.fish diff --git a/fish/conf.d/abbr.fish b/fish/conf.d/abbr.fish deleted file mode 100644 index 8756b04..0000000 --- a/fish/conf.d/abbr.fish +++ /dev/null @@ -1,23 +0,0 @@ -if status --is-interactive - abbr -a -g d 'docker' - abbr -a -g l 'less' - abbr -a -g m 'micro' - abbr -a -g v 'nvim' - - abbr -a -g g 'git' - abbr -a -g ga 'git add' - abbr -a -g gb 'git branchsort' - abbr -a -g gbd 'git branch -D' - abbr -a -g gc 'git commit' - abbr -a -g gco 'git checkout' - abbr -a -g gcp 'git cherry-pick' - abbr -a -g gd 'git diff' - abbr -a -g gdc 'git diff --cached' - abbr -a -g gdh 'git diff --cached HEAD~' - abbr -a -g gf 'git fetch --all --prune' - abbr -a -g gl 'git log --oneline -10' - abbr -a -g gr 'git restore' - abbr -a -g gs 'git status' - abbr -a -g gst 'git stash' - abbr -a -g gsw 'git switch' -end diff --git a/fish/config.fish b/fish/config.fish index eee459a..384202e 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -1,9 +1,3 @@ -# 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 @@ -22,31 +16,6 @@ set -gx FZF_CTRL_R_OPTS "--preview 'echo {}' --preview-window down:3:hidden:wrap 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) - # Aliases alias which='type --all --short' function ..; cd ..; end @@ -57,22 +26,107 @@ function ....; cd ../../..; end 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 +for file in $fisher_path/conf.d/*.fish + builtin source $file 2> /dev/null +end # Nix package manager if test -f ~/.nix-profile/etc/profile.d/nix.sh functions -q fenv && fenv source ~/.nix-profile/etc/profile.d/nix.sh end -# Cheatsheet widget (Ctrl+G) -if command -q navi - navi widget fish | source +if status --is-interactive + # Disable the default shell greeting + set fish_greeting + + # Disable the abbreviated directory format + set fish_prompt_pwd_dir_length 0 + + # Abbreviations + abbr -a -g d 'docker' + abbr -a -g l 'less' + abbr -a -g m 'micro' + abbr -a -g v 'nvim' + + # Git abbreviations + abbr -a -g g 'git' + abbr -a -g ga 'git add' + abbr -a -g gb 'git branchsort' + abbr -a -g gbd 'git branch -D' + abbr -a -g gc 'git commit' + abbr -a -g gco 'git checkout' + abbr -a -g gcp 'git cherry-pick' + abbr -a -g gd 'git diff' + abbr -a -g gdc 'git diff --cached' + abbr -a -g gdh 'git diff --cached HEAD~' + abbr -a -g gf 'git fetch --all --prune' + abbr -a -g gl 'git log --oneline -10' + abbr -a -g gr 'git restore' + abbr -a -g gs 'git status' + abbr -a -g gst 'git stash' + abbr -a -g gsw 'git switch' + + # 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 for less and manpages + 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) +end + +if not set -q __universals_initialized + set -U __universals_initialized + + # Colors + set -U fish_color_autosuggestion a5a5a9 + set -U fish_color_cancel -r + set -U fish_color_command green + set -U fish_color_comment a5a5a9 + set -U fish_color_cwd green + set -U fish_color_cwd_root red + set -U fish_color_end brblack + set -U fish_color_error red + set -U fish_color_escape yellow + set -U fish_color_history_current --bold + set -U fish_color_host normal + set -U fish_color_host_remote yellow + set -U fish_color_match --background=brblue + set -U fish_color_normal normal + set -U fish_color_operator blue + set -U fish_color_param white + set -U fish_color_quote yellow + set -U fish_color_redirection cyan + set -U fish_color_search_match bryellow --background=515151 + set -U fish_color_selection white --bold --background=515151 + set -U fish_color_status red + set -U fish_color_user brgreen + set -U fish_color_valid_path --underline + set -U fish_pager_color_completion normal + set -U fish_pager_color_description yellow --dim + set -U fish_pager_color_prefix white --bold + set -U fish_pager_color_progress black --background=cyan end