Skip to content

Instantly share code, notes, and snippets.

@jeiea
Created November 16, 2014 12:59
Show Gist options
  • Save jeiea/bccdae5f1dc294c0fd2e to your computer and use it in GitHub Desktop.
Save jeiea/bccdae5f1dc294c0fd2e to your computer and use it in GitHub Desktop.
set -g cmd_cnt 1
if [ $USER -eq root ]
set -g shell_char \#
else
set -g shell_char \$
end
bind \n __prompt_pre_exec
function __prompt_pre_exec -d ''
test -n (commandline); and set cmd_cnt (math $cmd_cnt + 1)
commandline -f execute
end
function __hist_counter_cancel -e fish_command_not_found -d 'Ignore failed command.'
set cmd_cnt (math $cmd_cnt - 1)
end
#function
function fish_prompt -d 'Prompt function.'
set result $status
echo -n \[
echo -n (set_color 3FF)$cmd_cnt(set_color normal)@
echo -n (set_color FF3)(prompt_pwd)(set_color normal)\]
if [ $result -eq 0 ]
set_color 3F3
else
set_color F33
end
echo -n $shell_char\ (set_color normal)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment