1

I need to write a function that when executed it opens colon command and paste some stuff on to it and let user edit it before executing the command.

for example

function! EditRelativePath()

  :e expand("%")

endfunction

so i'm expecting the above code to start a prompt like

:e src/user/index.js

but it does not simply work, please advice, thanks.

3

Try this:

:call feedkeys(':e ' . expand('%'))

See :help feedkeys() for more details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.