From f5506803d795cabe1c3cbb8c15f446e4fc9ac435 Mon Sep 17 00:00:00 2001 From: Quinten Roets <62651391+quintenroets@users.noreply.github.com> Date: Tue, 14 Mar 2023 05:50:20 -0400 Subject: [PATCH] fish_vi_cursor: add new variable for external cursor mode (#9565) * add new variable for external cursor mode * fix backwards compatibility * add documentation * document change in changelog --- CHANGELOG.rst | 1 + doc_src/interactive.rst | 3 +++ share/functions/fish_vi_cursor.fish | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4a48c9e4a..3811c5c9c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -31,6 +31,7 @@ Interactive improvements - Escape during history search restores the original commandline again (regressed in 3.6.0). - Using ``--help`` on builtins now respects the $MANPAGER variable in preference to $PAGER (:issue:`9488`). - Command-specific tab completions may now offer results whose first character is a period. For example, it is now possible to tab-complete ``git add`` for files with leading periods. The default file completions hide these files, unless the token itself has a leading period (:issue:`3707`). +- A new variable, :envvar:`fish_cursor_external`, can be used to specify to cursor shape when a command is launched. When unspecified, the value defaults to the value of :envvar:`fish_cursor_default` (:issue:`4656`). New or improved bindings ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc_src/interactive.rst b/doc_src/interactive.rst index 8c9b99e13..aaddd2cfd 100644 --- a/doc_src/interactive.rst +++ b/doc_src/interactive.rst @@ -420,6 +420,9 @@ The ``fish_vi_cursor`` function will be used to change the cursor's shape depend set fish_cursor_insert line # Set the replace mode cursor to an underscore set fish_cursor_replace_one underscore + # Set the external cursor to a line. The external cursor appears when a command is started. + # The cursor shape takes the value of fish_cursor_default when fish_cursor_external is not specified. + set fish_cursor_external line # The following variable can be used to configure cursor shape in # visual mode, but due to fish_cursor_default, is redundant here set fish_cursor_visual block diff --git a/share/functions/fish_vi_cursor.fish b/share/functions/fish_vi_cursor.fish index 1ad23bc47..195a98cb1 100644 --- a/share/functions/fish_vi_cursor.fish +++ b/share/functions/fish_vi_cursor.fish @@ -92,7 +92,10 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes' echo " function fish_vi_cursor_handle_preexec --on-event fish_preexec - set -l varname fish_cursor_default + set -l varname fish_cursor_external + if not set -q \$varname + set varname fish_cursor_default + end if not set -q \$varname set varname fish_cursor_unknown end