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. Jan 9, 2022 at 9:14

1 Answer 1


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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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