4

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?

Zameer Manji
  • 3,017
  • 5
  • 31
  • 42

1 Answers1

9
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 :)?...

sehe
  • 374,641
  • 47
  • 450
  • 633
  • 1
    I'm not going to do it permanently, but I want to re-wire my muscle memory when using my vim setup. – Zameer Manji Oct 02 '11 at 19:36
  • Good strategy. It is probably how i would force myself to do it. Meanwhile `map `, `map ` etc... [were mentioned yesterday on this site](http://stackoverflow.com/questions/7614546/vim-cursorline-color-change-in-insert-mode) – sehe Oct 02 '11 at 19:45
  • 1
    Instead of ``-ing the `:` key, one can just swap the `:` and `;` commands, `:nnoremap : ;`, `:nnoremap ; :`, so that semantics of useful `;` command would not be lost. – ib. Oct 03 '11 at 14:50
  • @ib: +1 Although, one would argue that `` is the more harmless (albeit slightly less useful) option – sehe Oct 03 '11 at 14:58
  • @sehe: The only "harm" the `;` command could cause is changing position of the cursor inside the current line. – ib. Oct 03 '11 at 15:21
  • @ib: I know. I was joking ... You got the +1 up front :) – sehe Oct 03 '11 at 15:24
  • One should note that this does break a thing or two. If you have nmap like u :GundoToggle, they will stop working. – Zameer Manji Oct 03 '11 at 19:27
  • 1
    @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 – sehe Oct 03 '11 at 20:50
  • @sehe: Absolutely agree with your last comment! :-) – ib. Oct 04 '11 at 02:42