Vim tips (In fact, the use of methods, may know less than the number of people)

Source: Internet
Author: User

The following no special instructions are in command-line mode

1: Turn line numbers on and off

After pressing the Escape key to enter command mode,

: Set number command to turn on line numbers

expand: Enter command mode to &NBSP: set all   command displays a list of options and settings.

2: Turn auto indent on and off

Open: Set Autoident

OFF: Set noautoident//shorthand (: Set AI and: Set Noai)

If you enter a space or tab at the beginning of a line, subsequent new rows are indented to the same position. In command mode, enter:set  autoindent, and then press ENTER to turn on automatic indentation. By settingshiftwidthdetermines the indentation level. For example:set  shiftwidth=4set each level indent to four spaces. In command mode, you can use >> commands to add one level of indentation to an existing line, and use << commands to reduce one-level indentation. By adding an integer to these commands, you can increase or decrease the one-level indentation for multiple lines.

3: Case-sensitive problem when searching

Case-sensitive: set ignorecase

  不区分大小写 :set noignorecase//Shorthand (:set icand the:set noic )

3: Compound search

      You can use a simple regular expression to specify that the search keyword contains a word and that the word is followed by another word.

eg:想要找one关键字,在该词后面有0个或者多个更多字符,之后是字符串two的那一行。就写成 /one.*two 然后一敲回车光标就会锁定找到有该两个关键字的第一行,按下n就会找到含有这两个关键字的第二行。前提是这俩个字符串只在一行,才会匹配成功。如果不需要在一行的话,只需要把"."(点)化成";"(分号)即可。对于寻找代码中出现在另一个命令后面的某个命令非常有用,比如在设置某个变量之后调用函数的地方。

This article is from the "Du Qiu _rain" blog, be sure to keep this source http://duqiu.blog.51cto.com/3345942/1576069

Vim tips (In fact, the use of methods, may know less than the number of people)

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.