Learn the Vi/vim operation of Linux system from the zero start

Source: Internet
Author: User


Vi/vim:
Edit Mode <-:--Command mode--a, I, o A, I, o-> insert mode
Set line number: Set Nu:set Nonu
Line number move: GG G ng/:n
Mobile: H, J, K, L 0 $ H, M, L
Search:
/"Characters searched" n Next n ignored case: Set IC
Copy yy/y Nyy/ny
Cut dd ndd Paste p/p
Replace:
R R + ESC
Full-text replacement of the specified string:%s/old/new/g:%s/old/new/c
N1 to N2 line range replace specified string: n1,n2s/old/new/g: n1,n2s/old/new/c
Delete: x NX dd NDD DG d:n1,n2d
Undo U
Save exit:
: wq! Only root and file owners can have no cross-w permissions, so use

Import File: R file name
Execute command:! Command name
Import + command: R!date effect is import date
Define shortcut keys:: Map Ctrl+p i#<esc> at the beginning of the line plus #
: Map ctrl+b 0x to remove characters from the beginning of the line
: Unmap
Replace:

: AB AA bb changes aa to BB

: Unab AA

Permanent modification:
Modify the default configuration file for VI: Home directory under Users/home
VI ~/.VIMRC VI ROOT/.VIMRC

Learn the Vi/vim operation of Linux system from the zero start

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.