2014-01-20 14:19:41 +08:00
|
|
|
function fish_vi_cursor -d 'Set cursor shape for different vi modes'
|
2023-11-15 01:09:04 +08:00
|
|
|
# if stdin is not a tty, there is effectively no bind mode.
|
|
|
|
if not test -t 0
|
2018-06-02 02:26:54 +08:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2016-05-30 22:36:25 +08:00
|
|
|
set -q fish_cursor_unknown
|
2022-06-07 20:25:03 +08:00
|
|
|
or set -g fish_cursor_unknown block
|
2014-01-20 20:07:32 +08:00
|
|
|
|
2024-10-26 04:47:20 +08:00
|
|
|
function __fish_vi_cursor --argument-names varname
|
|
|
|
if not set -q $varname
|
|
|
|
set varname fish_cursor_unknown
|
|
|
|
end
|
|
|
|
__fish_cursor_xterm $$varname
|
|
|
|
end
|
|
|
|
|
|
|
|
function fish_vi_cursor_handle --on-variable fish_bind_mode --on-event fish_postexec --on-event fish_focus_in --on-event fish_read
|
|
|
|
__fish_vi_cursor fish_cursor_$fish_bind_mode
|
|
|
|
end
|
2016-09-05 07:20:12 +08:00
|
|
|
|
2024-10-26 13:01:00 +08:00
|
|
|
function fish_vi_cursor_handle_preexec --on-event fish_preexec --on-event fish_exit
|
2024-10-26 04:47:20 +08:00
|
|
|
set -l varname fish_cursor_external
|
|
|
|
if not set -q \$varname
|
|
|
|
set varname fish_cursor_default
|
|
|
|
end
|
|
|
|
__fish_vi_cursor $varname
|
|
|
|
end
|
2014-01-20 14:19:41 +08:00
|
|
|
end
|