Following this Vim tip, I've made two mappings to change font size on scroll wheel:

nnoremap <C-ScrollWheelUp> :silent! let &guifont=substitute(&guifont,' \zs\d\+','\=eval(submatch(0)+1)','')<CR>
nnoremap <C-ScrollWheelDown> :silent! let &guifont=substitute(&guifont,' \zs\d\+','\=eval(submatch(0)-1)','')<CR>

But despite the <CR> at the end, on single Ctrl+Scroll I still get "Press Enter or type command to continue" message, while the command above it is echoed without the <CR>.

How can I suppress this message so that multiple successive scrolls just gradually changed the font size without need to press Enter after each scroll event?

If it matters, I'm on Linux with GTK2 GUI for gVim.

  • 3
    I don't know why the prompt appears in this particular case, but when you want to be sure that a mapping doesn't bother you with a prompt, you can use :silent! in the {rhs} like you did, and add the argument <silent> just after :nnoremap. So, it would give something like: nnoremap <silent> <C-ScrollWheelUp> :silent! let .... The difference between :silent! and <silent> is the following: :silent! makes sure the output of the command is not displayed, while <silent> makes sure the command itself is not displayed. Apr 10, 2016 at 13:36

1 Answer 1


Adding a second <CR> at the end fixes it for me. I have to admit I'm not sure why you need it, though.

  • Hmm, indeed. I'll wait a bit before accepting to allow others to post answers which could explain why the second <CR> is needed.
    – Ruslan
    Apr 9, 2016 at 19:04
  • 1
    One potential hint is that the problem does not occur if the value of guifont is empty. Apr 9, 2016 at 19:13
  • I think I know what happens: the first <CR> just finishes entering the command: without it you'll have the command typed in but not activated (you could then interactively edit it). The second one just does what the prompt requests.
    – Ruslan
    Apr 10, 2016 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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