Vim search method for Linux, display line number

insert image description here

Method 1 : Quick search (exact string match, case sensitive)

Format: / + keyword or ? + keywords

/content #press enter to search top-to-bottom
?content#press enter to search bottom-to-top

Advantages: quickly locate the keyword

After pressing Enter, press n to search for the next occurrence of matching results, and press uppercase N to reverse search for the next occurrence of matching results.

Method 2 : Whole word search

Format: / + < + keywords + >

/<Iden>

After pressing Enter, press # to search forward, or * to search backward.

Method 3 : Search History

Format: / + up and down arrow keys

press enter after selection
insert image description here

Method 4 : Case Sensitive

By default, searches are case sensitive. Searching for "YES" will not match "yes".

To ignore case, enter :set ignorecase or :set ic on the Vim command line. You can also add a default option to ignore case in your ~/.vimrc file.

To change it back to case-sensitive, enter :set noignorecase or :set noic.

Another way to enforce case ignorance is to add \c after the search pattern.
For example, /Linux\c will ignore case sensitivity when searching. Adding an uppercase \C after the search pattern enforces case sensitivity.

insert image description here
insert image description here
> :set nu # display line numbers
insert image description here

Guess you like

Origin blog.csdn.net/u013400314/article/details/131973253