4

When I run the following command ex:

:! some_command

It's somewhat annoying the message:

Press ENTER or type command to continue

Is there a way to automatically return to current buffer without press ENTER?

  • :help press-enter – romainl May 21 '16 at 16:18
5

A way to do this is to use the silent command:

:silent !ls

This will return to normal mode right after the command (here ls has been executed).

In the case the command produces output, you may want to force a redraw of the screen with the redraw command:

:execute "silent !ls" | redraw!

You can even create a new command that does this for you:

command! -nargs=+ Silent execute 'silent <args>' | redraw!

And use it like so:

:Silent !ls
| improve this answer | |
  • Amazing! @nobe4 – sebelk May 22 '16 at 15:11

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