Hacker News new | ask | show | jobs
by alphard 4806 days ago
I'm using the following to expand "%%" in command mode to the full path of the current open file's directory:

  cabbr <expr> %% expand('%:p:h')
You could also use :. instead of :p to get the relative path, see :help c_% and :help filename_modifiers
1 comments

Wow, elegant. Thank you!