Avoiding the "Hit ENTER to continue" prompts
From Vim Tips Wiki
Tip 16 • Previous Tip • Next Tip
Created: February 24, 2001 Complexity: basic Author: Yegappan Minimum version: 5.7 Karma: 33/20 Imported from: Tip#16
The "Hit ENTER to continue" prompt is displayed when Vim is about to redraw the screen, but there's text on the screen that you might need to read. This happens when something is displayed on the status line that is wider than the window, and after executing an external command.
To reduce how often you see the "Hit ENTER to continue" prompt, you can shorten the messages, increase the space for displaying messages, or even tell Vim not to worry about external command output.
To decrease message size, use the 'shortmess' option. Add the following line to your vimrc:
:set shortmess=a
This will use abbreviations for status messages to make lines shorter. (There are several other flags for 'shortmess' that can shorten messages even more. :help 'shortmess')
To give more space for displaying messages, you can increase the height of the command line to 2 or greater:
:set cmdheight=2
The default command height is 1. Increasing cmdheight will allow more room for commands, although it will take some space away from editing.
Finally, you can use :silent to keep external commands from triggering the "Hit ENTER" prompt:
:silent !echo Hello
If the command generates any output, you may need to manually refresh the screen once you return to Vim (by typing Ctrl-L or entering :redraw!). (If you're running a GUI version of Vim, :silent may keep you from seeing any output from the command at all!)
[edit] See also
- Execute external programs asynchronously under Windows for the "Hit any key to close this window..." prompt under Windows
[edit] References
[edit] Comments
Categories: VimTip | Options | Usage
