2015-08-26 21:28:16 +00:00
|
|
|
# name: ifij (forked from RobbyRussel)
|
2015-06-03 20:53:20 +00:00
|
|
|
|
2015-08-26 21:28:16 +00:00
|
|
|
function _status_color
|
|
|
|
# Returns a color for successful or failed previous command
|
2019-11-21 20:05:36 +00:00
|
|
|
if test $__prompt_last_status -eq 0
|
2015-08-26 21:28:16 +00:00
|
|
|
echo (set_color -o green)
|
|
|
|
else
|
|
|
|
echo (set_color -o red)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function _hostname
|
|
|
|
# Returns the hostname if not using tmux since tmux will display
|
|
|
|
if [ -z $TMUX ]
|
2015-08-26 21:31:05 +00:00
|
|
|
echo (hostname -s)" "
|
2015-08-26 21:28:16 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-06-03 20:53:20 +00:00
|
|
|
function _prompt_char
|
2015-08-26 21:28:16 +00:00
|
|
|
# Gives a colored prompt char for user or root
|
|
|
|
echo -n (_status_color)
|
2015-06-03 20:53:20 +00:00
|
|
|
if [ (whoami) = 'root' ]
|
2015-08-26 21:28:16 +00:00
|
|
|
echo -n '#'
|
2015-06-03 20:53:20 +00:00
|
|
|
else
|
2015-08-26 21:28:16 +00:00
|
|
|
echo -n '$'
|
2015-06-03 20:53:20 +00:00
|
|
|
end
|
2015-08-26 21:28:16 +00:00
|
|
|
echo -n (set_color normal)
|
2015-06-03 20:53:20 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function fish_prompt
|
2015-08-26 21:28:16 +00:00
|
|
|
# Build full left side prompt
|
|
|
|
|
2019-11-21 20:05:36 +00:00
|
|
|
# Collect last status for coloring prompt
|
|
|
|
set -g __prompt_last_status $status
|
2015-06-03 20:53:20 +00:00
|
|
|
|
2019-11-21 20:05:36 +00:00
|
|
|
# Configure git prompt
|
|
|
|
set -g __fish_git_prompt_showcolorhints 1
|
|
|
|
set -g __fish_git_prompt_showdirtystate 1
|
|
|
|
set -g __fish_git_prompt_showstashstate 1
|
|
|
|
set -g __fish_git_prompt_showuntrackedfiles 1
|
|
|
|
echo -n -s $arrow (_hostname) (prompt_pwd) (__fish_git_prompt) (_prompt_char) ' '
|
2015-06-03 20:53:20 +00:00
|
|
|
end
|