Skip to content

Instantly share code, notes, and snippets.

@mindvox
Last active November 12, 2015 09:14
Show Gist options
  • Save mindvox/f0126af7ebc0423491d5 to your computer and use it in GitHub Desktop.
Save mindvox/f0126af7ebc0423491d5 to your computer and use it in GitHub Desktop.
Fish shell configurations

Fish Shell Configuration

Configuration files which create a fancy FiSH shell prompt. Note that these make use of the baseline unix utility for reporting the current working directory. To display the full path, simply replace the command (basename $PWD) with (prompt_pwd).

Installation

Create the config directory with mkdir -p ~/.config/fish as a regular user and as root. Copy the configurations for each to a file called ~/.config/fish/config.fish.

Configure as needed.

Author

Created with ❤️ by @karlbateman

##
# Root prompt
# Custom fish shell prompt for root accounts
#
##
# Globals
#
set -g -x PATH /usr/local/bin $PATH
set -g -x LC_ALL en_GB.UTF-8
set -g -x LANG en_GB.UTF-8
set -g -x LANGUAGE en_GB.UTF-8
set -g -x fish_greeting ''
##
# Contextual colours
#
set normal (set_color normal)
set white (set_color FFFFFF)
set cyan (set_color 00E5FF)
set purple (set_color D500F9)
set magenta (set_color F50057)
set blue (set_color 2979FF)
set yellow (set_color FFEA00)
set brown (set_color 8D6E63)
set green (set_color 00E676)
set red (set_color FF1744)
set black (set_color 181818)
set gray (set_color BDBDBD)
##
# Custom syntax colours
#
set fish_color_normal normal
set fish_color_command 2196F3 # blue
set fish_color_quote 4CAF50 # green
set fish_color_redirection 3F51B5 # Indigo
set fish_color_end FF9800 # orange
set fish_color_error F44336 # red
set fish_color_param normal # white
set fish_color_comment 607D8B # grey
set fish_color_match 9C27B0 # purple
set fish_color_search_match E91E63 # magenta
set fish_color_operator FFEB3B # yellow
set fish_color_escape 795548 # brown
set fish_color_cwd BDBDBD # dull white
##
# Fish git prompt
#
set __fish_git_prompt_show_informative_status 'yes'
set __fish_git_prompt_showdirtystate 'yes'
set __fish_git_prompt_showstashstate 'yes'
set __fish_git_prompt_showuntrackedfiles 'yes'
set __fish_git_prompt_showupstream 'yes'
# Fish git symbols
set __fish_git_prompt_char_upstream_equal '='
set __fish_git_prompt_char_upstream_prefix ' '
set __fish_git_prompt_char_upstream_ahead '>'
set __fish_git_prompt_char_upstream_behind '<'
set __fish_git_prompt_char_stateseparator '|'
set __fish_git_prompt_char_dirtystate '+'
set __fish_git_prompt_char_invalidstate 'x'
set __fish_git_prompt_char_stagedstate 'o'
set __fish_git_prompt_char_untrackedfiles '.'
set __fish_git_prompt_char_cleanstate '~'
# Fish git colours
set __fish_git_prompt_color_prefix BDBDBD
set __fish_git_prompt_color_suffix BDBDBD
set __fish_git_prompt_color_bare FFFFFF
set __fish_git_prompt_color_merging FF9800
set __fish_git_prompt_color_branch 009688
set __fish_git_prompt_color_flags 03A9F4
set __fish_git_prompt_color_upstream_ahead 4CAF50
set __fish_git_prompt_color_upstream_behind F44336
##
# Construct prompt
#
function fish_prompt
set last_status $status
set_color FF1744
echo -n '-> '
set_color C6FF00
echo -n (basename $PWD)
echo -n (__fish_git_prompt)
echo -n ' '
set_color normal
end
##
# User prompt
# Custom fish shell prompt for user accounts
#
##
# Globals
#
set -g -x PATH /usr/local/bin $PATH
set -g -x LC_ALL en_GB.UTF-8
set -g -x LANG en_GB.UTF-8
set -g -x LANGUAGE en_GB.UTF-8
set -g -x fish_greeting ''
##
# Contextual colours
#
set normal (set_color normal)
set white (set_color FFFFFF)
set cyan (set_color 00E5FF)
set purple (set_color D500F9)
set magenta (set_color F50057)
set blue (set_color 2979FF)
set yellow (set_color FFEA00)
set brown (set_color 8D6E63)
set green (set_color 00E676)
set red (set_color FF1744)
set black (set_color 181818)
set gray (set_color BDBDBD)
##
# Custom syntax colours
#
set fish_color_normal normal
set fish_color_command 2196F3 # blue
set fish_color_quote 4CAF50 # green
set fish_color_redirection 3F51B5 # Indigo
set fish_color_end FF9800 # orange
set fish_color_error F44336 # red
set fish_color_param normal # white
set fish_color_comment 607D8B # grey
set fish_color_match 9C27B0 # purple
set fish_color_search_match E91E63 # magenta
set fish_color_operator FFEB3B # yellow
set fish_color_escape 795548 # brown
set fish_color_cwd BDBDBD # dull white
##
# Fish git prompt
#
set __fish_git_prompt_show_informative_status 'yes'
set __fish_git_prompt_showdirtystate 'yes'
set __fish_git_prompt_showstashstate 'yes'
set __fish_git_prompt_showuntrackedfiles 'yes'
set __fish_git_prompt_showupstream 'yes'
# Fish git symbols
set __fish_git_prompt_char_upstream_equal '='
set __fish_git_prompt_char_upstream_prefix ' '
set __fish_git_prompt_char_upstream_ahead '>'
set __fish_git_prompt_char_upstream_behind '<'
set __fish_git_prompt_char_stateseparator '|'
set __fish_git_prompt_char_dirtystate '+'
set __fish_git_prompt_char_invalidstate 'x'
set __fish_git_prompt_char_stagedstate 'o'
set __fish_git_prompt_char_untrackedfiles '.'
set __fish_git_prompt_char_cleanstate '~'
# Fish git colours
set __fish_git_prompt_color_prefix BDBDBD
set __fish_git_prompt_color_suffix BDBDBD
set __fish_git_prompt_color_bare FFFFFF
set __fish_git_prompt_color_merging FF9800
set __fish_git_prompt_color_branch 009688
set __fish_git_prompt_color_flags 03A9F4
set __fish_git_prompt_color_upstream_ahead 4CAF50
set __fish_git_prompt_color_upstream_behind F44336
##
# Construct prompt
#
function fish_prompt
set last_status $status
set_color AEEA00
echo -n '-> '
set_color D500F9
echo -n (basename $PWD)
set_color white
echo -n (__fish_git_prompt)
echo -n ' '
set_color white
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment