I have the following lines in my vimrc:
command -nargs=1 Compare call Compare(<f-args>)
function Compare(file)
execute "vnew " . a:file
setlocal nomodifiable
wincmd h
endfunction
It immutably opens a given file in a new window strictly for reference. This works perfectly for me (though I am open to suggestions to improve it).
What I'd like to add is the ability to Tab autocomplete files, like with other commands that take files like :e
or :vnew
. All that does right now is type ^I
(I have nocompatible
set, so that's not an issue).
I've done some looking around, but I haven't found a way that would work with just Tab. cmdline-completion
, wildchar
, and wildmode
don't seem to have the answer I'm looking for.
Is there a way to tell Vim that the command should expect a file or otherwise enable Tab completion here?