yehudahs
yehudahs

Reputation: 2668

Search a file and open its folder vim

I am using silver searcher in vim. A lot of times I want to search a file BUT open its folder (to see the other files that are there). How can I do it?

Upvotes: 0

Views: 119

Answers (1)

romainl
romainl

Reputation: 196856

Unless you have a very specific workflow that you didn't disclose, ag is a red herring, here.

You can open the built-in file explorer in the parent directory of the current file with:

:Ex

You can also do:

:e %:h

because of the way Vim falls back to Netrw when you ask it to edit a directory.

See :help :Explore and its variants, as well as :help filename-modifiers for the :h bit.

Upvotes: 1

Related Questions