6

As title. What does the abbreviation 'x' mean in NeoVim? I just saw people setting up keymap.set with this abbreviation.

1 Answer 1

19

There are two modes often confused as one:

  • :h Visual-mode
  • :h Select-mode

The indicator or prefix used in keymaps for these modes are:

  • :h mapmode-x: activated only in visual mode
  • :h mapmode-s: activated only in select mode
  • :h mapmode-v: activated in both visual and select mode

The difference between select-mode and visual-mode can be found in :h Select-mode. As for the keymap distinction, vim suggests the following in :h mapmode-x:

NOTE: Mapping a printable character in Select mode [mapmode-v] may confuse the user. It's better to explicitly use :xmap and :smap for printable characters.


TL;DR: When in doubt, use strictly visual-mode and mapmode-x.

1
  • 3
    I just changed every occurrence of 'v's in my neovim's config. Thanks for the careful-minded answer! Commented Oct 13, 2022 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.