3

I am using latest available version of NeoVim v0.4.3 and latest Arch build with kernel 5.6.4-arch1-1.

Within .vimrc what is the difference between

:nnoremap ... and

nnoremap ....

Or, what effect, if any, does the addition of removal of the : at the start of the line make?

1
  • Hi @Tae. Thank you for your linked answer. The answer is very similar on both my question here, and the linked question you have answered. However the question in both cases is very different. That is in my opinion a key difference. My question is very specific about the : and would allow others to more easily find the answer. The question you kindly answered I could not find during what I thought was a fairly extensive search last night and in previous days. Becasue the linked question asks a question which does not identify the : subject.
    – Kes
    May 22, 2020 at 8:51

2 Answers 2

3

There’s no difference.

When executing ex commands interactively, you type the colon to switch from normal mode into command line mode where these can be entered, but your vimrc is already read as a series of ex (or Vimscript) commands, so the colon is unnecessary.

But having said that, it doesn’t have any ill effect if the colon is there: it just doesn’t do anything.

3

All spaces, tabs and colons before and after :h :range (i.e. before the start of actual command) are skipped by Vim's internal parser. There makes no difference how many of them and in what order are there. So, for example,

:: :: 1,2 :: :: print

is absolutely valid.

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