Download Vim and vim
From song4
Vim helps you complete text editing in a almost natural language.
You just need to get familiar with a few simple syntaxes, and then you will sit on the rotating seat and turn around, and feel the wonderful life is back.
Okay, let's get started.
Vim helps you complete text editing in a almost natural language.
You just need to get familiar with a few simple syntaxes, and then you will sit on the rotating seat and turn around, and feel the wonderful life is back.
Okay, let's get started.
Verb
Verbs represent the operations we intend to perform on the text. For example:
d
Delete)
r
Replace)
c
Change)
y
Indicates copying (yank)
v
Visual select)
Term
Nouns represent the text we are going to process. Vim has a special term called a Text object. Below are some examples of text objects:
w
Indicates a word)
s
Represents a sentence (sentence)
p
Paragraph)
t
Indicates an HTML tag)
- The text enclosed by quotation marks or brackets is called a text block.
Prepositions
The prefix defines the range or location of the text to be edited. For example:
i
Indicates "within..." (inside)
a
Indicates "surround..." (around)
t
Indicates "before the... position" ()
f
Forward)
The following are some related scopes:
Group word as sentence
With these basic language elements, we can start to construct some simple commands. The basic syntax of the text editing command is as follows:
Verb prefix noun
Below are some examples (if you are familiar with the above concepts, you will see these examples are very easy to understand), Please experiment with Vim in person.
# Delete a paragraph: delete inside paragraphdip # select a sentence: visual select inside sentencevis # modify a word: change inside wordciw # modify a word: change und wordcaw # delete text until the character "x" (excluding the character "x"): delete to xdtx # delete text until the character "x" (including the character "x "): delete forward xdfx
Number words
A number word specifies the number of text objects to be edited. From this perspective, a number word can also be considered as a prefix. After several words are introduced, the syntax of the text editing command is upgraded to the following:
Verb prefix/count term
The following are examples:
# Modify three words: change three wordsc3w # delete two words: delete two wordsd2w
In addition, the number word can also modify the verb, indicating that the operation is executed n times. So we have the following syntax:
Number word Verb noun
See the example:
# Delete a word twice (equivalent to deleting two words): twice delete word2dw # delete three characters (equivalent to deleting three characters): three times delete character3x