1

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.