Is there any way to make the special symbol %
work with path names on the command line? For instance, I'd like to do:
:diffsplit Path\to\other\directory\%
So that I can do a @:
to quickly compare files of the same name. However, this just opens up a new buffer called %
.
Of course I could do:
:exe 'diffsplit Path\to\other\directory\'.expand('%')
But this is cumbersome as I can't tab complete directories when typing the command.
Is there any other better way to do this?
Here's a related question, but it doesn't address my situation exactly.
Edit: Just to clarify, I would like to be able to re-use the command exactly for different files. So a solution that simply autofills the current file in the command line will not work. The same command needs to work for different file names.
%
, it will fill to the filename, but then when I want to reuse that line, the old filename will still be present. I would like the % to dynamically insert the current filename, whatever that happens to be at the time without having to retype it.:diffsplit Path/to/other/directory/%:t