6

xmap creates a mapping for just Visual mode whereas vmap creates one for both Visual mode and Select mode.

As far as I understand, the intent of Select mode was to make Vim behave just like every other non-modal editor when text is selected, i.e., typing anything immediately replaces the selection with the typed text.

It seems to me that you would almost NEVER want to map anything in Select mode because in Select mode you would want your typed text to appear literally as if you were in Insert mode.

So I'm leaning towards using xmap instead of vmap in all of my mappings. Is this a good/bad idea?

8

Indeed prefer mappings to visual-mode only, in particular keys that could be displayed. Things like <F1>, <m-left> could usually be mapped with :vmap with no harm done.

Select-mode is used when setting Vim in other-editor-like mode (see the infamous mswin.vim). Select-mode is also used by all snippet plugins. When we jump to a placeholder, we end up in select-mode. That's why it's important to not map things that could be legitimately inserted in insert-mode or in select-mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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