mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2024-11-23 09:27:25 +08:00
commit
403e5652b4
12
themes/fisk/README.md
Normal file
12
themes/fisk/README.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Fisk
|
||||
|
||||
![theme screenshot](https://cloud.githubusercontent.com/assets/20814/6209746/60949aa6-b5c9-11e4-8edc-5a8e370f4527.png)
|
||||
|
||||
A nice dark blue-green theme with support for:
|
||||
|
||||
- Last exit code
|
||||
- Current git HEAD
|
||||
- Current python virtualenv
|
||||
|
||||
By [joar](https://github.com/joar), thanks to
|
||||
[adisbladis](https://github.com/adisbladis) for the starting point.
|
5
themes/fisk/_fisk_concat.fish
Normal file
5
themes/fisk/_fisk_concat.fish
Normal file
|
@ -0,0 +1,5 @@
|
|||
function _fisk_concat
|
||||
for i in $argv
|
||||
echo -n $i;
|
||||
end
|
||||
end
|
56
themes/fisk/fish_prompt.fish
Normal file
56
themes/fisk/fish_prompt.fish
Normal file
|
@ -0,0 +1,56 @@
|
|||
function fish_prompt --description 'Write out the prompt'
|
||||
set last_ret $status
|
||||
|
||||
# Palette
|
||||
set -l base01 55f
|
||||
set -l base02 55a
|
||||
set -l base03 777
|
||||
|
||||
set -l c_error f77
|
||||
set -l c_success 7f7
|
||||
|
||||
set -l c_yellow ff5
|
||||
set -l c_magenta f0d
|
||||
|
||||
# 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_cwd
|
||||
set -g __fish_prompt_cwd (set_color $fish_color_cwd)
|
||||
end
|
||||
|
||||
if set -q VIRTUAL_ENV
|
||||
set venv (_fisk_concat " " (set_color $c_magenta) "(" (basename "$VIRTUAL_ENV") ")" (set_color normal))
|
||||
else
|
||||
set venv ""
|
||||
end
|
||||
|
||||
set ret_color $c_success
|
||||
|
||||
if test $last_ret -gt 0
|
||||
set ret_color $c_error
|
||||
end
|
||||
|
||||
set -l ret_part (_fisk_concat \
|
||||
(set_color $base03) '[' \
|
||||
(set_color $ret_color) $last_ret \
|
||||
(set_color $base03) ']' \
|
||||
)
|
||||
|
||||
set -l user_part (_fisk_concat \
|
||||
(set_color $base01) $USER \
|
||||
(set_color $base02) @ \
|
||||
(set_color $base01) $__fish_prompt_hostname \
|
||||
)
|
||||
|
||||
# Virtualenv, git, &c.
|
||||
set -l context_part (_fisk_concat \
|
||||
$__fish_prompt_cwd (prompt_pwd) $venv (set_color -o $c_yellow) (__fish_git_prompt) \
|
||||
)
|
||||
|
||||
set -l prompt_end (_fisk_concat (set_color $base01) '➞')
|
||||
|
||||
echo -n (_fisk_concat $ret_part " " $user_part " " $context_part " " $prompt_end (set_color normal) " ")
|
||||
end
|
Loading…
Reference in New Issue
Block a user