mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 04:13:08 +00:00
Style fixes for fish_vi_cursor
"$fcn" [ci skip]
This commit is contained in:
parent
bb11999bf7
commit
2768d2ea06
1 changed files with 46 additions and 45 deletions
|
@ -1,50 +1,51 @@
|
|||
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 -l terminal $argv[1]
|
||||
set -q terminal[1]
|
||||
or set terminal auto
|
||||
set -l uses_echo
|
||||
|
||||
set fcn
|
||||
switch "$terminal"
|
||||
case auto
|
||||
if begin; set -q KONSOLE_PROFILE_NAME
|
||||
or set -q ITERM_PROFILE; end
|
||||
set fcn __fish_cursor_konsole
|
||||
set uses_echo 1
|
||||
else if string match -q "xterm*" -- $TERM
|
||||
set fcn __fish_cursor_xterm
|
||||
set uses_echo 1
|
||||
else
|
||||
return 1
|
||||
end
|
||||
case konsole
|
||||
set fcn __fish_cursor_konsole
|
||||
set uses_echo 1
|
||||
case xterm
|
||||
set fcn __fish_cursor_xterm
|
||||
set uses_echo 1
|
||||
end
|
||||
|
||||
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_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
|
||||
set -l function
|
||||
switch "$terminal"
|
||||
case auto
|
||||
if set -q KONSOLE_PROFILE_NAME
|
||||
or set -q ITERM_PROFILE
|
||||
set function __fish_cursor_konsole
|
||||
set uses_echo 1
|
||||
else if string match -q "xterm*" -- $TERM
|
||||
set function __fish_cursor_xterm
|
||||
set uses_echo 1
|
||||
else
|
||||
return 1
|
||||
end
|
||||
case konsole
|
||||
set function __fish_cursor_konsole
|
||||
set uses_echo 1
|
||||
case xterm
|
||||
set function __fish_cursor_xterm
|
||||
set uses_echo 1
|
||||
end
|
||||
#echo \$varname \$\$varname
|
||||
$tmux_prefix
|
||||
$fcn \$\$varname
|
||||
$tmux_postfix
|
||||
end
|
||||
" | source
|
||||
|
||||
set -l tmux_prefix
|
||||
set -l tmux_postfix
|
||||
if set -q TMUX
|
||||
and set -q uses_echo[1]
|
||||
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_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
|
||||
$tmux_prefix
|
||||
$function \$\$varname
|
||||
$tmux_postfix
|
||||
end
|
||||
" | source
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue