In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you what vim commands are commonly used in Linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Related commands in command line mode
1. Move the cursor
H: ← move to the left
L: move → to the right
J: ↓ move down
K: ↑ move up
Gg: move the cursor to the beginning of the file
G: move the cursor to the end of the file
0: move the cursor to the beginning of the line
$: move the cursor to the end of the line
123G: jump to line 123
two。 Delete character
X: delete one character after the cursor, which is equivalent to Del
X: delete one character before the cursor, equivalent to Backspace
Dw: deletes the word at the beginning of the cursor, including the character in which the cursor is located
The cursor must move over the first character of the deleted word
D0: delete all the contents of this line before the cursor, excluding the character in which the cursor is located
D (d$): all the contents of this line after the cursor is deleted, including the character where the cursor is located
Dd: delete the line where the cursor is located
N dd deletes the specified number of rows
It's not really deleted, it's actually cut.
3. Undo operation
U: undo step by step
Ctr-r: reverse undo
4. Copy and paste
Yy: copy the current line, n yy copy n lines
P: open a new line down the cursor and paste
P: start pasting from the line where the cursor is located
5. Visual mode
V: move by word
Use with h, j, k, l
Use y to copy the selection
6. Find operation
/ hello-> look back for hello from the cursor position
N: next
N: previous
? hello-> find the hello forward from the cursor position
N: previous
N: next
Use # on the word to be queried
7. Replace operation
R: replace the current character
8. Text line movement
> >: move the text line to the right
Replace the first abc in the current line with 123
: s/abc/123/g
-> replace all abc in the current line with 123
(2) replace all
:% s/abc/123
Replace the first abc in all lines with 123
:% s/abc/123/g
-> replace all abc in all lines with 123
(3) replace the specified row
: 10,30s/abc/123/g
-> replace all abc in lines 10-30 with 123
3. Execute the shell command
Enter in the last line mode, followed by a command
4. Split screen operation
(1) enter split screen mode
Command: sp divides the screen into two parts-- > horizontal
Command: vsp divides the screen into two parts-- > vertical
Command: sp (vsp) + file name horizontal or vertical split window displays two different files
(2) exit split mode
Command: wqall saves and exits all screens
Command: wq saves and exits the screen where the cursor is located
Ctrl+ww switches between two screens
5. Vim creates IDE
System-level profile directory: / etc/vim/vimrc
User-level profile directory: ~ / .vim/vimrc
Modify the configuration file vimrc or .vimrc
The above is all the contents of the article "what are the common vim commands in Linux?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.