2

In Visual mode, after selecting text, the u key will convert the selection to all-lowercase. This is a problem as my camelCase text silently gets changed to lowercase, and I don't realize that it happened until it's no longer helpful to undo. I want to unmap this behavior, but because it's a built-in command I can't seem to figure out how to do it.

4
  • 3
    We will be better able to help you if you can show us some sample input, what you have already tried, the current output, and your desired output. In other words, we need to see what you already have, and what you would like to happen instead.
    – mypetlion
    Commented Aug 29, 2019 at 16:57
  • 1
    vmap u <nop> Also read :h map.
    – Matt
    Commented Aug 29, 2019 at 17:08
  • 1
    Possible duplicate of Disable lower case keymap in Vim
    – phd
    Commented Aug 29, 2019 at 19:57
  • stackoverflow.com/search?q=%5Bvim%5D+unmap+u
    – phd
    Commented Aug 29, 2019 at 19:57

1 Answer 1

8

As it's an internal mapping, you won't be able to unbind the combo; however, you can remap it to a <Nop> so that the keypress does nothing. You can do this with the following command:

:map u <Nop>

Or, if you want it to apply to visual mode only (recommended, since u in normal mode is the undo action), you would run this command:

:vmap u <Nop>

If the above commands produce results you want, you can add one to your .vimrc file (usually found in ~/.vimrc) to make the setting permanent. For additional reading, I would look at this answer to look which exact remap option to add.

0

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.