diff --git a/themes/fisk/README.md b/themes/fisk/README.md new file mode 100644 index 0000000000000000000000000000000000000000..96e31b805c2f1c7ed66b273e9dee606bd2d5de64 --- /dev/null +++ b/themes/fisk/README.md @@ -0,0 +1,12 @@ +# Fisk + + + +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. diff --git a/themes/fisk/_fisk_concat.fish b/themes/fisk/_fisk_concat.fish new file mode 100644 index 0000000000000000000000000000000000000000..29f335427900a604736caf47d6609264bcc478f5 --- /dev/null +++ b/themes/fisk/_fisk_concat.fish @@ -0,0 +1,5 @@ +function _fisk_concat + for i in $argv + echo -n $i; + end +end diff --git a/themes/fisk/fish_prompt.fish b/themes/fisk/fish_prompt.fish new file mode 100644 index 0000000000000000000000000000000000000000..cb0949f01433b545e98df3c592f1f294d9ea8959 --- /dev/null +++ b/themes/fisk/fish_prompt.fish @@ -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