Add tmux support

This commit is contained in:
Maxim Gonchar 2014-01-20 21:28:54 +04:00
parent 777e4fe49e
commit f284f00935
2 changed files with 17 additions and 5 deletions

View file

@ -1,31 +1,43 @@
function fish_vi_cursor -d 'Set cursor shape for different vi modes' function fish_vi_cursor -d 'Set cursor shape for different vi modes'
set -l terminal $argv[1] set -l terminal $argv[1]
set -q terminal[1]; or set terminal auto set -q terminal[1]; or set terminal auto
set -l uses_echo
set fcn set fcn
switch "$terminal" switch "$terminal"
case auto case auto
if set -q KONSOLE_PROFILE_NAME if set -q KONSOLE_PROFILE_NAME
set fcn __fish_cursor_konsole set fcn __fish_cursor_konsole
set uses_echo 1
else if set -q XTERM_LOCALE else if set -q XTERM_LOCALE
set fcn __fish_cursor_xterm set fcn __fish_cursor_xterm
set uses_echo 1
else else
return 1 return 1
end end
end end
set -g fish_cursor_insert line set -l tmux_prefix
set -g fish_cursor_default block set -l tmux_postfix
set -g fish_cursor_unknown block blink 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 " 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 set -l varname fish_cursor_\$fish_bind_mode
if not set -q \$varname if not set -q \$varname
set varname fish_cursor_unknown set varname fish_cursor_unknown
end end
#echo \$varname \$\$varname #echo \$varname \$\$varname
$tmux_prefix
$fcn \$\$varname $fcn \$\$varname
$tmux_postfix
end end
" | source " | source
end end