3 ms·
Isn't there some way of using % to open a file relative to the current one perhaps? To get the best of both worlds.
by wahnfrieden 14y ago
Isn't there some way of using % to open a file relative to the current one perhaps? To get the best of both worlds.
- micampe 14y agoI 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>
- alphard 14y agoI'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
- wahnfrieden 14y agoWow, elegant. Thank you!