Add fish config
This commit is contained in:
parent
c4af1c28aa
commit
f1d4f3fd36
16 changed files with 215 additions and 0 deletions
28
config/fish/functions/fish_prompt.fish
Normal file
28
config/fish/functions/fish_prompt.fish
Normal file
|
@ -0,0 +1,28 @@
|
|||
function fish_prompt --description 'Write out the prompt'
|
||||
set -l color_cwd
|
||||
set -l suffix
|
||||
switch "$USER"
|
||||
case root toor
|
||||
if set -q fish_color_cwd_root
|
||||
set color_cwd $fish_color_cwd_root
|
||||
else
|
||||
set color_cwd $fish_color_cwd
|
||||
end
|
||||
set suffix '#'
|
||||
case '*'
|
||||
set color_cwd $fish_color_cwd
|
||||
set suffix '$'
|
||||
end
|
||||
|
||||
set -l branch (git symbolic-ref HEAD 2>/dev/null)
|
||||
set branch (string replace -r "^refs/heads/" "" $branch)
|
||||
set -l vcs
|
||||
if test -n "$branch" -a "$branch" != "master"
|
||||
set vcs "($branch)"
|
||||
end
|
||||
|
||||
echo -n -s (set_color $fish_color_host) (prompt_hostname) ':' \
|
||||
(set_color $color_cwd) (prompt_pwd) \
|
||||
(set_color $fish_color_vcs) "$vcs" \
|
||||
(set_color $fish_color_suffix) "$suffix "
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue