rc/config/fish/functions/fish_prompt.fish

48 lines
1.1 KiB
Fish
Raw Permalink Normal View History

2019-02-25 03:21:07 +00:00
set -g fish_color_user cyan
set -g fish_color_host green
set -g fish_color_cwd yellow
set -g fish_prompt_pwd_dir_length 0
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
set -l rst (set_color normal)
# User
set -l user (set_color --bold $fish_color_user)(whoami)$rst
# Host
set -l host (set_color --bold $fish_color_host)(prompt_hostname)$rst
# PWD
set -l ppwd (set_color $fish_color_cwd)(prompt_pwd)$rst
# Git
set -l pgit (__plaid_git_prompt)
# __fish_hg_prompt
printf '%s@%s:%s %s\n' $user $host $ppwd $pgit
switch $fish_bind_mode
case default
set_color --bold --background red black
2019-08-18 00:08:56 +00:00
echo -n '<N>'
2019-02-25 03:21:07 +00:00
case insert
set_color --bold green
2019-08-18 00:08:56 +00:00
echo -n '<I>'
2019-02-25 03:21:07 +00:00
case replace_one
set_color --bold --background yellow black
2019-08-18 00:08:56 +00:00
echo -n '<R>'
2019-02-25 03:21:07 +00:00
case visual
set_color --bold --background magenta black
2019-08-18 00:08:56 +00:00
echo -n '<V>'
2019-02-25 03:21:07 +00:00
end
set_color normal
if not test $last_status -eq 0
set_color $fish_color_error
end
printf ' '
set_color normal
end