Commit 3c152395 authored by James Hillyerd's avatar James Hillyerd Committed by Bruno Pinto

Make more fish like

- Cache hostname & prompt char
- Use > instead of %
parent ad626cb7
## yimmy
## yimmy theme
A simple two-line theme best displayed on a terminal configured with Solarized
Dark colors.
user@host ~/c/w/dir (branch *)
%
>
Characteristics:
- Standard fish prompt characters: > for user, # for root
- Uses the fish prompt_pwd, so paths will be abbreviated
- Uses built-in __fish_git_prompt functionality
- Indicates Git work-in-progress (gwip/gunwip) if detected
- Tradition bourne prompt characters: $ for user, # for root
- Prompt character is colored red if previous command had a non-zero exit
status
......@@ -2,6 +2,19 @@ function fish_prompt
# Cache exit status
set -l last_status $status
# Just calculate these once, to save a few cycles when displaying the prompt
if not set -q __fish_prompt_hostname
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
end
if not set -q __fish_prompt_char
switch (id -u)
case 0
set -g __fish_prompt_char '#'
case '*'
set -g __fish_prompt_char '>'
end
end
# Setup colors
set -l normal (set_color normal)
set -l red (set_color red)
......@@ -23,14 +36,8 @@ function fish_prompt
set pcolor $red
end
# Traditional prompt chars
set -l pchar '$'
if test (id -u) = '0'
set pchar = '#'
end
# Line 1
echo -n $red'┌'$cyan$USER$white'@'$cyan(hostname -s)' '$gray(prompt_pwd)$normal
echo -n $red'┌'$cyan$USER$white'@'$cyan$__fish_prompt_hostname $gray(prompt_pwd)$normal
__fish_git_prompt
# Check for gwip; does last commit log contain --wip--?
if begin git log -n 1 ^/dev/null | grep -qc "\-\-wip\-\-"; end
......@@ -39,5 +46,5 @@ function fish_prompt
echo
# Line 2
echo -n $red'└'$pcolor$pchar' '$normal
echo -n $red'└'$pcolor$__fish_prompt_char $normal
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment