Vim Tips Wiki

Use :next to search for files in the current directory

Redirected from VimTip1535

1,623pages on
this wiki
Add New Page
Add New Page Talk0
Tip 1535 Printable Monobook Previous Next

created 2007 · complexity basic · author Yaojg · version 7.0

Vim's find only accepts exact file names. It does not accept wild chars like * and **.

:next is good way to search for files in the current directory.

For example, if the current directory is d:/vim/reason,

:next **/*

searchs all the files in d:/vim directory recursively to find files whose names are suffixed with

:help :next



  • Explain the point of this tip, as opposed to using other tools that may be more suited to the task.
  • Can the built-in :Explore command be used?
  • Shouldn't the help be to :next_f rather than :next?
  • The "for example" is unnecessarily confusing. There is no reason to have an example with "vim" in the path. Also, delete the "d:" – it serves no purpose.
  • Does the command really search the parent directory like the words suggest?

Is there a way to make it search the full path, and not just current directory?

Rough merge in of material by User talk:Chuck ForbishEdit

I use the following mappings to iterate through files in my argument list (:args).

nmap <c-right> :n<CR>
nmap <c-left> :N<CR>

Using control and an arrow key is much faster than typing ':cn<CR>'.

Similarly you can use the up and down arrows for going back and forth for the times there is more than one matching tag.

nmap <C-Down> :tn<CR>
nmap <C-Up> :tN<CR>

These key sequences support repeating if kept pressed.

Also on Fandom

Random Wiki