In an unusual state, I want to ensure that a user sees a warning message upon startup, and presses a key to continue.
I could use sleep <seconds>
, but I'm sure that vim
can do this. Go vim!
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityinputdialog('Press any key to continue')
for GUI.
Sep 27, 2016 at 6:27
getchar()
function. I could update my answer, but I think it is more fair to mark Ingo's answer as correct.
Sep 27, 2016 at 13:09
:call confirm('My warning here')
; this uses a popup window in GVIM.:call getchar()
.:call input('Press enter to continue')
Many people would consider such mandatory interrupt bad user experience. I don't know about your exact use case, but in general, I would just :autocmd VimEnter * echoerr 'Houston, we have a problem'
. If the user somehow didn't see the message, :messages
will recall them.