How do I open the directory of the current open file?

Try :Ex[plore]. From :help Ex:

:Explore will open the local-directory browser on the current file's directory (or on directory [dir] if specified). The window will be split only if the file has been modified, otherwise the browsing window will take over that window. Normally the splitting is taken horizontally.


I personally prefer the:

:Sex

command. It does the split window for you, and drops you into the current directory.

:Sex dir/to/my

works too.


You could use:

:e %:h

More info on expansions is here: http://vimdoc.sourceforge.net/htmldoc/eval.html#expand()

Tags:

Vim