'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?
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | romainl |
