2014-01-20 06:19:41 +00:00
|
|
|
function fish_vi_cursor -d 'Set cursor shape for different vi modes'
|
2023-11-14 17:09:04 +00:00
|
|
|
# if stdin is not a tty, there is effectively no bind mode.
|
|
|
|
if not test -t 0
|
2018-06-01 18:26:54 +00:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2016-05-30 14:36:25 +00:00
|
|
|
set -q fish_cursor_unknown
|
2022-06-07 12:25:03 +00:00
|
|
|
or set -g fish_cursor_unknown block
|
2014-01-20 12:07:32 +00:00
|
|
|
|
2024-10-25 20:47:20 +00: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-04 23:20:12 +00:00
|
|
|
|
2024-10-26 05:01:00 +00:00
|
|
|
function fish_vi_cursor_handle_preexec --on-event fish_preexec --on-event fish_exit
|
2024-10-25 20:47:20 +00: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 06:19:41 +00:00
|
|
|
end
|