简体   繁体   中英

vim move cursor to the line that the first character is that I want?

I known there are fx and Fx to move the cursor to the next/previous x occurrence in one line.but this command is in one line.

now I want to move cursor to the next line which first character is x , is there any command the vim supply can achive this?

Try using search command by typing /^\\s*x in normal mode

/ starts forward search
^ stands for the start of a line
\\s* stands for none or some white space
x stands for x , the character you want to search

You may want read some vim help manuals first; For example:

:help /
:help usr_27
:help pattern

To find a character in next/previous line You can use j0fx to search the first occurrence of x in next line. You can use k0fx to search the first occurrence of x in previous line.

Explanation:

   j - down arrow / move one line down
   k - up arrow / move one line up 
   0 - move to first character in the current line
   fx - find the first occurrence of x in current line.

To find the character's next/previous occurence in any line

     /x
     where x is the character

Then press n to go to next occurrence of it. Press N to go to previous occurrence of it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM