From 4abebb49ebe999a495500557d940da1a2075d246 Mon Sep 17 00:00:00 2001 From: Philip Wellnitz Date: Thu, 10 Oct 2019 18:36:48 +0900 Subject: [PATCH] Fix #2013; Improve fish binding (#2029) * fix fish resize squid * fix fish vi squid --- powerline/bindings/fish/powerline-setup.fish | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/powerline/bindings/fish/powerline-setup.fish b/powerline/bindings/fish/powerline-setup.fish index 3887138f..f5d02d6c 100644 --- a/powerline/bindings/fish/powerline-setup.fish +++ b/powerline/bindings/fish/powerline-setup.fish @@ -1,5 +1,5 @@ function powerline-setup - function _powerline_columns_fallback + function _powerline_columns if which stty >/dev/null if stty size >/dev/null stty size | cut -d' ' -f2 @@ -10,17 +10,6 @@ function powerline-setup return 0 end - function _powerline_columns - # Hack: `test "" -eq 0` is true, as well as `test 0 -eq 0` - # Note: at fish startup `$COLUMNS` is equal to zero, meaning that it may - # not be used. - if test "$COLUMNS" -eq 0 - _powerline_columns_fallback - else - echo "$COLUMNS" - end - end - if test -z "$POWERLINE_CONFIG_COMMAND" if which powerline-config >/dev/null set -g POWERLINE_CONFIG_COMMAND powerline-config @@ -44,7 +33,7 @@ function powerline-setup set -l addargs "--last-exit-code=\$status" set -l addargs "$addargs --last-pipe-status=\$status" set -l addargs "$addargs --jobnum=(jobs -p | wc -l)" - # One random value has an 1/32767 = 0.0031% probability of having + # One random value has an 1/32767 = 0.0031% probability of having # the same value in two shells set -l addargs "$addargs --renderer-arg=client_id="(random) set -l addargs "$addargs --width=\$_POWERLINE_COLUMNS" @@ -70,6 +59,8 @@ function powerline-setup env \$POWERLINE_COMMAND $POWERLINE_COMMAND_ARGS shell right $addargs $rpromptpast end + function fish_mode_prompt + end function _powerline_set_columns --on-signal WINCH set -g _POWERLINE_COLUMNS $columnsexpr end