Comment on Vim Splits – Move Faster and More NaturallyparentComments−wahnfrieden13yIsn't there some way of using % to open a file relative to the current one perhaps? To get the best of both worlds.−alphard13yI'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−wahnfrieden13yWow, elegant. Thank you!−micampe13yI use: map <leader>e :e <C-r>=expand("%:p:h") . "/" <cr> you can make one that splits: map <leader>v :vs <C-r>=expand("%:p:h") . "/" <cr>
Comments
Isn't there some way of using % to open a file relative to the current one perhaps? To get the best of both worlds.
I'm using the following to expand "%%" in command mode to the full path of the current open file's directory:
You could also use :. instead of :p to get the relative path, see :help c_% and :help filename_modifiersWow, elegant. Thank you!
I use:
you can make one that splits: