Reputation: 35
I have created a simple user-defined command using the following vim script
command! -nargs=* -complete=file EE :call EE(<f-args>)
function! EE(...)
if filereadable(expand(a:1))
exec 'edit ' . a:1
endif
endfunction
:EE file
will open a file (like the built-in command ":edit file
)
But unlike :tab edit file
the command :tab EE file
will not open a new tab.
Is it possible to enhance the script so that a "prefix" like :tab
or :vert
could be used?
Upvotes: 1
Views: 225
Reputation: 172540
No, unfortunately, the prefix command isn't exposed to custom commands; it would be great to have a v:prefixcommand
variable that one could evaluate.
You so far have to write separate alternative commands, e.g. :TEE
for :tab EE
.
Upvotes: 1