In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
vim: upgraded version of vi
Supported modes: general mode, edit mode, command mode
Install vim:
[root@localhost ~]# yum -y install vim-enhanced
Operation of vim in general mode:
Move cursor up: arrow keys up or k
Move the cursor down: arrow keys down or j
Move the cursor to the left: arrow keys left or h
Move the cursor to the right: arrow keys right or l (lowercase L)
Move up 5 lines: 5+ arrow keys up or 5+k
Move down 3 lines: 3+ arrow keys down or 3+j
Move 6 characters to the left: 6+ arrow keys left or 6+h
Move 8 characters to the right: 8+ arrow keys right or 8+l (lowercase L)
Page Down: Ctrl+B or Page Down
Page Up: Ctrl+F or Page Up
Move the cursor to the beginning of the line: 0 or shift+6
Move the cursor to the end of the line: shift+4
Move cursor to first line (first line of text): gg
Move cursor to last line (last line of text): G
Move the cursor to line n: number n+G or number n+shift+g
Copy current row: yy
Copy the current row and the next n rows: number n+yy
Cut current row: dd
Cut current line and next n lines: number n+dd
Paste to the next line from the current line: p
Paste to the previous line: P or shift+p
Undo operation: u (forward undo, equivalent to Windows ctrl+z, when u accidentally press more can use ctrl+r backward undo)
Delete (cut) one character backwards: x
Remove (cut) one character forward: X or shift+x
Paste to the back of the current cursor: p
Paste in front of the current cursor: P or shift+p
Visual operation: v (select the document area to be operated from the current position of the cursor, which is equivalent to selecting a section of content with the mouse. After the selected content, input gU to upper case, and input gu to lower case)
Save and Exit: ZZ
Operation in vim editing mode:
i: Enter edit mode before cursor position
I or shift+i: enter edit mode from the beginning of the line where the cursor is located
a: Enter edit mode from the cursor position
A or shift+a: enter edit mode from the end of the line where the cursor is located
o: Insert a new line below the cursor position
O: Insert a new row above the cursor position
ESC: Exit Edit Mode
Operation in vim command line mode:
/word: search for the string word down, press n to find the next string word, shift+n or N to find up
? word: search up the string word, press n to find the previous string word, shift+n or N to find down
:1,10s/word/test/g: Replace the string word with test in lines 1 to 10, without adding g to replace the first word in each line
:1,\$s/word/test/g: Replace the full-text string word with test without adding g to replace the first word in each line
Replace content with path: use the disambiguation\or #,@ symbols
:1,$s/\/etc\/passwd/\/tmp\/test.txt/g
:1,$s#/etc/passwd#/tmp/test.txt#g
:1,$s@/etc/passwd@/tmp/test.txt@g
:w Save
:wq Save and exit
:w! doc saving
:wq! Force save and exit
:q Cancel modification and exit
:q! Force cancel modification and exit
:set nu Display line numbers
:set nonu Do not display line numbers
:nohl Unhighlight
:x Save Exit (when the file content has been modified, the same effect as:wq, if the file has not been modified, using:wq Save Exit will modify the file mtime, but:x will not)
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.