# name: Nerv # author: kujiu # description: based on Astronaut of Radu Potop and on Disco of Fabian Homborg, colors from Nightfox by EdenEast function fish_prompt --description 'Write out the prompt' set -f color_venv $nightfox_fg3 set -f color_bind normal set -f color_text $nightfox_bg0 set -f color_status $nightfox_green set -f color_bind $nightfox_green set -f color_cwd $fish_color_cwd set -f color_vcs_text $nightfox_yellow set -f color_vcs_bg $nightfox_bg2 set -f char_bind 'E' set -f char_user_cwd '%' set -f char_root_cwd '#' set -f last_status $status set -f normal (set_color normal) set -f prompt_status "✔" set -g __fish_git_prompt_color $nightfox_blue set -g __fish_git_prompt_showstashstate 1 set -g __fish_git_prompt_showdirtystate 1 set -g __fish_git_prompt_showuntrackedfiles 1 set -g __fish_git_prompt_showupstream informative set -g __fish_git_prompt_showcolorhints 1 set -g __fish_git_prompt_use_informative_chars 0 set -g __fish_git_prompt_show_informative_status 1 set -g __fish_git_prompt_char_stateseparator '|' set -g __fish_git_prompt_char_cleanstate 'C' set -g __fish_git_prompt_char_dirtystate "+" set -g __fish_git_prompt_char_invalidstate "#" set -g __fish_git_prompt_char_stagedstate "S" set -g __fish_git_prompt_char_stashstate "\$" set -g __fish_git_prompt_char_upstream_ahead "↑" set -g __fish_git_prompt_char_upstream_behind "↓" set -g __fish_git_prompt_char_upstream_diverged "!=" set -g __fish_git_prompt_char_upstream_equal "==" set -g __fish_git_prompt_color_branch -b $color_vcs_bg $color_vcs_text set -g __fish_git_prompt_color_branch_detached -b $color_vcs_bg $nightfox_red set -g __fish_git_prompt_color_branch_dirty -b $color_vcs_bg $nightfox_blue set -g __fish_git_prompt_color_branch_staged -b $color_vcs_bg $nightfox_green set -g __fish_git_prompt_color_flags -b $color_vcs_bg $color_vcs_text set -g __fish_git_prompt_color -b $color_vcs_bg $color_vcs_text set -g __fish_git_prompt_color_prefix -b $color_vcs_bg $color_vcs_text set -g __fish_git_prompt_color_suffix -b $color_vcs_bg $color_vcs_text set -g __fish_git_prompt_color_bare -b $color_vcs_bg $nightfox_magenta --bold set -g __fish_git_prompt_color_merging -b $color_vcs_bg $nightfox_red --bold set -g __fish_git_prompt_color_cleanstate -b $color_vcs_bg $color_vcs_text --bold set -g __fish_git_prompt_color_dirtystate -b $color_vcs_bg $nightfox_blue --bold set -g __fish_git_prompt_color_invalidstate -b $color_vcs_bg $nightfox_red --bold set -g __fish_git_prompt_color_stagedstate -b $color_vcs_bg $nightfox_green --bold set -g __fish_git_prompt_color_stashstate -b $color_vcs_bg $nightfox_orange --bold set -g __fish_git_prompt_color_untrackedfiles -b $color_vcs_bg $nightfox_blue --bold set -g __fish_git_prompt_color_upstream -b $color_vcs_bg $color_vcs_text --bold set -g __fish_git_prompt_color_prefix_done $normal set -g __fish_git_prompt_color_bare_done $normal set -g __fish_git_prompt_color_merging_done $normal set -g __fish_git_prompt_color_cleanstate_done $normal set -g __fish_git_prompt_color_dirtystate_done $normal set -g __fish_git_prompt_color_invalidstate_done $normal set -g __fish_git_prompt_color_stagedstate_done $normal set -g __fish_git_prompt_color_stashstate_done $normal set -g __fish_git_prompt_color_untrackedfiles_done $normal set -g __fish_git_prompt_color_upstream_done $normal # We don't want the leading space. set -f vcs (fish_vcs_prompt '%s' 2>/dev/null) # Since we display the prompt on a new line allow the directory names to be longer. set -q fish_prompt_pwd_dir_length or set -lx fish_prompt_pwd_dir_length 0 # Color the prompt differently when we're root set -f suffix $char_user_cwd if functions -q fish_is_root_user; and fish_is_root_user if set -q fish_color_cwd_root set -f color_cwd $fish_color_cwd_root end set -f suffix $char_root_cwd end # Color the prompt in red on error if test $last_status -ne 0 set -f color_status $nightfox_red set -f prompt_status "[" $last_status "]" end set -f string_env "" set -f string_venv "" set -f string_rbenv "" set -f string_nvm (nvm current 2>/dev/null) if command -q rbenv set -f string_rbenv (rbenv local 2>/dev/null) if not test -n string_rbenv set -f string_rbenv (rbenv global 2>/dev/null) end if test {"$string_rbenv"} = "system" set -f string_rbenv "" end end if test {"$string_nvm"} = "system" set -f string_nvm "" end set -q VIRTUAL_ENV_DISABLE_PROMPT or set -g VIRTUAL_ENV_DISABLE_PROMPT true set -q VIRTUAL_ENV and set -f string_venv (string replace -r '.*/' '' -- "$VIRTUAL_ENV") if test -n {"$string_rbenv"} || test -n {"$string_nvm"} || test -n {"$string_venv"} set -f string_env " $string_nvm| $string_rbenv| $string_venv" end # Do nothing if not in vi mode if test "$fish_key_bindings" = fish_vi_key_bindings or test "$fish_key_bindings" = fish_hybrid_key_bindings switch $fish_bind_mode case default set -f color_bind $nightfox_red set -f char_bind 'N' case insert set -f color_bind $nightfox_yellow set -f char_bind 'I' case replace_one set -f color_bind $nightfox_cyan set -f char_bind 'r' case replace set -f color_bind $nightfox_blue set -f char_bind 'R' case visual set -f color_bind $nightfox_magenta set -f char_bind 'V' end end echo -n -s (prompt_login) echo -n -s (set_color -b $color_venv $color_text) $string_env echo -n -s (set_color -b $color_status $color_venv) '' echo -n -s (set_color -b $color_status $color_text) $prompt_status echo -n -s (set_color -b normal $color_status) '' echo $normal echo -n -s (set_color -b $color_cwd $color_text) (prompt_pwd) echo -n -s (set_color -b $color_vcs_bg $color_cwd) '' echo -n -s (set_color -b $color_vcs_bg $color_vcs_text) (fish_vcs_prompt) echo -n -s (set_color -b normal $color_vcs_bg) '' $normal echo -s $normal echo -n -s (set_color --bold -b $color_bind $color_text) $char_bind echo -n -s (set_color -b $color_cwd $color_bind) '' echo -n -s (set_color -b $color_cwd $color_text) $suffix echo -n -s (set_color -b normal $color_cwd) ' ' $normal end function fish_right_prompt -d "Right prompt" end