Reputation: 5716
I know :cd %:p:h
will change the working directory to the dir for current editing file. But what's the magic in %:p:h
?
Upvotes: 28
Views: 12991
Reputation: 5716
From http://vimdoc.sourceforge.net/htmldoc/cmdline.html#filename-modifiers,
:p Make file name a full path.
:h Head of the file name (the last component and any separators removed)
Upvotes: 29