Fandom

Vim Tips Wiki

Use :next to search for files in the current directory

1,624pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

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 **/*Filter.java

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

:help :next

CommentsEdit

 TO DO 

  • 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