Introduction to Vim

Source: Internet
Author: User

Configuration

Vim $HOME/.VIMRC

Syntax on# syntax highlighting

Set nocompatible# Remove VI consistency mode

Set number# display line numbers

Set history=50# setting command History bar number

Set autoindent# Auto Align

Set smartindent# Smart Alignment

Set tabstop=4# setting Tab key to 4 spaces

Set shiftwidth=4# use 4 spaces when interlaced between rows

Use

List of common commands

Move cursor
Hjkl Front lower right Upper
C+f,c+b Move one page up or down
0,$ Move to the front and last of a line
G,ng,gg Move to last, nth, row
N Move n rows down
Search replacement
/word,?word Search down, up
N,n Repeat down and up
: n1,n2s/w1/w2/g Replace the W1 of the n1-n2 between the rows as W2
: 1, $s/w1/w2/g Replace All
Copy, paste, delete
X,x Remove one character backwards and forwards
Nx Remove n characters backwards
Dd,ndd Delete Row, row n
Yy,nyy Copy one row, n rows
P,p Paste Next and previous line
U Restore the previous action
C-r Repeat a previous action
General mode into edit mode
I,i Insert
A,a Increase
O,o New lines
R,r Substitution mode
[ESC] Exit edit mode
General mode to command mode
: w,:q,:wq,:q!,:x Save, exit
: w filename Save As
: R filename Read into the current document
:! Command Execute command
: Set Nu Show line Numbers
: Set Nonu Do not display line numbers

Brackets Match%

Introduction to Vim

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.