2014-01-20 14:19:41 +08:00
|
|
|
function fish_vi_cursor -d 'Set cursor shape for different vi modes'
|
2014-01-20 21:12:32 +08:00
|
|
|
set -l terminal $argv[1]
|
|
|
|
set -q terminal[1]; or set terminal auto
|
2014-01-21 01:28:54 +08:00
|
|
|
set -l uses_echo
|
2014-01-20 14:19:41 +08:00
|
|
|
|
2014-01-20 21:12:32 +08:00
|
|
|
set fcn
|
|
|
|
switch "$terminal"
|
|
|
|
case auto
|
|
|
|
if set -q KONSOLE_PROFILE_NAME
|
|
|
|
set fcn __fish_cursor_konsole
|
2014-01-21 01:28:54 +08:00
|
|
|
set uses_echo 1
|
2014-01-20 21:12:32 +08:00
|
|
|
else if set -q XTERM_LOCALE
|
|
|
|
set fcn __fish_cursor_xterm
|
2014-01-21 01:28:54 +08:00
|
|
|
set uses_echo 1
|
2014-01-20 21:12:32 +08:00
|
|
|
else
|
|
|
|
return 1
|
|
|
|
end
|
|
|
|
end
|
2014-01-20 14:19:41 +08:00
|
|
|
|
2014-01-21 01:28:54 +08:00
|
|
|
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
|
2014-01-20 20:07:32 +08:00
|
|
|
|
2014-01-20 21:12:32 +08:00
|
|
|
echo "
|
2014-01-21 01:28:54 +08:00
|
|
|
function fish_vi_cursor_handle --on-variable fish_bind_mode
|
2014-01-20 21:12:32 +08:00
|
|
|
set -l varname fish_cursor_\$fish_bind_mode
|
|
|
|
if not set -q \$varname
|
|
|
|
set varname fish_cursor_unknown
|
|
|
|
end
|
|
|
|
#echo \$varname \$\$varname
|
2014-01-21 01:28:54 +08:00
|
|
|
$tmux_prefix
|
2014-01-20 21:12:32 +08:00
|
|
|
$fcn \$\$varname
|
2014-01-21 01:28:54 +08:00
|
|
|
$tmux_postfix
|
2014-01-20 21:12:32 +08:00
|
|
|
end
|
|
|
|
" | source
|
2014-01-20 14:19:41 +08:00
|
|
|
end
|
2014-01-21 01:28:54 +08:00
|
|
|
|