rc/config/fish/functions/fish_prompt.fish
2019-08-18 00:08:56 +00:00

48 lines
1.1 KiB
Fish

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
echo -n '<N>'
case insert
set_color --bold green
echo -n '<I>'
case replace_one
set_color --bold --background yellow black
echo -n '<R>'
case visual
set_color --bold --background magenta black
echo -n '<V>'
end
set_color normal
if not test $last_status -eq 0
set_color $fish_color_error
end
printf ' '
set_color normal
end