Capitalization conversion in Vim

Source: Internet
Author: User

Transferred from: http://www.cnblogs.com/fortran/archive/2010/07/25/1784513.html

The command of the case conversion in Vim is: Gu or Gu, the image of a little u means to lowercase, big u means to capitalize. The next step is to define the two commands (qualifying lines, letters, words) and so on.

1. Whole article capitalization converted to lowercase

When you open a file, you do not need to enter command line mode.

Type: Gggug

Explain: Gggug divided into three sections gg gu G

gg= cursor to the first character of the file

Gu= the selected range all lowercase

g= to end of file

2. Whole article lowercase converted to uppercase

When you open a file, you do not need to enter command line mode.

Type: Gggug

Explain: Gggug divided into three sections GG GU G

gg= cursor to the first character of the file

gu= all uppercase in the selected range

g= to end of file

3. Convert only one word

Guw, GUE, GUW, GUE

The words that follow the cursor are then converted to uppercase and lowercase.

The command to convert 5 words is as follows:

gu5w, gu5e, gu5w, gu5e

4, convert the case of a few lines

Position the cursor on the line you want to convert, type: 1gU

Lowercase to uppercase conversions from the line down the cursor

10gU, a 11-line lowercase to uppercase conversion

And so on, there are other uppercase and lowercase conversion commands

GU0: From the position of the cursor to the beginning of the line, it becomes uppercase

gu$: From the cursor position to the end of the line, it becomes uppercase

GUG: From the cursor position to the last character of the article, all uppercase

GU1G: From the position of the cursor to the first character of the story, it becomes uppercase

Capitalization conversion in Vim

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.