Vim text operations

Source: Internet
Author: User
● Large and lowercase letter Interchange
In normal mode, all ggvggu is capitalized, while all ggvggu is smaller, ggvgg ~ Is case-insensitive.
(To explain, ggvg is all selected. You can select all the other methods, or select a part)
● Remove English
: % S/\ v \ A + // G
● Remove numbers
: % S/\ v \ D + // G
● Remove both English and numbers
: % S/\ v (\ d | \ A) + // G
● Remove Spaces
: % S // G
● Only Remove trailing Spaces
: % S/\ v \ s + $ // G (Note: This is the blank at the end of the deletion, including spaces and tabs)
● Remove the "=" encoding before "="
: % S/\ V ^ [^ =] + \ = // G
● Delete empty rows
: % S/\ v \ n +/\ r/g
● Delete Chinese characters and phrases
: % S/\ V [^ \ x00-\ xFF] + // G
(Note: Vim cannot represent "Chinese characters", but can only represent "non-single-byte characters", including all Chinese characters and double-byte characters)
● Extract single words
● Extract phrases
● Extract encoded entries
● Extract unencoded entries
● Extract entries with Chinese characters
● Extract entries with English
● Extract an entry with English (excluding the English equivalent)
: G/regular expression/d Indicates deleting all rows with regular expressions
: V/regular expression/d Indicates deleting all rows without regular expressions
★"Extraction" is not easy. You can delete rows that do not meet the requirements. As an exercise, try it yourself? Use the: G or: V command. Haha

● Delete the entry with Chinese and English after "="
Simple, um
● Word code reconciliation
: % S/\ V ^ ([^ =] +) \ = (. +) $/\ 2 = \ 1/g
● Dictionary format conversion
1. Change: "Why the Emy of Computer Science":
Computer
Further
CAS
: % S // \ r/g
2. The format on the left is changed to the format on the right:
Zhuo 'zhong 'zhi' chu' highlights zzzc
Zhu'yuan 'you 'er 'belongs to syye.
Self-blame zi'yuan 'zi'yi 'self-blame zyzy
: % S/\ v (\ A) (\ A {-1,} ')/\ 1/g
● Raise and delete a specific entry, for example, "heavy"
1. Encoding
To remove a word string containing 'weight:
: G/weight/d
Method for Extracting Words Containing 'weight'
: V/heavy/D (the so-called extraction is to delete unnecessary files, so it is better to back up the original files in advance)
2. Without Encoding
To remove a word string containing 'weight:
Method for Extracting Words Containing 'weight'
★What is the difference with encoding?
● Optimization
"Yyyw highly comments on cognition of Speech"
Separated:
About yyyw
Remarks by yyyw
Yyyw Epistemology
Yyyw high rating
★Not easy ~~ I have to think about it again.
● Extract several words. The following uses two words as an example.
: V/\ V ^ ([\ x00-\ xFF] * [^ \ x00-\ xFF] [\ x00-\ xFF] *) {2} $/d
● Add "=" between the encoding and the word"
★How to distinguish them?
● Delete Related Phrases
1. Delete All "two-character" phrases with "starting with" word ".
: G/\ v \ =/d
2. Delete the phrase "two words" after the word ends
: G/$/d

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.