2

I frequently type :E (uppercase) instead of :e (lowercase) when I wish to open a file. Same goes for the mappings of :w[a] and :q[a].

I thought I could fix that with the following in my .vimrc:

cnoremap E e
cnoremap W w
...

They work by transforming the E into e, but sadly it also makes it harder to open/save a file with an uppercase E, the latter gets transformed to lowercase on the fly. To get the uppercase letter I know have to ctrl-v <letter> in C-mode

Is there a better method to help me with my common typos?

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
BlakBat
  • 1,835
  • 5
  • 17
  • 21
  • As a side suggestion, I recommend giving a try to map space bar to `:` in normal mode (`:nnoremap :`). It makes it much easier to enter command mode and you won't have the delay of releasing shift key. [Originally](http://stackoverflow.com/a/6553850/557306), `:` was a key by it's own which gave it a better flow in usage. And currently, I don't consider the standard space bar function very useful, so I remaped it – sidyll Jan 19 '16 at 13:50

1 Answers1

3

perhaps you can create a customized command W, and forward the arguments to the real w command:

command! -nargs=* -bang W w<bang> <args>
Kent
  • 189,393
  • 32
  • 233
  • 301
  • 1
    Tested with E, this works but I lose tab completion of file name. I'll look more into it – BlakBat Jan 19 '16 at 12:50
  • 1
    @BlakBat You didn't mention the completion requirement in your question. If you want it, add `-complete=file` in your command – Kent Jan 19 '16 at 12:54