As title. I want to create a function that facilitate this behaviour. I have tried this but it didn't work:

exe 'gv'

I tried from this direction because this works:

exe 'c!'
  • @mattb: Yes, exactly. Title updated.
    – job_start
    Jan 9 at 9:14

To run normal mode commands as ex command use :normal! as in

   normal! gv

Note, exclamation mark is for running non-mapped "built-in" functionality:

:nnoremap l :echo "hello"<CR>
" this would echo hello
:normal l
" this would move cursor right
:normal! l

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.