fish: switched to taktoa theme
This commit is contained in:
parent
ff9a01ddc6
commit
2804aed8f4
2 changed files with 79 additions and 105 deletions
|
@ -1,16 +1,81 @@
|
|||
function fish_prompt --description 'Write out the prompt'
|
||||
# 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 -s)
|
||||
end
|
||||
# name: taktoa
|
||||
# by taktoa (Remy Goldschmidt) <taktoa@gmail.com>
|
||||
# License: public domain
|
||||
|
||||
if not set -q __fish_prompt_normal
|
||||
set -g __fish_prompt_normal (set_color normal)
|
||||
end
|
||||
|
||||
if not set -q __fish_prompt_cwd
|
||||
set -g __fish_prompt_cwd (set_color $fish_color_cwd)
|
||||
end
|
||||
|
||||
echo -n -s "$USER" @ "$__fish_prompt_hostname" ' ' "$__fish_prompt_cwd" (prompt_pwd) (__fish_vcs_prompt) "$__fish_prompt_normal" '> '
|
||||
function _git_branch_name
|
||||
echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
|
||||
end
|
||||
|
||||
function _git_status_symbol
|
||||
set -l git_status (git status --porcelain ^/dev/null)
|
||||
if test -n "$git_status"
|
||||
if git status --porcelain ^/dev/null | grep '^.[^ ]' >/dev/null
|
||||
echo '*' # dirty
|
||||
else
|
||||
echo '#' # all staged
|
||||
end
|
||||
else
|
||||
echo '' # clean
|
||||
end
|
||||
end
|
||||
|
||||
function _remote_hostname
|
||||
echo (whoami)
|
||||
if test -n "$SSH_CONNECTION"
|
||||
echo " (ssh)"
|
||||
end
|
||||
end
|
||||
|
||||
function _get_tmux_window
|
||||
tmux lsw | grep active | sed 's/\*.*$//g;s/: / /1' | awk '{ print $2 "-" $1 }' -
|
||||
end
|
||||
|
||||
function _get_screen_window
|
||||
set initial (screen -Q windows; screen -Q echo "")
|
||||
set middle (echo $initial | sed 's/ /\n/g' | grep '\*' | sed 's/\*\$ / /g')
|
||||
echo $middle | awk '{ print $2 "-" $1 }' -
|
||||
end
|
||||
|
||||
function _is_multiplexed
|
||||
set multiplexer ""
|
||||
if test -z $TMUX
|
||||
else
|
||||
set multiplexer "tmux"
|
||||
end
|
||||
if test -z $WINDOW
|
||||
else
|
||||
set multiplexer "screen"
|
||||
end
|
||||
echo $multiplexer
|
||||
end
|
||||
|
||||
function fish_prompt
|
||||
set -l cyan (set_color cyan)
|
||||
set -l brown (set_color brown)
|
||||
set -l normal (set_color normal)
|
||||
|
||||
set -l arrow "λ"
|
||||
set -l cwd (set_color $fish_color_cwd)(prompt_pwd)
|
||||
set -l git_status (_git_status_symbol)(_git_branch_name)
|
||||
|
||||
if test -n "$git_status"
|
||||
set git_status " $git_status"
|
||||
end
|
||||
|
||||
set multiplexer (_is_multiplexed)
|
||||
|
||||
switch $multiplexer
|
||||
case screen
|
||||
set pane (_get_screen_window)
|
||||
case tmux
|
||||
set pane (_get_tmux_window)
|
||||
end
|
||||
|
||||
if test -z $pane
|
||||
set window ""
|
||||
else
|
||||
set window " ($pane)"
|
||||
end
|
||||
|
||||
echo -n -s (_remote_hostname) ' ' $cwd $brown $window $cyan $git_status $normal ' ' $arrow ' '
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue