Add $fish_force_vi_cursor variable to allow cursor setting on unsupported terminals

This commit is contained in:
LawAbidingCactus 2020-05-14 22:24:52 +02:00 committed by Johannes Altmanninger
parent a8e9f560e4
commit f71737e58a
3 changed files with 48 additions and 43 deletions

View file

@ -8,6 +8,7 @@
- Ctrl-C no longer kills background jobs for which job control is disabled, matching POSIX semantics (#6828).
- Improve Gradle completion
- Fixed `pushd`'s behavior with respect to the directory stack when given an invalid argument
- A new variable, `$fish_vi_force_cursor`, has been added. This can be set to force `fish_vi_cursor` to attempt changing the cursor shape in vi mode, regardless of terminal. Additionally, the `fish_vi_cursor` option `--force-iterm` has been deprecated; all usages can be replaced by setting `$fish_vi_force_cursor`.
- The history file is now created with user-private permissions, matching other shells (#6926). The directory containing the history file remains private, so there should not have been any private date revealed.
### Syntax changes and new commands

View file

@ -1410,6 +1410,8 @@ The ``fish_vi_cursor`` function will be used to change the cursor's shape depend
Additionally, ``blink`` can be added after each of the cursor shape parameters to set a blinking cursor in the specified shape.
If the cursor shape does not appear to be changing after setting the above variables, it's likely your terminal emulator does not support the capabilities necessary to do this. It may also be the case, however, that `fish_vi_cursor` has not detected your terminal's features correctly (for example, if you are using `tmux`). If this is the case, you can force `fish_vi_cursor` to set the cursor shape by setting `$fish_vi_force_cursor` in `config.fish`. You'll have to restart fish for any changes to take effect. If cursor shape setting remains broken after this, it's almost certainly an issue with your terminal emulator, and not fish.
.. _vi-mode-command:
Command mode

View file

@ -10,6 +10,9 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
return
end
# If this variable is set, skip all checks
if not set -q fish_vi_force_cursor
# Emacs Makes All Cursors Suck
if set -q INSIDE_EMACS
return
@ -50,13 +53,13 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
end
# HACK: Explicitly disable on ITERM because of #3696, which is weirdness with multi-line prompts.
# We allow an explicit "--force-iterm" as first argument to skip this.
# It's recommended only if you don't use a multi-line prompt.
# --force-iterm is now deprecated; set $fish_vi_force_cursor instead
if contains -- $argv[1] --force-iterm
set -e argv[1]
else if set -q ITERM_PROFILE
return
end
end
set -l terminal $argv[1]
set -q terminal[1]
@ -114,4 +117,3 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
end
" | source
end