Disable the ':' character in Vim

Tag: vim Author: bingningcao2199 Date: 2011-09-16

In my ~/.vimrc I have mapped ; to : so I don't have to press shift every time I want to enter a command and so I avoid typos like :W. I have mapped it using nnoremap ; :. My muscle memory is so strong however, is that I find myself frequently pressing : when I dont need to and I still get typos like :W.

How can I disable the : character completely and just use ; in normal mode?

Best Answer

nnoremap ; :
nnoremap : <nop>

would be considered fairly harmless.

I don't need to point out that using this kind of setup will drive anyone trying to use your box nuts, and will render yourself crippled when at a random other UNIX console :)?...


+1 for the question ;)
I'm not going to do it permanently, but I want to re-wire my muscle memory when using my vim setup.
Good strategy. It is probably how i would force myself to do it. Meanwhile map <up> <nop>, map <down> <nop> etc... were mentioned yesterday on this site
Instead of <nop>-ing the : key, one can just swap the : and ; commands, :nnoremap : ;, :nnoremap ; :, so that semantics of useful ; command would not be lost.
@ZameerManji: nope, that is a broken mapping. If it needs the original behaviour it should have been using nnoremap anyway. Also, @all: these comments really should go with the question. I, in no way, do endorse this mapping. I'm just answering questions here So..... if you can all please move you skeptic comments right with next to ... you guessed it: mine :) Thank you very much