In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
What are the practical skills of Vim? I believe many inexperienced people don't know what to do about it. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
I. the way Vim solves the problem
a. Get to know each other. Command
1.。 The command allows us to repeat the last modification, which is the most powerful generalist in vim
2.. The command is a small macro.
b. Don't repeat yourself.
1.$ move to the end of the line
2.a command to add content after the current cursor
3.A command adds content at the end of the current line, which is equivalent to $a
c. Take retreat as the near future
1.f {char} ask vim to find the location of the next specified character
2.The command repeatedly finds the characters found by the last f command
d. Execute, repeat, fallback
1.vim remembers our operations and keeps the most commonly used operations within reach, making it easy to repeat them.
2.U key to undo the last modification
3. Key reflection to find the characters found by f {char} last time.
e. Find and manually replace
1. * to search, first, the cursor will jump to the next match, and second, all the places where the word appears will be highlighted. If there is no highlight, run: set hls
The 2.cw command deletes the characters from the cursor position to the end of the audio and enters insert mode
3.n will look for the next word, and * nn will traverse all matches, thus jumping back to the starting point of this search.
f. Get to know each other. Paradigm
1. Ideal mode: move with one button and execute with another button
Second, the general mode
a. Cut the undo unit into pieces
1. In vim, we can control the granularity of the undo command ourselves. From entering insert mode to returning to normal mode, anything entered or deleted during that time is treated as a modification.
two。 Using up/down/left/right in insert mode resets the modified state
b. Construct repeatable modifications
The 1.db command deletes the content from the beginning of the cursor to the beginning of the word, but leaves the last character intact
2.x Delete the current character
3.b move the cursor to the beginning of the word
The 4.dw command deletes the entire word
5.daw deletes the entire word and associated spaces
c. Use the number of times to do simple arithmetic operations
1.yyp copy lines, cw modify characters
2.c+x, find the first number to subtract, Centra finds the first number to add.
3.vim treats numbers starting with 0 as octal, and set nrformats=, treats all numbers as decimal.
d. If you can repeat it, don't use it many times.
1. Operator + Action Command = Action
D {motion}, which can be dl, daw or dap, the scope of which is determined by action commands, c {motion}, y {motion} and other commands are similar, collectively referred to as operator
When an operator is called twice in a row, it acts on the current line. For example, dd, > >, gu exception, use guu, all lowercase
Third, insertion mode
a. Errors can be corrected instantly in insert mode
1.c+h deletes the previous character, Centrw deletes the previous word, and Centru deletes to the beginning of the line
b. Return to normal mode
1.esc, c + [switch to normal mode, Centro switch to insert-normal mode, you can execute a normal command
c. Paste the text in the register without leaving insert mode
1.yt, copy to comma text
2.c+r {register}, paste the copied text to the cursor, {register} is the name of the register you want to insert
3. {register} insert the text in the register as it is and correct any unnecessary indentation
d. Do operations anytime, anywhere
1. =
e. Insert unused characters with character encoding
1. {code}, {code} is the encoding of the characters to be inserted
2. {char1} {char2}, insert characters represented by binary letters
f. Replace existing text with replacement mode
1.R command can go from normal mode to replacement mode.
2.gR Virtual replacement Mode (Virtual Replace mode)
3. Replacement mode for single version, r {char} and gr {char}
IV. Visual mode
a. Select a highlighted selection
1.v activate character-oriented visual mode, V activate line-oriented visual mode, activate column block-oriented visual mode, and gv reselect the last highlighted selection
b. Whenever possible, it is best to use operator commands rather than visual commands
The 1.vit command can be interpreted as highlighting the contents inside the selected tag (visually select inside the tag)
two。 When a visual mode command is repeated, it affects the same amount of text
c. Edit table data in a visual mode oriented to column blocks
1. Enter column block visual mode
2. IMagol an inserts characters before and after the cursor, and iQuery An inserts at the beginning and end of the line.
Command line mode
a. Execute a command on one or more consecutive lines
1: [range] p, display and navigate to rows, you can mix and match line numbers, location markers, and lookup modes, or offset them
b. Copy and move lines using the': t 'and': m' commands
1: [range] copy {address}, copy the line of [range] to {address}, {address} is. Copy to below the current line, or blank to below [range]
two。 Abbreviations: co or: tGrayp command will use registers,: t will not
3: [range] move {address}, abbreviated: M, mobile line
c. Execute normal mode commands on a specified range
1. Rose'
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.