When creating visual mode maps, you prefix ex commands with <C-u> to clear out the range if it's unused:

:xnoremap % :<C-u>execute 'normal! gv'<Bar>call Percent_nextline()<cr>

(example from How to make a movement function work with delete, yank, etc)

But is there any point in doing so for normal maps? I can't imagine any scenario where a normal noremap ends up with text in the cmdline.

In summary, do I ever need this:

:nnoremap % :<C-u>call Percent_nextline()<cr>

over this:

:nnoremap % :call Percent_nextline()<cr>

1 Answer 1


The point of <C-u> is to make the macro not bail out when used with a count. If you press, say, 3: in normal mode you'll get .,.+2 inserted automatically on the command line. This seldom makes sense for the map being defined. Of course this is more useful if your macro cares about counts (see :help v:count for an example), but even if it doesn't, adding <C-u> makes the macro tolerant to being called (perhaps inadvertently) with a count. Pressing 3% is an error with your definition, but works just fine with the original definition.

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.