From d200937d0656128d59e7fda5a1ac514848072bd0 Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Sat, 26 Jul 2014 08:09:31 +0200 Subject: [PATCH 01/20] New theme: budspencer --- themes/budspencer/README.md | 41 ++++++ themes/budspencer/fish_prompt.fish | 165 +++++++++++++++++++++++ themes/budspencer/fish_right_prompt.fish | 159 ++++++++++++++++++++++ 3 files changed, 365 insertions(+) create mode 100644 themes/budspencer/README.md create mode 100644 themes/budspencer/fish_prompt.fish create mode 100644 themes/budspencer/fish_right_prompt.fish diff --git a/themes/budspencer/README.md b/themes/budspencer/README.md new file mode 100644 index 0000000..e24a3d9 --- /dev/null +++ b/themes/budspencer/README.md @@ -0,0 +1,41 @@ +# budspencer theme + +Translation of zsh's prezto [budspencer theme][budspencer] + +## Left prompt segments + +- Vi mode indicator +- Git repository information +- Status symbols + * V: vi is parent process + * R: [ranger][ranger] is parent process + * ⚙: there are background jobs + * : no write permissions in present working directory + * ✔: last command succeeded + * ✘: last command failed + * ⚡: superuser indicator + +## Right prompt segments +- Git status symbols + * ↑: git repository is ahead origin + * ↓: git repository is behind origin + * +: new files added + * –: files deleted + * ✱: files have changed + * ●: uncommited changes + * ✭: commits stashed +- Present working directory + * style can be toggled in NORMAL mode with space bar + * styles implemented: + - `short` (show truncated path) + - `long` (show full path) + - `none` (show nothing) + * configurable by global array `$PWDSTYLE` (defaults to `short long none`) + +### TODO: +- elapsed time indicator +- host/username indicator for ssh connections +- vi REPLACE mode + +[budspencer]: https://github.com/tannhuber/prezto +[ranger]: http://ranger.nongnu.org/ diff --git a/themes/budspencer/fish_prompt.fish b/themes/budspencer/fish_prompt.fish new file mode 100644 index 0000000..30b5e76 --- /dev/null +++ b/themes/budspencer/fish_prompt.fish @@ -0,0 +1,165 @@ +# TODO: color definitions +# name: budspencer + +# ---------------------------------------------------------------------------- +# Utils +# ---------------------------------------------------------------------------- + +set -g __budspencer_display_rprompt 1 + +function __budspencer_git_branch_name -d "Return the current branch name" + echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') +end + +function fish_vi_prompt_cm --description "Displays the current mode" + switch $fish_bind_mode + case default + set_color -b blue 000 + echo -n " NORMAL " + set_color -b 000 blue + case insert + set_color -b yellow 000 + echo -n " INSERT " + set_color -b 000 yellow + case visual + set_color -b magenta 000 + echo -n " VISUAL " + set_color -b 000 magenta + end +end + +function fish_prompt_symbols --description "Display symbols" + set_color -o -b 073642 + echo -n "" + # indicator for vim parent process + if set -q -x VIM + set_color 6c71c4 + echo -n " V" + end + # indicator for ranger parent process + if set -q -x RANGER_LEVEL + set_color 6c71c4 + echo -n " R" + end + # background job indicator + if [ (jobs | wc -l) -gt 0 ] + set_color 6c71c4 + echo -n " ⚙" + end + # write protection indicator + if [ ! -w . ] + set_color cb4b16 + echo -n " " + end + # status indicator + if [ $last_status -eq 0 ] + set_color green + echo -n " ✔" + else + set_color red + echo -n " ✘" + end + # superuser indicator + if [ $USER = "root" ] + set_color cb4b16 + echo -n " ⚡" + end + echo -n " " + set_color -b normal 073642 +end +# ---------------------------------------------------------------------------- +# Prompts +# ---------------------------------------------------------------------------- + +function fish_prompt -d "Write out the left prompt of the budspencer theme" + set -g last_status $status + set -l basedir_name (basename (prompt_pwd)) + + # Init colors + + set -l fcol_black (set_color 000000) + set -l fcol_base03 (set_color 002b36) + set -l fcol_base02 (set_color 073642) + set -l fcol_base01 (set_color 586e75) + set -l fcol_base00 (set_color 657b83) + set -l fcol_base0 (set_color 839496) + set -l fcol_base1 (set_color 93a1a1) + set -l fcol_base2 (set_color eee8d5) + set -l fcol_base3 (set_color fdf6e3) + set -l fcol_yellow (set_color b58900) + set -l fcol_orange (set_color cb4b16) + set -l fcol_red (set_color red) + set -l fcol_magenta (set_color d33682) + set -l fcol_violet (set_color 6c71c4) + set -l fcol_blue (set_color 268bd2) + set -l fcol_cyan (set_color 2aa198) + set -l fcol_green (set_color 859900) + set -l bcol_base03 (set_color -b 002b36) + set -l bcol_base02 (set_color -b 073642) + set -l bcol_base01 (set_color -b 586e75) + set -l bcol_base00 (set_color -b 657b83) + set -l bcol_base0 (set_color -b 839496) + set -l bcol_base1 (set_color -b 93a1a1) + set -l bcol_base2 (set_color -b eee8d5) + set -l bcol_base3 (set_color -b fdf6e3) + set -l bcol_yellow (set_color -b b58900) + set -l bcol_orange (set_color -b cb4b16) + set -l bcol_red (set_color -b red) + set -l bcol_magenta (set_color -b d33682) + set -l bcol_violet (set_color -b 6c71c4) + set -l bcol_blue (set_color -b 268bd2) + set -l bcol_cyan (set_color -b 2aa198) + set -l bcol_green (set_color -b 859900) + + # Segments + + # vi mode + # If vi_mode plugin or native vi mode is activated then print the vi mode + # in the prompt. + set -l ps_vi "" +# if test -n "$vi_mode" +# set ps_vi $colnormal"["$vi_mode$colnormal"]" +# end + if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings" + set ps_vi (fish_vi_prompt_cm) + end + + # git + # If inside a git repo then the pwd segment is replaced by the git + # segment. + # The git segment format is X:YI@Z:P(N) where: + # X is git + # Y is the current branch + # I is the information about the current repo state + # Z is the name of the repo + # P is the current working path basename (name of the current directory) + # C is the depth of the path starting from base directory of the repo + # The displayed information is: + # Dirtiness is indicated by a little dot after the branch name. + # Unpushed commits are indicated with up arrows + # The number of unpushed commits is indicated right after the up arrows + # If P = Z then P(C) is not displayed + set -l ps_git "" + set -l git_branch_name (__budspencer_git_branch_name) + if test -n "$git_branch_name" +# set -l git_repo_name (__budspencer_git_repo_name) +# if test -n (__budspencer_is_git_dirty) +# set git_info $git_info$colbred"·" +# end + set ps_git $bcol_base01 "" $fcol_black "  "$git_branch_name" " $fcol_base01 #"@"$colbred$git_repo_name +# if test "$basedir_name" != "$git_repo_name" +# set -l basedir_depth (echo (__budspencer_git_repo_base) | sed "s/\// /g" | wc -w) +# set -l depth (echo (pwd) | sed "s/\// /g" | wc -w) +# set depth (math $depth - $basedir_depth) +# set ps_git $ps_git$colbwhite":"$colbgreen$basedir_name$colnormal"("$depth")" +# end + end + + set -l ps_symbols (fish_prompt_symbols) + + # Left Prompt + + echo -n -s $ps_vi $ps_git $ps_symbols '' ' ' +end + + diff --git a/themes/budspencer/fish_right_prompt.fish b/themes/budspencer/fish_right_prompt.fish new file mode 100644 index 0000000..8aaebc8 --- /dev/null +++ b/themes/budspencer/fish_right_prompt.fish @@ -0,0 +1,159 @@ +# TODO: color definitions +# TODO: elapsed time segment +# TODO: configurable pwd_style + +function __budspencer_is_git_ahead -d "Check if there are unpushed commits" + echo (command git status -s -b ^/dev/null | grep ahead) +end + +function __budspencer_is_git_behind -d "Check if there are unpushed commits" + echo (command git status -s -b ^/dev/null | grep behind) +end + +function __budspencer_is_git_added -d "Check if there are added files" + echo (command git status -s -b ^/dev/null | grep "^A") +end + +function __budspencer_is_git_deleted -d "Check if there are deleted files" + echo (command git status -s -b ^/dev/null | grep "^.D") +end + +function __budspencer_is_git_changed -d "Check if there are changed files" + echo (command git status -s -b ^/dev/null | grep "^.M") +end + +function __budspencer_is_git_uncomitted -d "Check if there are uncommited changes" + echo (command git status -s -b ^/dev/null | grep "^??") +end + +function __budspencer_is_git_stashed -d "Check if there are stashed commits" + echo (command git stash list ^/dev/null) +end + +if set -q -x $PWDSTYLE + set -x PWDSTYLE short long none +end +set pwd_style $PWDSTYLE[1] +function fish_pwd_toggle_cm --description "Toggles style of pwd segment, press space bar in NORMAL mode" + for i in (seq 1 (count $PWDSTYLE)) + if test $PWDSTYLE[$i] = $pwd_style + set pwd_style $PWDSTYLE[(math $i%(count $PWDSTYLE)+1)] + commandline -f repaint + break + end + end +end +bind -M default ' ' fish_pwd_toggle_cm + +function fish_pwd_prompt_cm --description "Displays the present working directory" + switch $fish_bind_mode + case default + set_color blue + echo -n "" + set_color normal + set_color --background blue 000 + case insert + set_color yellow + echo -n "" + set_color normal + set_color --background yellow 000 + case visual + set_color magenta + echo -n "" + set_color normal + set_color --background magenta 000 + end + switch $pwd_style + case none + echo -n ' ' + case short + echo -n ' '(prompt_pwd)' ' + case long + echo -n ' '$PWD' ' # | sed "s|$HOME|~|" + end + set_color normal +end + +function fish_right_prompt -d "Write out the right prompt of the budspencer theme" + # Init colors + + set -l fcol_black (set_color 000000) + set -l fcol_base03 (set_color -o 002b36) + set -l fcol_base02 (set_color -o 073642) + set -l fcol_base01 (set_color -o 586e75) + set -l fcol_base00 (set_color -o 657b83) + set -l fcol_base0 (set_color -o 839496) + set -l fcol_base1 (set_color -o 93a1a1) + set -l fcol_base2 (set_color -o eee8d5) + set -l fcol_base3 (set_color -o fdf6e3) + set -l fcol_yellow (set_color -o b58900) + set -l fcol_orange (set_color -o cb4b16) + set -l fcol_red (set_color -o red) + set -l fcol_magenta (set_color -o d33682) + set -l fcol_violet (set_color -o 6c71c4) + set -l fcol_blue (set_color -o 268bd2) + set -l fcol_blue (set_color -o 268bd2) + set -l fcol_cyan (set_color -o 2aa198) + set -l fcol_green (set_color -o 859900) + set -l bcol_base03 (set_color -b 002b36) + set -l bcol_base02 (set_color -b 073642) + set -l bcol_base01 (set_color -b 586e75) + set -l bcol_base00 (set_color -b 657b83) + set -l bcol_base0 (set_color -b 839496) + set -l bcol_base1 (set_color -b 93a1a1) + set -l bcol_base2 (set_color -b eee8d5) + set -l bcol_base3 (set_color -b fdf6e3) + set -l bcol_yellow (set_color -b b58900) + set -l bcol_orange (set_color -b cb4b16) + set -l bcol_red (set_color -b dc322f) + set -l bcol_magenta (set_color -b d33682) + set -l bcol_violet (set_color -b 6c71c4) + set -l bcol_blue (set_color -b 268bd2) + set -l bcol_cyan (set_color -b 2aa198) + set -l bcol_green (set_color -b 859900) + + # Segments + + # git + set -l ps_git "" + if test -n (__budspencer_is_git_ahead) + set ps_git $fcol_yellow" ↑" + end + + if test -n (__budspencer_is_git_behind) + set ps_git $ps_git$fcol_yellow" ↓" + end + + if test -n (__budspencer_is_git_added) + set ps_git $ps_git$fcol_green" +" + end + + if test -n (__budspencer_is_git_deleted) + set ps_git $ps_git$fcol_red" –" + end + + if test -n (__budspencer_is_git_changed) + set ps_git $ps_git$fcol_blue" ✱" + end + + if test -n (__budspencer_is_git_uncomitted) + set ps_git $ps_git$fcol_base3" ●" + end + + if test -n (__budspencer_is_git_stashed) + set ps_git $ps_git$fcol_cyan" ✭" + end + + if test -n "$ps_git" + set ps_git $fcol_base02""$bcol_base02""$ps_git + end + + # pwd + set -l ps_pwd "" + if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings" + set ps_pwd (fish_pwd_prompt_cm) + end + + echo -n $ps_git $ps_pwd + set_color normal +end From 3567690ec356f6f92fadbd52166b7915dd756e0d Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Sat, 26 Jul 2014 08:29:01 +0200 Subject: [PATCH 02/20] README changed --- themes/budspencer/README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/themes/budspencer/README.md b/themes/budspencer/README.md index e24a3d9..90b32ab 100644 --- a/themes/budspencer/README.md +++ b/themes/budspencer/README.md @@ -30,12 +30,18 @@ Translation of zsh's prezto [budspencer theme][budspencer] - `short` (show truncated path) - `long` (show full path) - `none` (show nothing) - * configurable by global array `$PWDSTYLE` (defaults to `short long none`) + * configurable by global array `$PWDSTYLE` (if not set, defaults to `short long none`) + +## Screenshot + +![budspencer theme][screenshot] + +## TODO -### TODO: - elapsed time indicator - host/username indicator for ssh connections - vi REPLACE mode [budspencer]: https://github.com/tannhuber/prezto [ranger]: http://ranger.nongnu.org/ +[screenshot]: https://raw.githubusercontent.com/tannhuber/prezto/master/screenshots/budspencer.png From b14e71015143bfd35a4a9981f650437558f1cc5e Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Thu, 31 Jul 2014 10:31:47 +0200 Subject: [PATCH 03/20] Git right prompt implemented --- themes/budspencer/fish_right_prompt.fish | 98 +++++++++++++----------- 1 file changed, 55 insertions(+), 43 deletions(-) diff --git a/themes/budspencer/fish_right_prompt.fish b/themes/budspencer/fish_right_prompt.fish index 8aaebc8..65e095a 100644 --- a/themes/budspencer/fish_right_prompt.fish +++ b/themes/budspencer/fish_right_prompt.fish @@ -1,33 +1,31 @@ # TODO: color definitions # TODO: elapsed time segment -# TODO: configurable pwd_style -function __budspencer_is_git_ahead -d "Check if there are unpushed commits" - echo (command git status -s -b ^/dev/null | grep ahead) +function __budspencer_is_git_ahead_or_behind -d "Check if there are unpulled or unpushed commits" + echo (command git rev-list --count --left-right "HEAD...@{upstream}" ^/dev/null | sed 's/[[:space:]+]/\\x1e/g') end -function __budspencer_is_git_behind -d "Check if there are unpushed commits" - echo (command git status -s -b ^/dev/null | grep behind) -end - -function __budspencer_is_git_added -d "Check if there are added files" - echo (command git status -s -b ^/dev/null | grep "^A") -end - -function __budspencer_is_git_deleted -d "Check if there are deleted files" - echo (command git status -s -b ^/dev/null | grep "^.D") -end - -function __budspencer_is_git_changed -d "Check if there are changed files" - echo (command git status -s -b ^/dev/null | grep "^.M") -end - -function __budspencer_is_git_uncomitted -d "Check if there are uncommited changes" - echo (command git status -s -b ^/dev/null | grep "^??") +function __budspencer_git_status -d "Check git status" + set -l added 0 + set -l deleted 0 + set -l modified 0 + set -l renamed 0 + set -l unmerged 0 + set -l untracked 0 + set -l git_status (command git status --porcelain ^/dev/null) + for i in (seq 1 (count $git_status)) + echo $git_status[$i] | egrep "^[ACDMT][\ MT]\ |^[ACMT]D\ " > /dev/null; and set added (math $added+1) + echo $git_status[$i] | egrep "^[\ ACMRT]D\ " > /dev/null; and set deleted (math $deleted+1) + echo $git_status[$i] | egrep "^.[MT]\ " > /dev/null; and set modified (math $modified+1) + echo $git_status[$i] | egrep "^R.\ " > /dev/null; and set renamed (math $renamed+1) + echo $git_status[$i] | egrep "^AA\ |^DD\ |^U.\ |^.U\ " > /dev/null; and set unmerged (math $unmerged+1) + echo $git_status[$i] | egrep "^\?\?\ " > /dev/null; and set untracked (math $untracked+1) + end + printf '%s\x1e%s\x1e%s\x1e%s\x1e%s\x1e%s' $added $deleted $modified $renamed $unmerged $untracked end function __budspencer_is_git_stashed -d "Check if there are stashed commits" - echo (command git stash list ^/dev/null) + echo (command git stash list ^/dev/null | wc -l | awk '{print $1}') end if set -q -x $PWDSTYLE @@ -116,32 +114,46 @@ function fish_right_prompt -d "Write out the right prompt of the budspencer them # git set -l ps_git "" - if test -n (__budspencer_is_git_ahead) - set ps_git $fcol_yellow" ↑" - end - - if test -n (__budspencer_is_git_behind) - set ps_git $ps_git$fcol_yellow" ↓" - end + set -l is_repo (command git rev-parse --is-inside-work-tree ^/dev/null) + if test $is_repo="true" + set -l git_ahead_behind (__budspencer_is_git_ahead_or_behind) + if test $git_ahead_behind[1] -gt 0 + set ps_git $fcol_yellow" ↑" + end + + if test $git_ahead_behind[2] -gt 0 + set ps_git $ps_git$fcol_yellow" ↓" + end + + set -l git_status (__budspencer_git_status) + echo $git_status + if test $git_status[1] -gt 0 + set ps_git $ps_git$fcol_green" +" + end - if test -n (__budspencer_is_git_added) - set ps_git $ps_git$fcol_green" +" - end + if test $git_status[2] -gt 0 + set ps_git $ps_git$fcol_red" –" + end - if test -n (__budspencer_is_git_deleted) - set ps_git $ps_git$fcol_red" –" - end + if test $git_status[3] -gt 0 + set ps_git $ps_git$fcol_blue" ✱" + end - if test -n (__budspencer_is_git_changed) - set ps_git $ps_git$fcol_blue" ✱" - end + if test $git_status[4] -gt 0 + set ps_git $ps_git$fcol_blue" →" + end - if test -n (__budspencer_is_git_uncomitted) - set ps_git $ps_git$fcol_base3" ●" - end + if test $git_status[5] -gt 0 + set ps_git $ps_git$fcol_violet" ═" + end - if test -n (__budspencer_is_git_stashed) - set ps_git $ps_git$fcol_cyan" ✭" + if test $git_status[6] -gt 0 + set ps_git $ps_git$fcol_base3" ●" + end + + if test (__budspencer_is_git_stashed) -gt 0 + set ps_git $ps_git$fcol_cyan" ✭" + end end if test -n "$ps_git" From d7003d4ba1cd44d4eed6e7d96ea3a9d007d737e0 Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Thu, 31 Jul 2014 12:01:15 +0200 Subject: [PATCH 04/20] git symbols prompt improved --- themes/budspencer/fish_prompt.fish | 3 +- themes/budspencer/fish_right_prompt.fish | 215 ++++++++++++++--------- 2 files changed, 137 insertions(+), 81 deletions(-) diff --git a/themes/budspencer/fish_prompt.fish b/themes/budspencer/fish_prompt.fish index 30b5e76..2166b31 100644 --- a/themes/budspencer/fish_prompt.fish +++ b/themes/budspencer/fish_prompt.fish @@ -1,4 +1,5 @@ -# TODO: color definitions +# TODO: color definitions cleanup +# TODO: git improvements # name: budspencer # ---------------------------------------------------------------------------- diff --git a/themes/budspencer/fish_right_prompt.fish b/themes/budspencer/fish_right_prompt.fish index 65e095a..9776810 100644 --- a/themes/budspencer/fish_right_prompt.fish +++ b/themes/budspencer/fish_right_prompt.fish @@ -1,5 +1,43 @@ -# TODO: color definitions +# TODO: color definitions cleanup # TODO: elapsed time segment +# TODO: username/host segment for ssh connections + + # Init colors + + set fcol_black (set_color 000000) + set fcol_base03 (set_color -o 002b36) + set fcol_base02 (set_color -o 073642) + set fcol_base01 (set_color -o 586e75) + set fcol_base00 (set_color -o 657b83) + set fcol_base0 (set_color -o 839496) + set fcol_base1 (set_color -o 93a1a1) + set fcol_base2 (set_color -o eee8d5) + set fcol_base3 (set_color -o fdf6e3) + set fcol_yellow (set_color -o b58900) + set fcol_orange (set_color -o cb4b16) + set fcol_red (set_color -o red) + set fcol_magenta (set_color -o d33682) + set fcol_violet (set_color -o 6c71c4) + set fcol_blue (set_color -o 268bd2) + set fcol_blue (set_color -o 268bd2) + set fcol_cyan (set_color -o 2aa198) + set fcol_green (set_color -o 859900) + set bcol_base03 (set_color -b 002b36) + set bcol_base02 (set_color -b 073642) + set bcol_base01 (set_color -b 586e75) + set bcol_base00 (set_color -b 657b83) + set bcol_base0 (set_color -b 839496) + set bcol_base1 (set_color -b 93a1a1) + set bcol_base2 (set_color -b eee8d5) + set bcol_base3 (set_color -b fdf6e3) + set bcol_yellow (set_color -b b58900) + set bcol_orange (set_color -b cb4b16) + set bcol_red (set_color -b dc322f) + set bcol_magenta (set_color -b d33682) + set bcol_violet (set_color -b 6c71c4) + set bcol_blue (set_color -b 268bd2) + set bcol_cyan (set_color -b 2aa198) + set bcol_green (set_color -b 859900) function __budspencer_is_git_ahead_or_behind -d "Check if there are unpulled or unpushed commits" echo (command git rev-list --count --left-right "HEAD...@{upstream}" ^/dev/null | sed 's/[[:space:]+]/\\x1e/g') @@ -43,6 +81,17 @@ function fish_pwd_toggle_cm --description "Toggles style of pwd segment, press s end bind -M default ' ' fish_pwd_toggle_cm +set git_style "symbols" +function fish_git_toggle_cm --description "Toggles style of git segment, press G in NORMAL mode" + if test $git_style = "symbols" + set git_style "counts" + else + set git_style "symbols" + end + commandline -f repaint +end +bind -M default ',,' fish_git_toggle_cm + function fish_pwd_prompt_cm --description "Displays the present working directory" switch $fish_bind_mode case default @@ -72,90 +121,96 @@ function fish_pwd_prompt_cm --description "Displays the present working director set_color normal end -function fish_right_prompt -d "Write out the right prompt of the budspencer theme" - # Init colors +function fish_git_prompt_cm --description "Displays the git symbols" + set -l git_prompt "" + set -l is_repo (command git rev-parse --is-inside-work-tree ^/dev/null) + if test $is_repo="true" - set -l fcol_black (set_color 000000) - set -l fcol_base03 (set_color -o 002b36) - set -l fcol_base02 (set_color -o 073642) - set -l fcol_base01 (set_color -o 586e75) - set -l fcol_base00 (set_color -o 657b83) - set -l fcol_base0 (set_color -o 839496) - set -l fcol_base1 (set_color -o 93a1a1) - set -l fcol_base2 (set_color -o eee8d5) - set -l fcol_base3 (set_color -o fdf6e3) - set -l fcol_yellow (set_color -o b58900) - set -l fcol_orange (set_color -o cb4b16) - set -l fcol_red (set_color -o red) - set -l fcol_magenta (set_color -o d33682) - set -l fcol_violet (set_color -o 6c71c4) - set -l fcol_blue (set_color -o 268bd2) - set -l fcol_blue (set_color -o 268bd2) - set -l fcol_cyan (set_color -o 2aa198) - set -l fcol_green (set_color -o 859900) - set -l bcol_base03 (set_color -b 002b36) - set -l bcol_base02 (set_color -b 073642) - set -l bcol_base01 (set_color -b 586e75) - set -l bcol_base00 (set_color -b 657b83) - set -l bcol_base0 (set_color -b 839496) - set -l bcol_base1 (set_color -b 93a1a1) - set -l bcol_base2 (set_color -b eee8d5) - set -l bcol_base3 (set_color -b fdf6e3) - set -l bcol_yellow (set_color -b b58900) - set -l bcol_orange (set_color -b cb4b16) - set -l bcol_red (set_color -b dc322f) - set -l bcol_magenta (set_color -b d33682) - set -l bcol_violet (set_color -b 6c71c4) - set -l bcol_blue (set_color -b 268bd2) - set -l bcol_cyan (set_color -b 2aa198) - set -l bcol_green (set_color -b 859900) + set -l git_ahead_behind (__budspencer_is_git_ahead_or_behind) + if test $git_ahead_behind[1] -gt 0 + if test $git_style = "symbols" + set git_prompt $fcol_yellow" ↑" + else + set git_prompt $fcol_yellow" "$git_ahead_behind[1] + end + end + + if test $git_ahead_behind[2] -gt 0 + if test $git_style = "symbols" + set git_prompt $git_prompt$fcol_yellow" ↓" + else + set git_prompt $git_prompt$fcol_yellow" "$git_ahead_behind[2] + end + end + + set -l git_status (__budspencer_git_status) + if test $git_status[1] -gt 0 + if test $git_style = "symbols" + set git_prompt $git_prompt$fcol_green" +" + else + set git_prompt $git_prompt$fcol_green" "$git_status[1] + end + end + + if test $git_status[2] -gt 0 + if test $git_style = "symbols" + set git_prompt $git_prompt$fcol_red" –" + else + set git_prompt $git_prompt$fcol_red" "$git_status[2] + end + end + + if test $git_status[3] -gt 0 + if test $git_style = "symbols" + set git_prompt $git_prompt$fcol_blue" ✱" + else + set git_prompt $git_prompt$fcol_blue" "$git_status[3] + end + end + + if test $git_status[4] -gt 0 + if test $git_style = "symbols" + set git_prompt $git_prompt$fcol_magenta" →" + else + set git_prompt $git_prompt$fcol_magenta" "$git_status[4] + end + end + + if test $git_status[5] -gt 0 + if test $git_style = "symbols" + set git_prompt $git_prompt$fcol_violet" ═" + else + set git_prompt $git_prompt$fcol_violet" "$git_status[5] + end + end + + if test $git_status[6] -gt 0 + if test $git_style = "symbols" + set git_prompt $git_prompt$fcol_base3" ●" + else + set git_prompt $git_prompt$fcol_base3" "$git_status[6] + end + end + + set -l git_stashed (__budspencer_is_git_stashed) + if test git_stashed -gt 0 + if test $git_style = "symbols" + set git_prompt $git_prompt$fcol_cyan" ✭" + else + set git_prompt $git_prompt$fcol_cyan" "$git_stashed + end + end + echo $git_prompt + + end +end + +function fish_right_prompt -d "Write out the right prompt of the budspencer theme" # Segments # git - set -l ps_git "" - set -l is_repo (command git rev-parse --is-inside-work-tree ^/dev/null) - if test $is_repo="true" - set -l git_ahead_behind (__budspencer_is_git_ahead_or_behind) - if test $git_ahead_behind[1] -gt 0 - set ps_git $fcol_yellow" ↑" - end - - if test $git_ahead_behind[2] -gt 0 - set ps_git $ps_git$fcol_yellow" ↓" - end - - set -l git_status (__budspencer_git_status) - echo $git_status - if test $git_status[1] -gt 0 - set ps_git $ps_git$fcol_green" +" - end - - if test $git_status[2] -gt 0 - set ps_git $ps_git$fcol_red" –" - end - - if test $git_status[3] -gt 0 - set ps_git $ps_git$fcol_blue" ✱" - end - - if test $git_status[4] -gt 0 - set ps_git $ps_git$fcol_blue" →" - end - - if test $git_status[5] -gt 0 - set ps_git $ps_git$fcol_violet" ═" - end - - if test $git_status[6] -gt 0 - set ps_git $ps_git$fcol_base3" ●" - end - - if test (__budspencer_is_git_stashed) -gt 0 - set ps_git $ps_git$fcol_cyan" ✭" - end - end - + set ps_git (fish_git_prompt_cm) if test -n "$ps_git" set ps_git $fcol_base02""$bcol_base02""$ps_git end From 30b7118aebf38cee5bd53e9878de5eaa67bbaa2e Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Thu, 31 Jul 2014 12:13:21 +0200 Subject: [PATCH 05/20] README updated --- themes/budspencer/README.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/themes/budspencer/README.md b/themes/budspencer/README.md index 90b32ab..7128d29 100644 --- a/themes/budspencer/README.md +++ b/themes/budspencer/README.md @@ -16,14 +16,20 @@ Translation of zsh's prezto [budspencer theme][budspencer] * ⚡: superuser indicator ## Right prompt segments -- Git status symbols - * ↑: git repository is ahead origin - * ↓: git repository is behind origin - * +: new files added - * –: files deleted - * ✱: files have changed - * ●: uncommited changes - * ✭: commits stashed +- Git status + * style can be toggled in NORMAL mode with `,,` + - symbols + - amount of files that have been changed + * symbols: + - ↑: git repository is ahead origin + - ↓: git repository is behind origin + - +: new files were added + - –: files have been deleted + - ✱: files have been modified + - →: files have been renamed + - ═: there are unmerged commits + - ●: there are untracked files + - ✭: there are stashed commits - Present working directory * style can be toggled in NORMAL mode with space bar * styles implemented: From 4b8e90041a0b7a307361d357f0e1b670ad04ac7c Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Thu, 31 Jul 2014 12:37:35 +0200 Subject: [PATCH 06/20] Cleanup --- themes/budspencer/fish_prompt.fish | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/themes/budspencer/fish_prompt.fish b/themes/budspencer/fish_prompt.fish index 2166b31..c83c2f5 100644 --- a/themes/budspencer/fish_prompt.fish +++ b/themes/budspencer/fish_prompt.fish @@ -115,12 +115,7 @@ function fish_prompt -d "Write out the left prompt of the budspencer theme" # Segments # vi mode - # If vi_mode plugin or native vi mode is activated then print the vi mode - # in the prompt. set -l ps_vi "" -# if test -n "$vi_mode" -# set ps_vi $colnormal"["$vi_mode$colnormal"]" -# end if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings" set ps_vi (fish_vi_prompt_cm) end @@ -143,17 +138,7 @@ function fish_prompt -d "Write out the left prompt of the budspencer theme" set -l ps_git "" set -l git_branch_name (__budspencer_git_branch_name) if test -n "$git_branch_name" -# set -l git_repo_name (__budspencer_git_repo_name) -# if test -n (__budspencer_is_git_dirty) -# set git_info $git_info$colbred"·" -# end set ps_git $bcol_base01 "" $fcol_black "  "$git_branch_name" " $fcol_base01 #"@"$colbred$git_repo_name -# if test "$basedir_name" != "$git_repo_name" -# set -l basedir_depth (echo (__budspencer_git_repo_base) | sed "s/\// /g" | wc -w) -# set -l depth (echo (pwd) | sed "s/\// /g" | wc -w) -# set depth (math $depth - $basedir_depth) -# set ps_git $ps_git$colbwhite":"$colbgreen$basedir_name$colnormal"("$depth")" -# end end set -l ps_symbols (fish_prompt_symbols) From 3a1c422878d22eba0141fd0ff81cf48eed057150 Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Fri, 1 Aug 2014 18:38:10 +0200 Subject: [PATCH 07/20] Comments updated --- themes/budspencer/README.md | 6 +++--- themes/budspencer/fish_right_prompt.fish | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/budspencer/README.md b/themes/budspencer/README.md index 7128d29..840344c 100644 --- a/themes/budspencer/README.md +++ b/themes/budspencer/README.md @@ -17,9 +17,9 @@ Translation of zsh's prezto [budspencer theme][budspencer] ## Right prompt segments - Git status - * style can be toggled in NORMAL mode with `,,` - - symbols - - amount of files that have been changed + * style can be toggled in NORMAL mode with `,,` between + - `symbols` (shows git status symbols, see below) + - `counts` (shows amount of files that are affected) * symbols: - ↑: git repository is ahead origin - ↓: git repository is behind origin diff --git a/themes/budspencer/fish_right_prompt.fish b/themes/budspencer/fish_right_prompt.fish index 9776810..baffe54 100644 --- a/themes/budspencer/fish_right_prompt.fish +++ b/themes/budspencer/fish_right_prompt.fish @@ -82,7 +82,7 @@ end bind -M default ' ' fish_pwd_toggle_cm set git_style "symbols" -function fish_git_toggle_cm --description "Toggles style of git segment, press G in NORMAL mode" +function fish_git_toggle_cm --description "Toggles style of git segment, press ,, in NORMAL mode" if test $git_style = "symbols" set git_style "counts" else From 83503f5fe28ab735f3d09debd3b49d4c4df15a3a Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Sun, 3 Aug 2014 00:35:24 +0200 Subject: [PATCH 08/20] Added command duration segment and username/hostname for ssh connections --- themes/budspencer/README.md | 4 +- themes/budspencer/fish_right_prompt.fish | 101 ++++++++++++++--------- 2 files changed, 62 insertions(+), 43 deletions(-) diff --git a/themes/budspencer/README.md b/themes/budspencer/README.md index 840344c..41c67d9 100644 --- a/themes/budspencer/README.md +++ b/themes/budspencer/README.md @@ -16,6 +16,8 @@ Translation of zsh's prezto [budspencer theme][budspencer] * ⚡: superuser indicator ## Right prompt segments + +- Last command's duration time - Git status * style can be toggled in NORMAL mode with `,,` between - `symbols` (shows git status symbols, see below) @@ -44,8 +46,6 @@ Translation of zsh's prezto [budspencer theme][budspencer] ## TODO -- elapsed time indicator -- host/username indicator for ssh connections - vi REPLACE mode [budspencer]: https://github.com/tannhuber/prezto diff --git a/themes/budspencer/fish_right_prompt.fish b/themes/budspencer/fish_right_prompt.fish index baffe54..654c4d5 100644 --- a/themes/budspencer/fish_right_prompt.fish +++ b/themes/budspencer/fish_right_prompt.fish @@ -1,6 +1,4 @@ # TODO: color definitions cleanup -# TODO: elapsed time segment -# TODO: username/host segment for ssh connections # Init colors @@ -66,6 +64,17 @@ function __budspencer_is_git_stashed -d "Check if there are stashed commits" echo (command git stash list ^/dev/null | wc -l | awk '{print $1}') end +set git_style "symbols" +function fish_git_toggle_cm --description "Toggles style of git segment, press ,, in NORMAL mode" + if test $git_style = "symbols" + set git_style "counts" + else + set git_style "symbols" + end + commandline -f repaint +end +bind -M default ',,' fish_git_toggle_cm + if set -q -x $PWDSTYLE set -x PWDSTYLE short long none end @@ -81,44 +90,15 @@ function fish_pwd_toggle_cm --description "Toggles style of pwd segment, press s end bind -M default ' ' fish_pwd_toggle_cm -set git_style "symbols" -function fish_git_toggle_cm --description "Toggles style of git segment, press ,, in NORMAL mode" - if test $git_style = "symbols" - set git_style "counts" - else - set git_style "symbols" +function fish_cmd_duration_cm -d "Displays the elapsed time of last command" + if test (count $CMD_DURATION) -gt 0 + set -l duration (echo $CMD_DURATION | tr -d '[[:space:]]' | sed 's|\.[[:digit:]]*||') + if test $last_status -ne 0 + echo -n $fcol_base02""$bcol_base02$fcol_red" "$duration + else + echo -n $fcol_base02""$bcol_base02$fcol_green" "$duration + end end - commandline -f repaint -end -bind -M default ',,' fish_git_toggle_cm - -function fish_pwd_prompt_cm --description "Displays the present working directory" - switch $fish_bind_mode - case default - set_color blue - echo -n "" - set_color normal - set_color --background blue 000 - case insert - set_color yellow - echo -n "" - set_color normal - set_color --background yellow 000 - case visual - set_color magenta - echo -n "" - set_color normal - set_color --background magenta 000 - end - switch $pwd_style - case none - echo -n ' ' - case short - echo -n ' '(prompt_pwd)' ' - case long - echo -n ' '$PWD' ' # | sed "s|$HOME|~|" - end - set_color normal end function fish_git_prompt_cm --description "Displays the git symbols" @@ -205,14 +185,53 @@ function fish_git_prompt_cm --description "Displays the git symbols" end end +function fish_pwd_prompt_cm --description "Displays the present working directory" + set -l user_host " " + if test (count $SSH_CLIENT) -gt 0 + set user_host " "$USER"@"(hostname) + if test $pwd_style != "none" + set user_host $user_host":" + end + end + switch $fish_bind_mode + case default + set_color blue + echo -n "" + set_color normal + set_color --background blue 000 + case insert + set_color yellow + echo -n "" + set_color normal + set_color --background yellow 000 + case visual + set_color magenta + echo -n "" + set_color normal + set_color --background magenta 000 + end + switch $pwd_style + case none + echo -n $user_host' ' + case short + echo -n $user_host(prompt_pwd)' ' + case long + echo -n $user_host$PWD' ' # | sed "s|$HOME|~|" + end + set_color normal +end + function fish_right_prompt -d "Write out the right prompt of the budspencer theme" # Segments + # command duration + set ps_duration (fish_cmd_duration_cm) + # git set ps_git (fish_git_prompt_cm) if test -n "$ps_git" - set ps_git $fcol_base02""$bcol_base02""$ps_git + set ps_git $fcol_base01""$bcol_base01""$ps_git end # pwd @@ -221,6 +240,6 @@ function fish_right_prompt -d "Write out the right prompt of the budspencer them set ps_pwd (fish_pwd_prompt_cm) end - echo -n $ps_git $ps_pwd + echo -n $ps_duration $ps_git $ps_pwd set_color normal end From 913ae62b6fe745c9a61351503d7d9393bdc7df15 Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Sun, 3 Aug 2014 12:18:10 +0200 Subject: [PATCH 09/20] Proper color definitions --- themes/budspencer/fish_prompt.fish | 114 +++++++---------------- themes/budspencer/fish_right_prompt.fish | 109 +++++++--------------- 2 files changed, 69 insertions(+), 154 deletions(-) diff --git a/themes/budspencer/fish_prompt.fish b/themes/budspencer/fish_prompt.fish index c83c2f5..14a1063 100644 --- a/themes/budspencer/fish_prompt.fish +++ b/themes/budspencer/fish_prompt.fish @@ -1,10 +1,14 @@ -# TODO: color definitions cleanup # TODO: git improvements # name: budspencer -# ---------------------------------------------------------------------------- +############################################################################### +# Color definitions +############################################################################### + set -g budspencer_colors 000000 002b36 083743 445659 657b83 839496 93a1a1 eee8d5 fdf6e3 b58900 cb4b16 dc121f d33682 6c71c4 268bd2 2aa198 859900 + +############################################################################### # Utils -# ---------------------------------------------------------------------------- +############################################################################### set -g __budspencer_display_rprompt 1 @@ -15,130 +19,80 @@ end function fish_vi_prompt_cm --description "Displays the current mode" switch $fish_bind_mode case default - set_color -b blue 000 - echo -n " NORMAL " - set_color -b 000 blue + set_color -b $budspencer_colors[15] $budspencer_colors[1] + echo -n " NORMAL " + set_color -b $budspencer_colors[1] $budspencer_colors[15] case insert - set_color -b yellow 000 + set_color -b $budspencer_colors[10] $budspencer_colors[1] echo -n " INSERT " - set_color -b 000 yellow + set_color -b $budspencer_colors[1] $budspencer_colors[10] case visual - set_color -b magenta 000 + set_color -b $budspencer_colors[13] $budspencer_colors[1] echo -n " VISUAL " - set_color -b 000 magenta + set_color -b $budspencer_colors[1] $budspencer_colors[13] end end function fish_prompt_symbols --description "Display symbols" - set_color -o -b 073642 - echo -n "" + set_color -o -b $budspencer_colors[3] + echo -n "" # indicator for vim parent process if set -q -x VIM - set_color 6c71c4 - echo -n " V" + set_color $budspencer_colors[14] + echo -n " V" end # indicator for ranger parent process if set -q -x RANGER_LEVEL - set_color 6c71c4 - echo -n " R" + set_color $budspencer_colors[14] + echo -n " R" end # background job indicator if [ (jobs | wc -l) -gt 0 ] - set_color 6c71c4 - echo -n " ⚙" + set_color $budspencer_colors[16] + echo -n " ⚙" end # write protection indicator if [ ! -w . ] - set_color cb4b16 - echo -n " " + set_color $budspencer_colors[11] + echo -n " " end # status indicator if [ $last_status -eq 0 ] - set_color green + set_color $budspencer_colors[17] echo -n " ✔" else - set_color red + set_color $budspencer_colors[12] echo -n " ✘" end # superuser indicator if [ $USER = "root" ] - set_color cb4b16 - echo -n " ⚡" + set_color $budspencer_colors[11] + echo -n " ⚡" end echo -n " " - set_color -b normal 073642 + set_color -b normal $budspencer_colors[3] end -# ---------------------------------------------------------------------------- +############################################################################### # Prompts -# ---------------------------------------------------------------------------- +############################################################################### function fish_prompt -d "Write out the left prompt of the budspencer theme" set -g last_status $status set -l basedir_name (basename (prompt_pwd)) - # Init colors - - set -l fcol_black (set_color 000000) - set -l fcol_base03 (set_color 002b36) - set -l fcol_base02 (set_color 073642) - set -l fcol_base01 (set_color 586e75) - set -l fcol_base00 (set_color 657b83) - set -l fcol_base0 (set_color 839496) - set -l fcol_base1 (set_color 93a1a1) - set -l fcol_base2 (set_color eee8d5) - set -l fcol_base3 (set_color fdf6e3) - set -l fcol_yellow (set_color b58900) - set -l fcol_orange (set_color cb4b16) - set -l fcol_red (set_color red) - set -l fcol_magenta (set_color d33682) - set -l fcol_violet (set_color 6c71c4) - set -l fcol_blue (set_color 268bd2) - set -l fcol_cyan (set_color 2aa198) - set -l fcol_green (set_color 859900) - set -l bcol_base03 (set_color -b 002b36) - set -l bcol_base02 (set_color -b 073642) - set -l bcol_base01 (set_color -b 586e75) - set -l bcol_base00 (set_color -b 657b83) - set -l bcol_base0 (set_color -b 839496) - set -l bcol_base1 (set_color -b 93a1a1) - set -l bcol_base2 (set_color -b eee8d5) - set -l bcol_base3 (set_color -b fdf6e3) - set -l bcol_yellow (set_color -b b58900) - set -l bcol_orange (set_color -b cb4b16) - set -l bcol_red (set_color -b red) - set -l bcol_magenta (set_color -b d33682) - set -l bcol_violet (set_color -b 6c71c4) - set -l bcol_blue (set_color -b 268bd2) - set -l bcol_cyan (set_color -b 2aa198) - set -l bcol_green (set_color -b 859900) - # Segments - + # vi mode set -l ps_vi "" - if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings" + if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings" set ps_vi (fish_vi_prompt_cm) end # git - # If inside a git repo then the pwd segment is replaced by the git - # segment. - # The git segment format is X:YI@Z:P(N) where: - # X is git - # Y is the current branch - # I is the information about the current repo state - # Z is the name of the repo - # P is the current working path basename (name of the current directory) - # C is the depth of the path starting from base directory of the repo - # The displayed information is: - # Dirtiness is indicated by a little dot after the branch name. - # Unpushed commits are indicated with up arrows - # The number of unpushed commits is indicated right after the up arrows - # If P = Z then P(C) is not displayed set -l ps_git "" set -l git_branch_name (__budspencer_git_branch_name) if test -n "$git_branch_name" - set ps_git $bcol_base01 "" $fcol_black "  "$git_branch_name" " $fcol_base01 #"@"$colbred$git_repo_name + set ps_git (set_color -b $budspencer_colors[4]) "" (set_color $budspencer_colors[1]) "  "$git_branch_name" " (set_color $budspencer_colors[4]) #"@"$colbred$git_repo_name end set -l ps_symbols (fish_prompt_symbols) diff --git a/themes/budspencer/fish_right_prompt.fish b/themes/budspencer/fish_right_prompt.fish index 654c4d5..70b3f8e 100644 --- a/themes/budspencer/fish_right_prompt.fish +++ b/themes/budspencer/fish_right_prompt.fish @@ -1,42 +1,3 @@ -# TODO: color definitions cleanup - - # Init colors - - set fcol_black (set_color 000000) - set fcol_base03 (set_color -o 002b36) - set fcol_base02 (set_color -o 073642) - set fcol_base01 (set_color -o 586e75) - set fcol_base00 (set_color -o 657b83) - set fcol_base0 (set_color -o 839496) - set fcol_base1 (set_color -o 93a1a1) - set fcol_base2 (set_color -o eee8d5) - set fcol_base3 (set_color -o fdf6e3) - set fcol_yellow (set_color -o b58900) - set fcol_orange (set_color -o cb4b16) - set fcol_red (set_color -o red) - set fcol_magenta (set_color -o d33682) - set fcol_violet (set_color -o 6c71c4) - set fcol_blue (set_color -o 268bd2) - set fcol_blue (set_color -o 268bd2) - set fcol_cyan (set_color -o 2aa198) - set fcol_green (set_color -o 859900) - set bcol_base03 (set_color -b 002b36) - set bcol_base02 (set_color -b 073642) - set bcol_base01 (set_color -b 586e75) - set bcol_base00 (set_color -b 657b83) - set bcol_base0 (set_color -b 839496) - set bcol_base1 (set_color -b 93a1a1) - set bcol_base2 (set_color -b eee8d5) - set bcol_base3 (set_color -b fdf6e3) - set bcol_yellow (set_color -b b58900) - set bcol_orange (set_color -b cb4b16) - set bcol_red (set_color -b dc322f) - set bcol_magenta (set_color -b d33682) - set bcol_violet (set_color -b 6c71c4) - set bcol_blue (set_color -b 268bd2) - set bcol_cyan (set_color -b 2aa198) - set bcol_green (set_color -b 859900) - function __budspencer_is_git_ahead_or_behind -d "Check if there are unpulled or unpushed commits" echo (command git rev-list --count --left-right "HEAD...@{upstream}" ^/dev/null | sed 's/[[:space:]+]/\\x1e/g') end @@ -67,7 +28,7 @@ end set git_style "symbols" function fish_git_toggle_cm --description "Toggles style of git segment, press ,, in NORMAL mode" if test $git_style = "symbols" - set git_style "counts" + set git_style "counts" else set git_style "symbols" end @@ -94,9 +55,9 @@ function fish_cmd_duration_cm -d "Displays the elapsed time of last command" if test (count $CMD_DURATION) -gt 0 set -l duration (echo $CMD_DURATION | tr -d '[[:space:]]' | sed 's|\.[[:digit:]]*||') if test $last_status -ne 0 - echo -n $fcol_base02""$bcol_base02$fcol_red" "$duration + echo -n (set_color $budspencer_colors[3])""(set_color -b $budspencer_colors[3] $budspencer_colors[12])" "$duration else - echo -n $fcol_base02""$bcol_base02$fcol_green" "$duration + echo -n (set_color $budspencer_colors[3])""(set_color -b $budspencer_colors[3] $budspencer_colors[17])" "$duration end end end @@ -104,80 +65,80 @@ end function fish_git_prompt_cm --description "Displays the git symbols" set -l git_prompt "" set -l is_repo (command git rev-parse --is-inside-work-tree ^/dev/null) - if test $is_repo="true" + if test $is_repo="true" set -l git_ahead_behind (__budspencer_is_git_ahead_or_behind) if test $git_ahead_behind[1] -gt 0 if test $git_style = "symbols" - set git_prompt $fcol_yellow" ↑" + set git_prompt (set_color -o $budspencer_colors[10])" ↑" else - set git_prompt $fcol_yellow" "$git_ahead_behind[1] + set git_prompt (set_color -o $budspencer_colors[10])" "$git_ahead_behind[1] end end - + if test $git_ahead_behind[2] -gt 0 if test $git_style = "symbols" - set git_prompt $git_prompt$fcol_yellow" ↓" + set git_prompt $git_prompt(set_color -o $budspencer_colors[10])" ↓" else - set git_prompt $git_prompt$fcol_yellow" "$git_ahead_behind[2] + set git_prompt $git_prompt(set_color -o $budspencer_colors[10])" "$git_ahead_behind[2] end end - + set -l git_status (__budspencer_git_status) if test $git_status[1] -gt 0 if test $git_style = "symbols" - set git_prompt $git_prompt$fcol_green" +" + set git_prompt $git_prompt(set_color -o $budspencer_colors[17])" +" else - set git_prompt $git_prompt$fcol_green" "$git_status[1] + set git_prompt $git_prompt(set_color -o $budspencer_colors[17])" "$git_status[1] end end if test $git_status[2] -gt 0 if test $git_style = "symbols" - set git_prompt $git_prompt$fcol_red" –" + set git_prompt $git_prompt(set_color -o $budspencer_colors[12])" –" else - set git_prompt $git_prompt$fcol_red" "$git_status[2] + set git_prompt $git_prompt(set_color -o $budspencer_colors[12])" "$git_status[2] end end if test $git_status[3] -gt 0 if test $git_style = "symbols" - set git_prompt $git_prompt$fcol_blue" ✱" + set git_prompt $git_prompt(set_color -o $budspencer_colors[15])" ✱" else - set git_prompt $git_prompt$fcol_blue" "$git_status[3] + set git_prompt $git_prompt(set_color -o $budspencer_colors[15])" "$git_status[3] end end if test $git_status[4] -gt 0 if test $git_style = "symbols" - set git_prompt $git_prompt$fcol_magenta" →" + set git_prompt $git_prompt(set_color -o $budspencer_colors[13])" →" else - set git_prompt $git_prompt$fcol_magenta" "$git_status[4] + set git_prompt $git_prompt(set_color -o $budspencer_colors[13])" "$git_status[4] end end if test $git_status[5] -gt 0 if test $git_style = "symbols" - set git_prompt $git_prompt$fcol_violet" ═" + set git_prompt $git_prompt(set_color -o $budspencer_colors[14])" ═" else - set git_prompt $git_prompt$fcol_violet" "$git_status[5] + set git_prompt $git_prompt(set_color -o $budspencer_colors[14])" "$git_status[5] end end if test $git_status[6] -gt 0 if test $git_style = "symbols" - set git_prompt $git_prompt$fcol_base3" ●" + set git_prompt $git_prompt(set_color -o $budspencer_colors[9])" ●" else - set git_prompt $git_prompt$fcol_base3" "$git_status[6] + set git_prompt $git_prompt(set_color -o $budspencer_colors[9])" "$git_status[6] end end set -l git_stashed (__budspencer_is_git_stashed) if test git_stashed -gt 0 if test $git_style = "symbols" - set git_prompt $git_prompt$fcol_cyan" ✭" + set git_prompt $git_prompt(set_color -o $budspencer_colors[16])" ✭" else - set git_prompt $git_prompt$fcol_cyan" "$git_stashed + set git_prompt $git_prompt(set_color -o $budspencer_colors[16])" "$git_stashed end end echo $git_prompt @@ -192,23 +153,23 @@ function fish_pwd_prompt_cm --description "Displays the present working director if test $pwd_style != "none" set user_host $user_host":" end - end + end switch $fish_bind_mode case default - set_color blue + set_color $budspencer_colors[15] echo -n "" set_color normal - set_color --background blue 000 + set_color -b $budspencer_colors[15] $budspencer_colors[1] case insert - set_color yellow + set_color $budspencer_colors[10] echo -n "" set_color normal - set_color --background yellow 000 + set_color -b $budspencer_colors[10] $budspencer_colors[1] case visual - set_color magenta + set_color $budspencer_colors[13] echo -n "" set_color normal - set_color --background magenta 000 + set_color -b $budspencer_colors[13] $budspencer_colors[1] end switch $pwd_style case none @@ -222,7 +183,7 @@ function fish_pwd_prompt_cm --description "Displays the present working director end function fish_right_prompt -d "Write out the right prompt of the budspencer theme" - + # Segments # command duration @@ -231,12 +192,12 @@ function fish_right_prompt -d "Write out the right prompt of the budspencer them # git set ps_git (fish_git_prompt_cm) if test -n "$ps_git" - set ps_git $fcol_base01""$bcol_base01""$ps_git + set ps_git (set_color $budspencer_colors[4])""(set_color -b $budspencer_colors[4])""$ps_git end - # pwd + # pwd set -l ps_pwd "" - if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings" + if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings" set ps_pwd (fish_pwd_prompt_cm) end From 7272e4ebec1960c9b8e7afaa12af728adead7c90 Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Sun, 3 Aug 2014 18:12:24 +0200 Subject: [PATCH 10/20] vi mode dependend cursor colors --- themes/budspencer/fish_prompt.fish | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/themes/budspencer/fish_prompt.fish b/themes/budspencer/fish_prompt.fish index 14a1063..fea1578 100644 --- a/themes/budspencer/fish_prompt.fish +++ b/themes/budspencer/fish_prompt.fish @@ -20,21 +20,24 @@ function fish_vi_prompt_cm --description "Displays the current mode" switch $fish_bind_mode case default set_color -b $budspencer_colors[15] $budspencer_colors[1] + echo -en "\033]12;#$budspencer_colors[15]\007" echo -n " NORMAL " set_color -b $budspencer_colors[1] $budspencer_colors[15] case insert set_color -b $budspencer_colors[10] $budspencer_colors[1] + echo -en "\033]12;#$budspencer_colors[10]\007" echo -n " INSERT " set_color -b $budspencer_colors[1] $budspencer_colors[10] case visual set_color -b $budspencer_colors[13] $budspencer_colors[1] + echo -en "\033]12;#$budspencer_colors[13]\007" echo -n " VISUAL " set_color -b $budspencer_colors[1] $budspencer_colors[13] end end function fish_prompt_symbols --description "Display symbols" - set_color -o -b $budspencer_colors[3] + set_color -b $budspencer_colors[3] echo -n "" # indicator for vim parent process if set -q -x VIM From c3ca7d21b589484c41ac7fa7e59df35be5f2677a Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Sun, 3 Aug 2014 18:50:09 +0200 Subject: [PATCH 11/20] git ahead behind bug fixed --- themes/budspencer/fish_right_prompt.fish | 26 +++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/themes/budspencer/fish_right_prompt.fish b/themes/budspencer/fish_right_prompt.fish index 70b3f8e..839e301 100644 --- a/themes/budspencer/fish_right_prompt.fish +++ b/themes/budspencer/fish_right_prompt.fish @@ -68,19 +68,21 @@ function fish_git_prompt_cm --description "Displays the git symbols" if test $is_repo="true" set -l git_ahead_behind (__budspencer_is_git_ahead_or_behind) - if test $git_ahead_behind[1] -gt 0 - if test $git_style = "symbols" - set git_prompt (set_color -o $budspencer_colors[10])" ↑" - else - set git_prompt (set_color -o $budspencer_colors[10])" "$git_ahead_behind[1] + if test (count $git_ahead_behind) -eq 2 + if test $git_ahead_behind[1] -gt 0 + if test $git_style = "symbols" + set git_prompt (set_color -o $budspencer_colors[10])" ↑" + else + set git_prompt (set_color -o $budspencer_colors[10])" "$git_ahead_behind[1] + end end - end - if test $git_ahead_behind[2] -gt 0 - if test $git_style = "symbols" - set git_prompt $git_prompt(set_color -o $budspencer_colors[10])" ↓" - else - set git_prompt $git_prompt(set_color -o $budspencer_colors[10])" "$git_ahead_behind[2] + if test $git_ahead_behind[2] -gt 0 + if test $git_style = "symbols" + set git_prompt $git_prompt(set_color -o $budspencer_colors[10])" ↓" + else + set git_prompt $git_prompt(set_color -o $budspencer_colors[10])" "$git_ahead_behind[2] + end end end @@ -141,7 +143,7 @@ function fish_git_prompt_cm --description "Displays the git symbols" set git_prompt $git_prompt(set_color -o $budspencer_colors[16])" "$git_stashed end end - echo $git_prompt + echo -n $git_prompt end end From beb7a53839d2575dba6a22a00df190990fd25a7f Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Sun, 3 Aug 2014 22:29:33 +0200 Subject: [PATCH 12/20] git branch segment improved --- themes/budspencer/fish_prompt.fish | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/themes/budspencer/fish_prompt.fish b/themes/budspencer/fish_prompt.fish index fea1578..acb7cc1 100644 --- a/themes/budspencer/fish_prompt.fish +++ b/themes/budspencer/fish_prompt.fish @@ -4,7 +4,7 @@ ############################################################################### # Color definitions ############################################################################### - set -g budspencer_colors 000000 002b36 083743 445659 657b83 839496 93a1a1 eee8d5 fdf6e3 b58900 cb4b16 dc121f d33682 6c71c4 268bd2 2aa198 859900 +set -g budspencer_colors 000000 002b36 083743 445659 657b83 839496 93a1a1 eee8d5 fdf6e3 b58900 cb4b16 dc121f af005f 6c71c4 268bd2 2aa198 859900 ############################################################################### # Utils @@ -13,7 +13,12 @@ set -g __budspencer_display_rprompt 1 function __budspencer_git_branch_name -d "Return the current branch name" - echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') + set -l branch (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') + if test (count $branch) -eq 0 + echo -n (set_color -b $budspencer_colors[14])""(set_color $budspencer_colors[1])"  "(git describe --contains --all HEAD ^/dev/null)" "(set_color $budspencer_colors[14]) + else + echo -n (set_color -b $budspencer_colors[4])""(set_color $budspencer_colors[1])"  "$branch" "(set_color $budspencer_colors[4]) + end end function fish_vi_prompt_cm --description "Displays the current mode" @@ -95,7 +100,7 @@ function fish_prompt -d "Write out the left prompt of the budspencer theme" set -l ps_git "" set -l git_branch_name (__budspencer_git_branch_name) if test -n "$git_branch_name" - set ps_git (set_color -b $budspencer_colors[4]) "" (set_color $budspencer_colors[1]) "  "$git_branch_name" " (set_color $budspencer_colors[4]) #"@"$colbred$git_repo_name + set ps_git $git_branch_name end set -l ps_symbols (fish_prompt_symbols) From f37d55ade51849c4e4853da04873c6acf2e2b535 Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Sun, 3 Aug 2014 22:38:46 +0200 Subject: [PATCH 13/20] made toggle functions available in VISUAL mode --- themes/budspencer/README.md | 4 ++-- themes/budspencer/fish_right_prompt.fish | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/themes/budspencer/README.md b/themes/budspencer/README.md index 41c67d9..c7d8d09 100644 --- a/themes/budspencer/README.md +++ b/themes/budspencer/README.md @@ -19,7 +19,7 @@ Translation of zsh's prezto [budspencer theme][budspencer] - Last command's duration time - Git status - * style can be toggled in NORMAL mode with `,,` between + * style can be toggled in NORMAL and in VISUAL mode with `,,` between - `symbols` (shows git status symbols, see below) - `counts` (shows amount of files that are affected) * symbols: @@ -33,7 +33,7 @@ Translation of zsh's prezto [budspencer theme][budspencer] - ●: there are untracked files - ✭: there are stashed commits - Present working directory - * style can be toggled in NORMAL mode with space bar + * style can be toggled in NORMAL and in VISUAL mode with space bar * styles implemented: - `short` (show truncated path) - `long` (show full path) diff --git a/themes/budspencer/fish_right_prompt.fish b/themes/budspencer/fish_right_prompt.fish index 839e301..9d50554 100644 --- a/themes/budspencer/fish_right_prompt.fish +++ b/themes/budspencer/fish_right_prompt.fish @@ -35,6 +35,7 @@ function fish_git_toggle_cm --description "Toggles style of git segment, press , commandline -f repaint end bind -M default ',,' fish_git_toggle_cm +bind -M visual ',,' fish_git_toggle_cm if set -q -x $PWDSTYLE set -x PWDSTYLE short long none @@ -50,6 +51,7 @@ function fish_pwd_toggle_cm --description "Toggles style of pwd segment, press s end end bind -M default ' ' fish_pwd_toggle_cm +bind -M visual ' ' fish_pwd_toggle_cm function fish_cmd_duration_cm -d "Displays the elapsed time of last command" if test (count $CMD_DURATION) -gt 0 From 5c805aef02cdd6821b25c8b2a10e9ca7cd2a040b Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Mon, 4 Aug 2014 10:32:51 +0200 Subject: [PATCH 14/20] git branch segment improved removed needless colors comments inserted --- themes/budspencer/fish_prompt.fish | 70 ++++++++++++++---------- themes/budspencer/fish_right_prompt.fish | 69 +++++++++++++---------- 2 files changed, 82 insertions(+), 57 deletions(-) diff --git a/themes/budspencer/fish_prompt.fish b/themes/budspencer/fish_prompt.fish index acb7cc1..8e1a289 100644 --- a/themes/budspencer/fish_prompt.fish +++ b/themes/budspencer/fish_prompt.fish @@ -1,10 +1,17 @@ -# TODO: git improvements -# name: budspencer +############################################################################### +# +# prompt theme name: budspencer +# +# description: a sophisticated airline/powerline theme +# +# author: Joseph Tannhuber +# +############################################################################### ############################################################################### # Color definitions ############################################################################### -set -g budspencer_colors 000000 002b36 083743 445659 657b83 839496 93a1a1 eee8d5 fdf6e3 b58900 cb4b16 dc121f af005f 6c71c4 268bd2 2aa198 859900 +set -g budspencer_colors 000000 083743 445659 fdf6e3 b58900 cb4b16 dc121f af005f 6c71c4 268bd2 2aa198 859900 ############################################################################### # Utils @@ -15,80 +22,89 @@ set -g __budspencer_display_rprompt 1 function __budspencer_git_branch_name -d "Return the current branch name" set -l branch (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') if test (count $branch) -eq 0 - echo -n (set_color -b $budspencer_colors[14])""(set_color $budspencer_colors[1])"  "(git describe --contains --all HEAD ^/dev/null)" "(set_color $budspencer_colors[14]) + set -l position (git describe --contains --all HEAD ^/dev/null) + if test (count $position) -eq 0 + set -l commit (git rev-parse HEAD ^/dev/null) + echo -n (set_color -b $budspencer_colors[11])""(set_color $budspencer_colors[1])" ➦ "$commit" "(set_color $budspencer_colors[11]) + else + echo -n (set_color -b $budspencer_colors[9])""(set_color $budspencer_colors[1])"  "$position" "(set_color $budspencer_colors[9]) + end else - echo -n (set_color -b $budspencer_colors[4])""(set_color $budspencer_colors[1])"  "$branch" "(set_color $budspencer_colors[4]) + echo -n (set_color -b $budspencer_colors[3])""(set_color $budspencer_colors[1])"  "$branch" "(set_color $budspencer_colors[3]) end end function fish_vi_prompt_cm --description "Displays the current mode" switch $fish_bind_mode case default - set_color -b $budspencer_colors[15] $budspencer_colors[1] - echo -en "\033]12;#$budspencer_colors[15]\007" - echo -n " NORMAL " - set_color -b $budspencer_colors[1] $budspencer_colors[15] - case insert set_color -b $budspencer_colors[10] $budspencer_colors[1] echo -en "\033]12;#$budspencer_colors[10]\007" - echo -n " INSERT " + echo -n " NORMAL " set_color -b $budspencer_colors[1] $budspencer_colors[10] + case insert + set_color -b $budspencer_colors[5] $budspencer_colors[1] + echo -en "\033]12;#$budspencer_colors[5]\007" + echo -n " INSERT " + set_color -b $budspencer_colors[1] $budspencer_colors[5] case visual - set_color -b $budspencer_colors[13] $budspencer_colors[1] - echo -en "\033]12;#$budspencer_colors[13]\007" + set_color -b $budspencer_colors[8] $budspencer_colors[1] + echo -en "\033]12;#$budspencer_colors[8]\007" echo -n " VISUAL " - set_color -b $budspencer_colors[1] $budspencer_colors[13] + set_color -b $budspencer_colors[1] $budspencer_colors[8] end end function fish_prompt_symbols --description "Display symbols" - set_color -b $budspencer_colors[3] + set_color -b $budspencer_colors[2] echo -n "" # indicator for vim parent process if set -q -x VIM - set_color $budspencer_colors[14] + set_color -o $budspencer_colors[9] echo -n " V" end # indicator for ranger parent process if set -q -x RANGER_LEVEL - set_color $budspencer_colors[14] + set_color -o $budspencer_colors[9] echo -n " R" end # background job indicator if [ (jobs | wc -l) -gt 0 ] - set_color $budspencer_colors[16] + set_color -o $budspencer_colors[11] echo -n " ⚙" end # write protection indicator if [ ! -w . ] - set_color $budspencer_colors[11] + set_color -o $budspencer_colors[6] echo -n " " end # status indicator if [ $last_status -eq 0 ] - set_color $budspencer_colors[17] + set_color -o $budspencer_colors[12] echo -n " ✔" else - set_color $budspencer_colors[12] + set_color -o $budspencer_colors[7] echo -n " ✘" end # superuser indicator if [ $USER = "root" ] - set_color $budspencer_colors[11] + set_color -o $budspencer_colors[6] echo -n " ⚡" end echo -n " " - set_color -b normal $budspencer_colors[3] + set_color -b normal $budspencer_colors[2] end + ############################################################################### -# Prompts +# Prompt ############################################################################### function fish_prompt -d "Write out the left prompt of the budspencer theme" set -g last_status $status set -l basedir_name (basename (prompt_pwd)) + ############################################################################# # Segments + ############################################################################# # vi mode set -l ps_vi "" @@ -103,11 +119,9 @@ function fish_prompt -d "Write out the left prompt of the budspencer theme" set ps_git $git_branch_name end + # symbols set -l ps_symbols (fish_prompt_symbols) - # Left Prompt - + # left prompt echo -n -s $ps_vi $ps_git $ps_symbols '' ' ' end - - diff --git a/themes/budspencer/fish_right_prompt.fish b/themes/budspencer/fish_right_prompt.fish index 9d50554..d9f4167 100644 --- a/themes/budspencer/fish_right_prompt.fish +++ b/themes/budspencer/fish_right_prompt.fish @@ -1,3 +1,7 @@ +############################################################################### +# Utils +############################################################################### + function __budspencer_is_git_ahead_or_behind -d "Check if there are unpulled or unpushed commits" echo (command git rev-list --count --left-right "HEAD...@{upstream}" ^/dev/null | sed 's/[[:space:]+]/\\x1e/g') end @@ -57,9 +61,9 @@ function fish_cmd_duration_cm -d "Displays the elapsed time of last command" if test (count $CMD_DURATION) -gt 0 set -l duration (echo $CMD_DURATION | tr -d '[[:space:]]' | sed 's|\.[[:digit:]]*||') if test $last_status -ne 0 - echo -n (set_color $budspencer_colors[3])""(set_color -b $budspencer_colors[3] $budspencer_colors[12])" "$duration + echo -n (set_color $budspencer_colors[2])""(set_color -b $budspencer_colors[2] $budspencer_colors[7])" "$duration else - echo -n (set_color $budspencer_colors[3])""(set_color -b $budspencer_colors[3] $budspencer_colors[17])" "$duration + echo -n (set_color $budspencer_colors[2])""(set_color -b $budspencer_colors[2] $budspencer_colors[12])" "$duration end end end @@ -73,17 +77,17 @@ function fish_git_prompt_cm --description "Displays the git symbols" if test (count $git_ahead_behind) -eq 2 if test $git_ahead_behind[1] -gt 0 if test $git_style = "symbols" - set git_prompt (set_color -o $budspencer_colors[10])" ↑" + set git_prompt (set_color -o $budspencer_colors[5])" ↑" else - set git_prompt (set_color -o $budspencer_colors[10])" "$git_ahead_behind[1] + set git_prompt (set_color -o $budspencer_colors[5])" "$git_ahead_behind[1] end end if test $git_ahead_behind[2] -gt 0 if test $git_style = "symbols" - set git_prompt $git_prompt(set_color -o $budspencer_colors[10])" ↓" + set git_prompt $git_prompt(set_color -o $budspencer_colors[5])" ↓" else - set git_prompt $git_prompt(set_color -o $budspencer_colors[10])" "$git_ahead_behind[2] + set git_prompt $git_prompt(set_color -o $budspencer_colors[5])" "$git_ahead_behind[2] end end end @@ -91,58 +95,58 @@ function fish_git_prompt_cm --description "Displays the git symbols" set -l git_status (__budspencer_git_status) if test $git_status[1] -gt 0 if test $git_style = "symbols" - set git_prompt $git_prompt(set_color -o $budspencer_colors[17])" +" + set git_prompt $git_prompt(set_color -o $budspencer_colors[12])" +" else - set git_prompt $git_prompt(set_color -o $budspencer_colors[17])" "$git_status[1] + set git_prompt $git_prompt(set_color -o $budspencer_colors[12])" "$git_status[1] end end if test $git_status[2] -gt 0 if test $git_style = "symbols" - set git_prompt $git_prompt(set_color -o $budspencer_colors[12])" –" + set git_prompt $git_prompt(set_color -o $budspencer_colors[7])" –" else - set git_prompt $git_prompt(set_color -o $budspencer_colors[12])" "$git_status[2] + set git_prompt $git_prompt(set_color -o $budspencer_colors[7])" "$git_status[2] end end if test $git_status[3] -gt 0 if test $git_style = "symbols" - set git_prompt $git_prompt(set_color -o $budspencer_colors[15])" ✱" + set git_prompt $git_prompt(set_color -o $budspencer_colors[10])" ✱" else - set git_prompt $git_prompt(set_color -o $budspencer_colors[15])" "$git_status[3] + set git_prompt $git_prompt(set_color -o $budspencer_colors[10])" "$git_status[3] end end if test $git_status[4] -gt 0 if test $git_style = "symbols" - set git_prompt $git_prompt(set_color -o $budspencer_colors[13])" →" + set git_prompt $git_prompt(set_color -o $budspencer_colors[8])" →" else - set git_prompt $git_prompt(set_color -o $budspencer_colors[13])" "$git_status[4] + set git_prompt $git_prompt(set_color -o $budspencer_colors[8])" "$git_status[4] end end if test $git_status[5] -gt 0 if test $git_style = "symbols" - set git_prompt $git_prompt(set_color -o $budspencer_colors[14])" ═" + set git_prompt $git_prompt(set_color -o $budspencer_colors[9])" ═" else - set git_prompt $git_prompt(set_color -o $budspencer_colors[14])" "$git_status[5] + set git_prompt $git_prompt(set_color -o $budspencer_colors[9])" "$git_status[5] end end if test $git_status[6] -gt 0 if test $git_style = "symbols" - set git_prompt $git_prompt(set_color -o $budspencer_colors[9])" ●" + set git_prompt $git_prompt(set_color -o $budspencer_colors[4])" ●" else - set git_prompt $git_prompt(set_color -o $budspencer_colors[9])" "$git_status[6] + set git_prompt $git_prompt(set_color -o $budspencer_colors[4])" "$git_status[6] end end set -l git_stashed (__budspencer_is_git_stashed) if test git_stashed -gt 0 if test $git_style = "symbols" - set git_prompt $git_prompt(set_color -o $budspencer_colors[16])" ✭" + set git_prompt $git_prompt(set_color -o $budspencer_colors[11])" ✭" else - set git_prompt $git_prompt(set_color -o $budspencer_colors[16])" "$git_stashed + set git_prompt $git_prompt(set_color -o $budspencer_colors[11])" "$git_stashed end end echo -n $git_prompt @@ -160,20 +164,20 @@ function fish_pwd_prompt_cm --description "Displays the present working director end switch $fish_bind_mode case default - set_color $budspencer_colors[15] - echo -n "" - set_color normal - set_color -b $budspencer_colors[15] $budspencer_colors[1] - case insert set_color $budspencer_colors[10] echo -n "" set_color normal set_color -b $budspencer_colors[10] $budspencer_colors[1] - case visual - set_color $budspencer_colors[13] + case insert + set_color $budspencer_colors[5] echo -n "" set_color normal - set_color -b $budspencer_colors[13] $budspencer_colors[1] + set_color -b $budspencer_colors[5] $budspencer_colors[1] + case visual + set_color $budspencer_colors[8] + echo -n "" + set_color normal + set_color -b $budspencer_colors[8] $budspencer_colors[1] end switch $pwd_style case none @@ -186,9 +190,15 @@ function fish_pwd_prompt_cm --description "Displays the present working director set_color normal end +############################################################################### +# Prompt +############################################################################### + function fish_right_prompt -d "Write out the right prompt of the budspencer theme" + ############################################################################# # Segments + ############################################################################# # command duration set ps_duration (fish_cmd_duration_cm) @@ -196,7 +206,7 @@ function fish_right_prompt -d "Write out the right prompt of the budspencer them # git set ps_git (fish_git_prompt_cm) if test -n "$ps_git" - set ps_git (set_color $budspencer_colors[4])""(set_color -b $budspencer_colors[4])""$ps_git + set ps_git (set_color $budspencer_colors[3])""(set_color -b $budspencer_colors[3])""$ps_git end # pwd @@ -205,6 +215,7 @@ function fish_right_prompt -d "Write out the right prompt of the budspencer them set ps_pwd (fish_pwd_prompt_cm) end + # right prompt echo -n $ps_duration $ps_git $ps_pwd set_color normal end From cbb1f8d9fc196c800aa06fb63f9c2696c93971e9 Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Mon, 4 Aug 2014 11:06:43 +0200 Subject: [PATCH 15/20] show commit in truncated format --- themes/budspencer/fish_prompt.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/budspencer/fish_prompt.fish b/themes/budspencer/fish_prompt.fish index 8e1a289..e789ba7 100644 --- a/themes/budspencer/fish_prompt.fish +++ b/themes/budspencer/fish_prompt.fish @@ -24,7 +24,7 @@ function __budspencer_git_branch_name -d "Return the current branch name" if test (count $branch) -eq 0 set -l position (git describe --contains --all HEAD ^/dev/null) if test (count $position) -eq 0 - set -l commit (git rev-parse HEAD ^/dev/null) + set -l commit (git rev-parse HEAD ^/dev/null | sed -r 's|(^.{7}).*|\1|') echo -n (set_color -b $budspencer_colors[11])""(set_color $budspencer_colors[1])" ➦ "$commit" "(set_color $budspencer_colors[11]) else echo -n (set_color -b $budspencer_colors[9])""(set_color $budspencer_colors[1])"  "$position" "(set_color $budspencer_colors[9]) From 6b4f483dae05a3a886ff661039d592b75d631271 Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Mon, 4 Aug 2014 11:55:18 +0200 Subject: [PATCH 16/20] don't change cursor color if terminal doesn't support it --- themes/budspencer/fish_prompt.fish | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/themes/budspencer/fish_prompt.fish b/themes/budspencer/fish_prompt.fish index e789ba7..1a3955c 100644 --- a/themes/budspencer/fish_prompt.fish +++ b/themes/budspencer/fish_prompt.fish @@ -1,7 +1,7 @@ ############################################################################### # # prompt theme name: budspencer -# +# # description: a sophisticated airline/powerline theme # # author: Joseph Tannhuber @@ -11,8 +11,19 @@ ############################################################################### # Color definitions ############################################################################### + +# define colors set -g budspencer_colors 000000 083743 445659 fdf6e3 b58900 cb4b16 dc121f af005f 6c71c4 268bd2 2aa198 859900 +# cursor colors +set -g budspencer_cursors "\033]12;#$budspencer_colors[10]\007" "\033]12;#$budspencer_colors[5]\007" "\033]12;#$budspencer_colors[8]\007" +set -l unsupported_terminals "fbterm" "st" "linux" "screen" +for term in $unsupported_terminals + if test $term = $TERM + set -g budspencer_cursors "" "" "" + end +end + ############################################################################### # Utils ############################################################################### @@ -38,17 +49,17 @@ function fish_vi_prompt_cm --description "Displays the current mode" switch $fish_bind_mode case default set_color -b $budspencer_colors[10] $budspencer_colors[1] - echo -en "\033]12;#$budspencer_colors[10]\007" + echo -en $budspencer_cursors[1] echo -n " NORMAL " set_color -b $budspencer_colors[1] $budspencer_colors[10] case insert set_color -b $budspencer_colors[5] $budspencer_colors[1] - echo -en "\033]12;#$budspencer_colors[5]\007" + echo -en $budspencer_cursors[2] echo -n " INSERT " set_color -b $budspencer_colors[1] $budspencer_colors[5] case visual set_color -b $budspencer_colors[8] $budspencer_colors[1] - echo -en "\033]12;#$budspencer_colors[8]\007" + echo -en $budspencer_cursors[3] echo -n " VISUAL " set_color -b $budspencer_colors[1] $budspencer_colors[8] end From b842611986341f2c2a3629c79de67df4ff85fb28 Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Mon, 4 Aug 2014 21:09:52 +0200 Subject: [PATCH 17/20] Changed git toggle command from ',,' to '#' --- themes/budspencer/README.md | 2 +- themes/budspencer/fish_prompt.fish | 4 ++-- themes/budspencer/fish_right_prompt.fish | 30 ++++++++++++------------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/themes/budspencer/README.md b/themes/budspencer/README.md index c7d8d09..f7738e7 100644 --- a/themes/budspencer/README.md +++ b/themes/budspencer/README.md @@ -19,7 +19,7 @@ Translation of zsh's prezto [budspencer theme][budspencer] - Last command's duration time - Git status - * style can be toggled in NORMAL and in VISUAL mode with `,,` between + * style can be toggled in NORMAL and in VISUAL mode with `#` between - `symbols` (shows git status symbols, see below) - `counts` (shows amount of files that are affected) * symbols: diff --git a/themes/budspencer/fish_prompt.fish b/themes/budspencer/fish_prompt.fish index 1a3955c..cd3e2a3 100644 --- a/themes/budspencer/fish_prompt.fish +++ b/themes/budspencer/fish_prompt.fish @@ -45,7 +45,7 @@ function __budspencer_git_branch_name -d "Return the current branch name" end end -function fish_vi_prompt_cm --description "Displays the current mode" +function fish_vi_prompt_cm -d "Displays the current mode" switch $fish_bind_mode case default set_color -b $budspencer_colors[10] $budspencer_colors[1] @@ -65,7 +65,7 @@ function fish_vi_prompt_cm --description "Displays the current mode" end end -function fish_prompt_symbols --description "Display symbols" +function fish_prompt_symbols -d "Display symbols" set_color -b $budspencer_colors[2] echo -n "" # indicator for vim parent process diff --git a/themes/budspencer/fish_right_prompt.fish b/themes/budspencer/fish_right_prompt.fish index d9f4167..97dc1a3 100644 --- a/themes/budspencer/fish_right_prompt.fish +++ b/themes/budspencer/fish_right_prompt.fish @@ -30,7 +30,7 @@ function __budspencer_is_git_stashed -d "Check if there are stashed commits" end set git_style "symbols" -function fish_git_toggle_cm --description "Toggles style of git segment, press ,, in NORMAL mode" +function fish_git_toggle_cm -d "Toggles style of git segment, press # in NORMAL or VISUAL mode" if test $git_style = "symbols" set git_style "counts" else @@ -38,14 +38,14 @@ function fish_git_toggle_cm --description "Toggles style of git segment, press , end commandline -f repaint end -bind -M default ',,' fish_git_toggle_cm -bind -M visual ',,' fish_git_toggle_cm +bind -M default '#' fish_git_toggle_cm +bind -M visual '#' fish_git_toggle_cm if set -q -x $PWDSTYLE set -x PWDSTYLE short long none end set pwd_style $PWDSTYLE[1] -function fish_pwd_toggle_cm --description "Toggles style of pwd segment, press space bar in NORMAL mode" +function fish_pwd_toggle_cm -d "Toggles style of pwd segment, press space bar in NORMAL or VISUAL mode" for i in (seq 1 (count $PWDSTYLE)) if test $PWDSTYLE[$i] = $pwd_style set pwd_style $PWDSTYLE[(math $i%(count $PWDSTYLE)+1)] @@ -68,7 +68,7 @@ function fish_cmd_duration_cm -d "Displays the elapsed time of last command" end end -function fish_git_prompt_cm --description "Displays the git symbols" +function fish_git_prompt_cm -d "Displays the git symbols" set -l git_prompt "" set -l is_repo (command git rev-parse --is-inside-work-tree ^/dev/null) if test $is_repo="true" @@ -79,7 +79,7 @@ function fish_git_prompt_cm --description "Displays the git symbols" if test $git_style = "symbols" set git_prompt (set_color -o $budspencer_colors[5])" ↑" else - set git_prompt (set_color -o $budspencer_colors[5])" "$git_ahead_behind[1] + set git_prompt (set_color $budspencer_colors[5])" "$git_ahead_behind[1] end end @@ -87,7 +87,7 @@ function fish_git_prompt_cm --description "Displays the git symbols" if test $git_style = "symbols" set git_prompt $git_prompt(set_color -o $budspencer_colors[5])" ↓" else - set git_prompt $git_prompt(set_color -o $budspencer_colors[5])" "$git_ahead_behind[2] + set git_prompt $git_prompt(set_color $budspencer_colors[5])" "$git_ahead_behind[2] end end end @@ -97,7 +97,7 @@ function fish_git_prompt_cm --description "Displays the git symbols" if test $git_style = "symbols" set git_prompt $git_prompt(set_color -o $budspencer_colors[12])" +" else - set git_prompt $git_prompt(set_color -o $budspencer_colors[12])" "$git_status[1] + set git_prompt $git_prompt(set_color $budspencer_colors[12])" "$git_status[1] end end @@ -105,7 +105,7 @@ function fish_git_prompt_cm --description "Displays the git symbols" if test $git_style = "symbols" set git_prompt $git_prompt(set_color -o $budspencer_colors[7])" –" else - set git_prompt $git_prompt(set_color -o $budspencer_colors[7])" "$git_status[2] + set git_prompt $git_prompt(set_color $budspencer_colors[7])" "$git_status[2] end end @@ -113,7 +113,7 @@ function fish_git_prompt_cm --description "Displays the git symbols" if test $git_style = "symbols" set git_prompt $git_prompt(set_color -o $budspencer_colors[10])" ✱" else - set git_prompt $git_prompt(set_color -o $budspencer_colors[10])" "$git_status[3] + set git_prompt $git_prompt(set_color $budspencer_colors[10])" "$git_status[3] end end @@ -121,7 +121,7 @@ function fish_git_prompt_cm --description "Displays the git symbols" if test $git_style = "symbols" set git_prompt $git_prompt(set_color -o $budspencer_colors[8])" →" else - set git_prompt $git_prompt(set_color -o $budspencer_colors[8])" "$git_status[4] + set git_prompt $git_prompt(set_color $budspencer_colors[8])" "$git_status[4] end end @@ -129,7 +129,7 @@ function fish_git_prompt_cm --description "Displays the git symbols" if test $git_style = "symbols" set git_prompt $git_prompt(set_color -o $budspencer_colors[9])" ═" else - set git_prompt $git_prompt(set_color -o $budspencer_colors[9])" "$git_status[5] + set git_prompt $git_prompt(set_color $budspencer_colors[9])" "$git_status[5] end end @@ -137,7 +137,7 @@ function fish_git_prompt_cm --description "Displays the git symbols" if test $git_style = "symbols" set git_prompt $git_prompt(set_color -o $budspencer_colors[4])" ●" else - set git_prompt $git_prompt(set_color -o $budspencer_colors[4])" "$git_status[6] + set git_prompt $git_prompt(set_color $budspencer_colors[4])" "$git_status[6] end end @@ -146,7 +146,7 @@ function fish_git_prompt_cm --description "Displays the git symbols" if test $git_style = "symbols" set git_prompt $git_prompt(set_color -o $budspencer_colors[11])" ✭" else - set git_prompt $git_prompt(set_color -o $budspencer_colors[11])" "$git_stashed + set git_prompt $git_prompt(set_color $budspencer_colors[11])" "$git_stashed end end echo -n $git_prompt @@ -154,7 +154,7 @@ function fish_git_prompt_cm --description "Displays the git symbols" end end -function fish_pwd_prompt_cm --description "Displays the present working directory" +function fish_pwd_prompt_cm -d "Displays the present working directory" set -l user_host " " if test (count $SSH_CLIENT) -gt 0 set user_host " "$USER"@"(hostname) From 9376094d054377e81bd825f0ade13709824ce24d Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Wed, 6 Aug 2014 12:51:20 +0200 Subject: [PATCH 18/20] Bugfixes and simplifications after revision from bpinto. Thank you very much. --- themes/budspencer/fish_prompt.fish | 17 ++++++------- themes/budspencer/fish_right_prompt.fish | 31 +++++++++++++++++++----- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/themes/budspencer/fish_prompt.fish b/themes/budspencer/fish_prompt.fish index cd3e2a3..e929cc8 100644 --- a/themes/budspencer/fish_prompt.fish +++ b/themes/budspencer/fish_prompt.fish @@ -13,29 +13,29 @@ ############################################################################### # define colors +# values are: black dark_gray light_gray white yellow orange red magenta violet blue cyan green set -g budspencer_colors 000000 083743 445659 fdf6e3 b58900 cb4b16 dc121f af005f 6c71c4 268bd2 2aa198 859900 -# cursor colors +# cursor color changes according to vi-mode +# define values for: normal_mode insert_mode visual_mode set -g budspencer_cursors "\033]12;#$budspencer_colors[10]\007" "\033]12;#$budspencer_colors[5]\007" "\033]12;#$budspencer_colors[8]\007" + +# some terminals cannot change the cursor color set -l unsupported_terminals "fbterm" "st" "linux" "screen" -for term in $unsupported_terminals - if test $term = $TERM - set -g budspencer_cursors "" "" "" - end +if contains $TERM $unsupported_terminals + set -e budspencer_cursors end ############################################################################### # Utils ############################################################################### -set -g __budspencer_display_rprompt 1 - function __budspencer_git_branch_name -d "Return the current branch name" set -l branch (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') if test (count $branch) -eq 0 set -l position (git describe --contains --all HEAD ^/dev/null) if test (count $position) -eq 0 - set -l commit (git rev-parse HEAD ^/dev/null | sed -r 's|(^.{7}).*|\1|') + set -l commit (git rev-parse HEAD ^/dev/null | sed 's|\(^.......\).*|\1|') echo -n (set_color -b $budspencer_colors[11])""(set_color $budspencer_colors[1])" ➦ "$commit" "(set_color $budspencer_colors[11]) else echo -n (set_color -b $budspencer_colors[9])""(set_color $budspencer_colors[1])"  "$position" "(set_color $budspencer_colors[9]) @@ -111,7 +111,6 @@ end function fish_prompt -d "Write out the left prompt of the budspencer theme" set -g last_status $status - set -l basedir_name (basename (prompt_pwd)) ############################################################################# # Segments diff --git a/themes/budspencer/fish_right_prompt.fish b/themes/budspencer/fish_right_prompt.fish index 97dc1a3..cee26dd 100644 --- a/themes/budspencer/fish_right_prompt.fish +++ b/themes/budspencer/fish_right_prompt.fish @@ -1,3 +1,8 @@ +############################################################################### +# Init +############################################################################### +set -g CMD_DURATION 0 + ############################################################################### # Utils ############################################################################### @@ -14,7 +19,7 @@ function __budspencer_git_status -d "Check git status" set -l unmerged 0 set -l untracked 0 set -l git_status (command git status --porcelain ^/dev/null) - for i in (seq 1 (count $git_status)) + for i in (seq (count $git_status)) echo $git_status[$i] | egrep "^[ACDMT][\ MT]\ |^[ACMT]D\ " > /dev/null; and set added (math $added+1) echo $git_status[$i] | egrep "^[\ ACMRT]D\ " > /dev/null; and set deleted (math $deleted+1) echo $git_status[$i] | egrep "^.[MT]\ " > /dev/null; and set modified (math $modified+1) @@ -46,7 +51,7 @@ if set -q -x $PWDSTYLE end set pwd_style $PWDSTYLE[1] function fish_pwd_toggle_cm -d "Toggles style of pwd segment, press space bar in NORMAL or VISUAL mode" - for i in (seq 1 (count $PWDSTYLE)) + for i in (seq (count $PWDSTYLE)) if test $PWDSTYLE[$i] = $pwd_style set pwd_style $PWDSTYLE[(math $i%(count $PWDSTYLE)+1)] commandline -f repaint @@ -58,12 +63,26 @@ bind -M default ' ' fish_pwd_toggle_cm bind -M visual ' ' fish_pwd_toggle_cm function fish_cmd_duration_cm -d "Displays the elapsed time of last command" - if test (count $CMD_DURATION) -gt 0 - set -l duration (echo $CMD_DURATION | tr -d '[[:space:]]' | sed 's|\.[[:digit:]]*||') + set -l seconds "" + set -l minutes "" + set -l hours "" + set -l days "" + set -l cmd_duration (math $CMD_DURATION/1000) + if test $cmd_duration -gt 0 + set seconds (math $cmd_duration%68400%3600%60)"s" + if test $cmd_duration -ge 60 + set minutes (math $cmd_duration%68400%3600/60)"m" + if test $cmd_duration -ge 3600 + set hours (math $cmd_duration%68400/3600)"h" + if test $cmd_duration -ge 68400 + set days (math $cmd_duration/68400)"d" + end + end + end if test $last_status -ne 0 - echo -n (set_color $budspencer_colors[2])""(set_color -b $budspencer_colors[2] $budspencer_colors[7])" "$duration + echo -n (set_color $budspencer_colors[2])""(set_color -b $budspencer_colors[2] $budspencer_colors[7])" "$days$hours$minutes$seconds else - echo -n (set_color $budspencer_colors[2])""(set_color -b $budspencer_colors[2] $budspencer_colors[12])" "$duration + echo -n (set_color $budspencer_colors[2])""(set_color -b $budspencer_colors[2] $budspencer_colors[12])" "$days$hours$minutes$seconds end end end From 8713d302369824f451210163fcfb0f6209f1e814 Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Mon, 11 Aug 2014 11:43:45 +0200 Subject: [PATCH 19/20] Compatibility with emacs mode --- themes/budspencer/README.md | 17 +++++++++++++++-- themes/budspencer/fish_prompt.fish | 10 +++++++--- themes/budspencer/fish_right_prompt.fish | 18 +++++++++++------- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/themes/budspencer/README.md b/themes/budspencer/README.md index f7738e7..4a45bfe 100644 --- a/themes/budspencer/README.md +++ b/themes/budspencer/README.md @@ -1,6 +1,18 @@ # budspencer theme -Translation of zsh's prezto [budspencer theme][budspencer] +Translation of zsh's prezto [budspencer theme][budspencer]. + +## Configuration + +The theme behaves similar to vim's airline/powerline plugins. It needs a +[powerline font][font]. Although it works with emacs mode, it's more powerful +with vi mode. In order to enable vi mode, put the following lines into +`$HOME/.config/fish/config.fish` before `set fish_path $HOME/.oh-my-fish`: + +``` +set -e fish_key_bindings +set -U fish_key_bindings fish_vi_key_bindings +``` ## Left prompt segments @@ -46,8 +58,9 @@ Translation of zsh's prezto [budspencer theme][budspencer] ## TODO -- vi REPLACE mode +- vi REPLACE mode, as soon as REPLACE mode is implemented within fish [budspencer]: https://github.com/tannhuber/prezto +[font]: https://github.com/Lokaltog/powerline-fonts [ranger]: http://ranger.nongnu.org/ [screenshot]: https://raw.githubusercontent.com/tannhuber/prezto/master/screenshots/budspencer.png diff --git a/themes/budspencer/fish_prompt.fish b/themes/budspencer/fish_prompt.fish index e929cc8..d164b21 100644 --- a/themes/budspencer/fish_prompt.fish +++ b/themes/budspencer/fish_prompt.fish @@ -50,7 +50,11 @@ function fish_vi_prompt_cm -d "Displays the current mode" case default set_color -b $budspencer_colors[10] $budspencer_colors[1] echo -en $budspencer_cursors[1] - echo -n " NORMAL " + if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings" + echo -n " NORMAL " + else + echo -n " EMACS " + end set_color -b $budspencer_colors[1] $budspencer_colors[10] case insert set_color -b $budspencer_colors[5] $budspencer_colors[1] @@ -118,9 +122,9 @@ function fish_prompt -d "Write out the left prompt of the budspencer theme" # vi mode set -l ps_vi "" - if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings" +# if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings" set ps_vi (fish_vi_prompt_cm) - end +# end # git set -l ps_git "" diff --git a/themes/budspencer/fish_right_prompt.fish b/themes/budspencer/fish_right_prompt.fish index cee26dd..83d9692 100644 --- a/themes/budspencer/fish_right_prompt.fish +++ b/themes/budspencer/fish_right_prompt.fish @@ -43,8 +43,10 @@ function fish_git_toggle_cm -d "Toggles style of git segment, press # in NORMAL end commandline -f repaint end -bind -M default '#' fish_git_toggle_cm -bind -M visual '#' fish_git_toggle_cm +if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings" + bind -M default '#' fish_git_toggle_cm + bind -M visual '#' fish_git_toggle_cm +end if set -q -x $PWDSTYLE set -x PWDSTYLE short long none @@ -59,8 +61,10 @@ function fish_pwd_toggle_cm -d "Toggles style of pwd segment, press space bar in end end end -bind -M default ' ' fish_pwd_toggle_cm -bind -M visual ' ' fish_pwd_toggle_cm +if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings" + bind -M default ' ' fish_pwd_toggle_cm + bind -M visual ' ' fish_pwd_toggle_cm +end function fish_cmd_duration_cm -d "Displays the elapsed time of last command" set -l seconds "" @@ -225,14 +229,14 @@ function fish_right_prompt -d "Write out the right prompt of the budspencer them # git set ps_git (fish_git_prompt_cm) if test -n "$ps_git" - set ps_git (set_color $budspencer_colors[3])""(set_color -b $budspencer_colors[3])""$ps_git + set ps_git (set_color $budspencer_colors[3])""(set_color -b $budspencer_colors[3])""$ps_git(set_color -b $budspencer_colors[3] normal) end # pwd set -l ps_pwd "" - if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings" +# if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings" set ps_pwd (fish_pwd_prompt_cm) - end +# end # right prompt echo -n $ps_duration $ps_git $ps_pwd From d8ca5d14cdc93fcdabab22a8d4bc067e36f87f29 Mon Sep 17 00:00:00 2001 From: Joseph Tannhuber Date: Tue, 12 Aug 2014 10:32:39 +0200 Subject: [PATCH 20/20] Obsolete code removed --- themes/budspencer/fish_prompt.fish | 4 +--- themes/budspencer/fish_right_prompt.fish | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/themes/budspencer/fish_prompt.fish b/themes/budspencer/fish_prompt.fish index d164b21..6cd1d9f 100644 --- a/themes/budspencer/fish_prompt.fish +++ b/themes/budspencer/fish_prompt.fish @@ -122,9 +122,7 @@ function fish_prompt -d "Write out the left prompt of the budspencer theme" # vi mode set -l ps_vi "" -# if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings" - set ps_vi (fish_vi_prompt_cm) -# end + set ps_vi (fish_vi_prompt_cm) # git set -l ps_git "" diff --git a/themes/budspencer/fish_right_prompt.fish b/themes/budspencer/fish_right_prompt.fish index 83d9692..86f3619 100644 --- a/themes/budspencer/fish_right_prompt.fish +++ b/themes/budspencer/fish_right_prompt.fish @@ -234,9 +234,7 @@ function fish_right_prompt -d "Write out the right prompt of the budspencer them # pwd set -l ps_pwd "" -# if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings" - set ps_pwd (fish_pwd_prompt_cm) -# end + set ps_pwd (fish_pwd_prompt_cm) # right prompt echo -n $ps_duration $ps_git $ps_pwd