If I open a file with vim dir/to/my/file.c how can I easily open the directory dir/to/my in vim's filebrowser?
|
feedback
|
|
What's wrong with
| |||
|
feedback
|
|
As already mentioned, you can just do ":Explore" and it will open the file explorer for the directory of the current file. However, if you need to explicitly specify the directory, you can use ctrl+r on the :-command line to read the contents of any register in, and the % register is the current filename, including a path if necessary. So, just do :e ctrl+r% then backspace over the filename, and press enter. There are other ways to do it, but this is the method I usually use. | |||
feedback
|
|
I personally prefer the:
command. It does the split window for you, and drops you into the current directory.
works too. | |||
|
feedback
|
|
If you edit with the
This will not work like you want it if you did a | ||||
|
feedback
|
|
:e dir/to/my/ :e . opens the directory you initially launched vim from. Vim browser 'c' sets the working directory. I'm not sure if there is a way to automatically jump to the directory of the file you are editing. | |||
|
feedback
|
dirname expands to the directory in which current file is. | |||
|
feedback
|