0
:imap mmm <Esc>
vmap '=y :w !pbcopy<CR><CR>

I copied two lines of vim map scripts. The first one has a leading colon while the latter one doesn't have.

So, what's the purpose of the leading colon?

2

The colons don’t do anything.

The same commands can be typed into Vim interactively, in which case you need the colon to switch from normal mode to command-line mode.

When executing Vimscript from a file, the colons are not necessary, so it’s usual to omit them, but if they are included the commands will still work.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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