Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the first uppercase letter of a word in vim?

Tags:

vim

e. g.
applicatonLoader
unixHater

I want to find 'L' in applicationLoader,
or 'H' in unixHater.

like image 547
liaogang Avatar asked Sep 24 '14 03:09

liaogang


People also ask

How do I change the default case of text in Vim?

With the following (for example, in vimrc ), you can visually select text then press ~ to convert the text to UPPER CASE, then to lower case, then to Title Case. Keep pressing ~ until you get the case you want.

How do you type uppercase and lowercase on a keyboard?

Alternatively, you can visually select text then press ~ to toggle case, or U to convert to uppercase, or u to convert to lowercase. Toggle case of the character under the cursor, or all visually-selected characters. Toggle case of the next three characters. Toggle case of the next three words.

How do you capitalize the first letter of a word?

Capitalize the first letter of the first word. It's also worth noting the ~ command, which switches the case of the character under the cursor, and the gU operator which converts to uppercase across the given motion. Example: gUl converts the current character to uppercase (or leaves it uppercase if it is already)

How do you know if a string is uppercase or lowercase?

Every character of a string is represented by a unique number using UTF-16 character encoding. For English capital letters: A = 65 and Z = 90. If the first letter's character code falls in this range, we know it's upper case:


1 Answers

You could search for \u:

/\u

Then use n to jump to the next occurrence. Note that this matches all capitals, not just the first in the word.

Edit: If you only want to jump to the first Capital in words, such as the E in oneExampleCase and skip the rest in the word, you could search for:

/\u\w*
like image 134
Caek Avatar answered Sep 17 '22 02:09

Caek