Vim: how to make the text I've just typed uppercase?

The motion you're looking for is:

`[

(backtick, open-square-bracket). To do a simple motion, you'd use:

gU`[

However, you'll find that the last character probably won't be included due to the way the motion works (I could be wrong). A simple solution would then be to do:

v`[U

Which is to say "go to visual mode, select from the current position to the start of the last changed text, make it upper case". For more information, see:

:help '[
:help mark-motions

Note the difference in :help mark-motions between a backtick and a single-quote.


Type the word in the lower case in the vim.

Then press Esc key.

Then move the cursor to starting character of the typed words.

Then press the ~ key.

It will replace the lower case to upper case.

If the input is upper case it will replace the lower case.


You can also use the "inner word" motion along with gU

After typing a word press <Esc> and type gUiw. This should work without having to switch to visual mode.

Tags:

Vim

Uppercase