The simple and practical vim

Source: Internet
Author: User

Vim Find replacement

: n1,n2s/word1/word2/g N1,n2 is a number, find N1 to N2 line, word1 Replace with Word2
: 1, $s/word1/word2/g find the first line to the last row, word1 replace Word2
: 1, $s/word1/word2/gc find the first line to the last row, word1 replace Word2 before replacing the confirmation.

Configuration of the VIM environment

Set NU Display line number
Set Nonu suppress line number display

Set backspace=2 can be deleted with backspace key
Set Autoindent auto-shrink
Syntax on syntax detection, color display

Locale settings
Lang=zh_cn.big5 setting Traditional Chinese

Vim Quick Note #
Switch to Visual block CTRL + V Select the row to comment
Uppercase I toggle insert mode. # input #
ESC can

Using the Replace command

:% s/^/#/g To add a # comment at the beginning of the entire content

: 1,10 s/^/#/g Add # Comment at the beginning of 1~10


Multi-Window function

: SP {filename} can open multiple windows

CTRL + W + Lower
CTRL + W + Toggle windows on

The simple and practical 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.