From 7d88ea0c5f09c0737bf8e1a305b4dd8e4c4f8bb7 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Tue, 27 Oct 2020 18:00:37 +0800 Subject: [PATCH 1/2] [bugfix] git log uncolored --- fish/config/config.fish | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fish/config/config.fish b/fish/config/config.fish index d42c2b3..266f0ba 100644 --- a/fish/config/config.fish +++ b/fish/config/config.fish @@ -5,7 +5,7 @@ set -gx EDITOR nvim # enable fzf completion hotkey set -U FZF_COMPLETE 0 # no line-wrapping, good for `docker ps` -set -gx LESS "-SXF" +set -gx LESS "-SRXF" # nvm plugin set -gx nvm_mirror http://npm.taobao.org/mirrors/node # change OTHER-WRITABLE color for `ls` command @@ -14,15 +14,15 @@ set -gx LS_COLORS 'ow=34;42;40' set -gx HIGHLIGHT_OPTIONS --style=solarized-dark # tune git icon for nerdfont -set -g __fish_git_prompt_char_upstream_ahead ">" -set -g __fish_git_prompt_char_upstream_behind "<" -set -g __fish_git_prompt_char_upstream_prefix "" +set -g __fish_git_prompt_char_upstream_ahead '>' +set -g __fish_git_prompt_char_upstream_behind '<' +set -g __fish_git_prompt_char_upstream_prefix '' -set -g __fish_git_prompt_char_stagedstate "●" -set -g __fish_git_prompt_char_dirtystate "*" -set -g __fish_git_prompt_char_untrackedfiles "+" -set -g __fish_git_prompt_char_conflictedstate "x" -set -g __fish_git_prompt_char_cleanstate "✔ " +set -g __fish_git_prompt_char_stagedstate '●' +set -g __fish_git_prompt_char_dirtystate '*' +set -g __fish_git_prompt_char_untrackedfiles '+' +set -g __fish_git_prompt_char_conflictedstate 'x' +set -g __fish_git_prompt_char_cleanstate '✔ ' function append-path-if-exists if test -e $argv From 079ad36e5e8efea48f984807474dbcc6a0311b35 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Tue, 27 Oct 2020 18:00:59 +0800 Subject: [PATCH 2/2] [feature] print `$status $duration` as right prompt --- fish/config/functions/fish_right_prompt.fish | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fish/config/functions/fish_right_prompt.fish b/fish/config/functions/fish_right_prompt.fish index c10733a..7102404 100644 --- a/fish/config/functions/fish_right_prompt.fish +++ b/fish/config/functions/fish_right_prompt.fish @@ -1,11 +1,15 @@ function fish_right_prompt set s $status + set duration (math $CMD_DURATION / 1000)s + test $s -ne 0 && echo -n (set_color red) '✗' (set_color normal) + test $CMD_DURATION -gt 100 && echo -n $duration + + # send desktop notification if duration greater than 3s when window is inactive test -z $CMD_DURATION -o \( $CMD_DURATION -lt 3000 \) && return test -z $WINDOWID && return set active_window (xdotool getactivewindow 2>/dev/null) test $active_window -eq $WINDOWID && return - set duration (math $CMD_DURATION / 1000)s set message (history --max=1) [$duration] notify-send (test "$s" -ne 0 && echo '--icon' error) $message end