diff options
author | Maxim Gonchar <gmaxfl@gmail.com> | 2014-01-20 21:28:54 +0400 |
---|---|---|
committer | Maxim Gonchar <gmaxfl@gmail.com> | 2014-01-20 21:28:54 +0400 |
commit | f284f0093568f37abef508d727c5550f5ae81837 (patch) | |
tree | 5742e4e1141989f706c1f221d5243d48c5ae398a /share/functions | |
parent | 777e4fe49ee752af712078ef2d2210ce39d0fc3e (diff) |
Add tmux support
Diffstat (limited to 'share/functions')
-rw-r--r-- | share/functions/__fish_cursor_konsole.fish | 2 | ||||
-rw-r--r-- | share/functions/fish_vi_cursor.fish | 20 |
2 files changed, 17 insertions, 5 deletions
diff --git a/share/functions/__fish_cursor_konsole.fish b/share/functions/__fish_cursor_konsole.fish index acdcb0de..ef7c777b 100644 --- a/share/functions/__fish_cursor_konsole.fish +++ b/share/functions/__fish_cursor_konsole.fish @@ -1,7 +1,7 @@ function __fish_cursor_konsole -d 'Set cursor (konsole)' set -l shape $argv[1] switch "$shape" - case block + case block echo -en '\e]50;CursorShape=0\x7' case underscore echo -en '\e]50;CursorShape=2\x7' diff --git a/share/functions/fish_vi_cursor.fish b/share/functions/fish_vi_cursor.fish index f8d9ccd1..b7a75d9c 100644 --- a/share/functions/fish_vi_cursor.fish +++ b/share/functions/fish_vi_cursor.fish @@ -1,31 +1,43 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes' set -l terminal $argv[1] set -q terminal[1]; or set terminal auto + set -l uses_echo set fcn switch "$terminal" case auto if set -q KONSOLE_PROFILE_NAME set fcn __fish_cursor_konsole + set uses_echo 1 else if set -q XTERM_LOCALE set fcn __fish_cursor_xterm + set uses_echo 1 else return 1 end end - set -g fish_cursor_insert line - set -g fish_cursor_default block - set -g fish_cursor_unknown block blink + set -l tmux_prefix + set -l tmux_postfix + if begin; set -q TMUX; and set -q uses_echo[1]; end + set tmux_prefix echo -ne "'\ePtmux;\e'" + set tmux_postfix echo -ne "'\e\\\\'" + end + + set -q fish_cursor_unknown + or set -g fish_cursor_unknown block blink echo " - function fish_cursor_vi_handle --on-variable fish_bind_mode + function fish_vi_cursor_handle --on-variable fish_bind_mode set -l varname fish_cursor_\$fish_bind_mode if not set -q \$varname set varname fish_cursor_unknown end #echo \$varname \$\$varname + $tmux_prefix $fcn \$\$varname + $tmux_postfix end " | source end + |