In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the knowledge of "how to use vim to handle character case conversion". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Usually, we often encounter the problem of case conversion when writing programs. Vim provides many very convenient case conversion commands, which can quickly convert letters, words and arbitrary lines, and can be used in combination with vim cursor movement instructions.
~ change the case of the letters under the cursor
3 ~ change the case of the three letters at the beginning of the cursor
Change the case of the letters on the current line
U changes all letters selected in visual mode to uppercase letters
U changes all letters selected in visual mode to lowercase
GUU changes the letters of the current line to uppercase
3gUU changes the letters from the cursor to the following three lines to uppercase
Guu changes all the letters on the current line to lowercase
GUw changes the words under the cursor to uppercase.
Guw changes the words under the cursor to lowercase.
The command for case conversion in vim is
Gu or gU
A more vivid explanation is that small u means lowercase; large U means uppercase.
The rest is the qualification of these two commands (lines, letters, words) of the operation, etc.
1. The whole article is converted from uppercase to lowercase.
After you open the file, you do not need to enter command line mode. Type: ggguG
Explain: ggguG is divided into three segments of ggguG
Gg= cursor to the first character of the file
Gu= lowercase the selected range
G = to the end of the file
2. Convert the whole article from lowercase to uppercase
After you open the file, you do not need to enter command line mode. Type: gggUG
Explain: gggUG is divided into three segments of gggUG
Gg= cursor to the first character of the file
GU= capitalizes the selection
G = to the end of the file
3. Convert only one word
Guw 、 gue
GUw 、 gUe
In this way, the words behind the cursor are converted to lowercase
The command to convert five words is as follows:
Gu5w 、 gu5e
GU5w 、 gU5e
4. Convert the case of several lines
Position the cursor over the line you want to convert, and type: 1gU converts lowercase to uppercase from the cursor line to the next line
10gU, 11 lines of lowercase to uppercase conversion
And so on, there are other case conversion commands
GU0: changes to uppercase from the position of the cursor to the beginning of the line
GU$: changes to uppercase from the cursor position to the end of the line
GUG: from the cursor position to the last character of the article, it becomes uppercase.
GU1G: from the cursor position to the first character of the article, it becomes uppercase.
-
This is the end of the content of "how to use vim to handle character case conversion". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.