n VIM Command

How to use n Command in Linux VIM editor?

Explanation


n stands for next occurrence
n command is used to find the next occurrence of searched string. After a string is searched the cursor will be focused on the first occurrence of the string, to move the cursor to the next occurrence we can use this command.

Usage:

n

Example:

  • Open the file test.txt using the command
    $ vim test.txt
  • We can notice the following text in the file.
    Hiox India Vim Tutorial Hscripts
    India is seventh largest country in world
    I love India, I'm proud to be an Indian

  • Search of letter India is done using this command
    Enter /India
  • The cursor will point to the first occurrence of the string from the current position.
    n Vim Command
  • To move the cursor to the next occurrence
    Press n
    Find Next Occurrence of Searched String Vim

Ask Questions

Ask Question