Vim Case Conversion Command

Source: Internet
Author: User

The command for case conversion in Vim is
<blockquote>gu or gu</blockquote>
The explanation of the image is that small u means lowercase; big u means capitalization.

All that is left is the qualification of the two commands (the line, the letter, the word), etc.
<ol>
<li> whole article capitalization converted to lowercase
When you open a file, you do not need to enter command line mode.
<blockquote> type:gggug</blockquote>
Explain: Gggug divided into three sections gg gu G
<strong>gg</strong>= cursor to the first character of the file
<strong>gu</strong>= the selected range all lowercase
<strong>g</strong>= to file End </li>
<li> whole article lowercase converted to uppercase
When you open a file, you do not need to enter command line mode.
<blockquote> type:gggug</blockquote>
Explain: Gggug divided into three sections GG GU G
<strong>gg</strong>= cursor to the first character of the file
<strong>gu</strong>= all uppercase in the selected range
<strong>g</strong>= to file End </li>
<li> convert only one word
<blockquote>
GUW, GUE
GUW, GUE
</blockquote>


The words that follow the cursor are then converted to uppercase and lowercase.
The command to convert 5 words is as follows:
<blockquote>
gu5w, gu5e
gu5w, gu5e
</blockquote>
</li>
<li> converting a few lines of casing
Position the cursor on the line you want to convert,
<strong>1gU</strong> lowercase to uppercase conversions from the line down the cursor
<strong>10gu</strong>: 11 lines lowercase to uppercase conversions
And so on, there are other uppercase and lowercase conversion commands
<strong>gU0</strong>: From the position of the cursor to the beginning of the line, it becomes uppercase
<strong>gU$</strong>: From the cursor position to the end of the line, it becomes uppercase
<strong>gUG</strong>: From the cursor position to the last character of the article, all uppercase
<strong>gU1G</strong>: From the cursor position to the first character of the article, all uppercase
</li>

</ol>

Summary:


<blockquote>

~ Change the case of the letter under the cursor

3~ 3 letters starting at the cursor position to change their case

g~~ change the case of the current line letter

U Change the selected letter in visual mode to uppercase

U change the selected letter in visual mode to lowercase

GUU change the current line's letter to uppercase

Guu change the letter of the current line all to lowercase

3gUU starts from the cursor to the following 3 lines of letters to uppercase

Guw the word under the cursor to uppercase.

Guw Change the word below the cursor to lowercase.

</blockquote>

Vim Case Conversion Command

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.