Often find I introduce errors when trying to yank, but accidentally press u instead of y.
I tried the below, but it doesn't help as that's targeting undo.
Is there a special way to remap keys when you have text selected?
nnoremap u <Nop>
Often find I introduce errors when trying to yank, but accidentally press u instead of y.
I tried the below, but it doesn't help as that's targeting undo.
Is there a special way to remap keys when you have text selected?
nnoremap u <Nop>
The right answer is
xnoremap u <Nop>
Although it is a useful action for visual mode and has it's uses so I would instead recommend you to fix your bad habits instead of remapping this key.
Also, there's a slight difference between vnoremap
and xnoremap
in that when using the v
variant (whether to map or unmap) it also does so for the special vim SELECT
mode other than VISUAL
mode, which has special use case, used specifically by templating libraries such as ultisnips, snipmate etc. In most cases you want to use x
variants to apply your mappings for this reason to restrict them to apply only for VISUAL
mode and not also for SELECT
mode.