Text Editor Vim--linix system Essays (v)

Source: Internet
Author: User
Tags directory create

①vim Common Operations
www.vim.org
1. Vim Working mode
Enter VI filename
exit Input: Wq
edit Mode Command (: Input later): Set NU Displays line number
Insert mode i/a/o
Command mode
Insert mode (ESC returns command mode)
edit mode:
2. Insert Command
a specifier insert in the word cursor
A at the end of the line where the cursor is inserted
I match either insert in the word cursor
I Insert at the beginning of the line where the cursor
o Insert a new line under the cursor
O Insert a new line on the cursor
3. Positioning commands
: Set Nu sets line number
: Set Nonu cancel line number
GG to First line
G to last line
NG to Nth row
: N to Nth Row
$ move to end of line
0 Move to the beginning of the line
3. Delete command
x Delete the character at cursor location
NX removes the n characters after the cursor is located
DD Delete Row of cursor, NDD delete n rows
DG deletes the line from the cursor to the end of the file
D Delete the cursor at the end of the line
: n1,n2d Deletes a specified range of rows
4. Copy and cut commands
yy copy Current line
Nyy Copy the current row following n rows
DD cuts the current line
NDD cuts the current row following n rows
p, p pasted under the current cursor row or line
5. Replace and Cancel commands
R replaces the character at which the cursor is located
R replaces the character at the beginning of the cursor and presses ESC to end
u cancel the previous action
6. Search and search replacement commands
/string searching for a specified string
: Set IC searches for specified string (ignoring case)
: Set Noic search for specified string (case not ignored)
n searches for the next occurrence of the specified string
:%s/old/new/g Full text Replace specified string
: n1,n2s/old/new/g replaces specified string within a certain range
/ C for a replacement to be confirmed
7. Save and Exit Commands
: w Save changes
: W new_filename Save as specified file
: Wq Save changes and exit
ZZ shortcut keys, save changes and exit
: q! Do not save changes and exit
: wq! Save changes and exit (file owner and root can be used)
②vim tips for use
#导入文件内容
: R file name
#导入命令执行结果
: R! Command
#定义快捷键
: Map shortcut Trigger command
Example:: Map ^p (ctrl+p) i#<esc>
: Map ^b (ctrl+b) 0x
#连续行注释
: n1,n2s/^/#/g ^ Indicates the beginning of the line
: n1,n2s/^#//g
: n1,n2s/^/\/\//g
#替换
: AB Text1 text2 (define input Text1 return auto-replace to Text2)
* Save: Home directory create. vimrc file, save common shortcut commands

Text Editor Vim--linix system Essays (v)

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.