0

I was used to use vimdiff and loading the compared files.

Now, on vimdiff execution, it happens:

"a" [readonly] 5454L, 269796C
"b" [readonly] 241L, 10170C
Press ENTER or type command to continue

The only configuration change is the introduction of these two autocmd instructions:

autocmd BufNewFile * call s:Function()
autocmd BufReadPre * call s:Function()

Can this be a normal behavior? Can it be a mistake of mine? Can be something depending on Vim versioning? Can the desired configuration change be combined with a straightforward vimdiff load (no ENTER key needed to continue)?

1737973
  • 159
  • 18
  • 42
  • what have you done in `s:Function()`? If you removed the two autocmd, vimdiff back to normal? – Kent Sep 26 '14 at 11:14
  • The _Function_ function is actually the _[LongLineHLToggle](http://stackoverflow.com/a/1919805/1737973)_ function. I tried removing only those two _autocmd_ instructions, and `vimdiff` got indeed back to normal. Maybe that _autocmd_ can be combined with functions, but no function mapped to a combination? – 1737973 Sep 26 '14 at 12:07

2 Answers2

3

The dreaded hit-enter prompt is usually triggered by additional :echo[msg] commands, here inside your s:Function(). Either remove them, or silence the output via :silent:

autocmd BufNewFile * silent call s:Function()
Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
1

If you want to keep whatever messages are displayed in your function, you can set your 'cmdheight' option higher to allow displaying more messages before the "hit enter" prompt appears. This, and other suggestions here: http://vim.wikia.com/wiki/Avoiding_the_"Hit_ENTER_to_continue"_prompts

Ben
  • 8,725
  • 1
  • 30
  • 48