BlakBat
BlakBat

Reputation: 1853

Vim c-remap common typos

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?

Upvotes: 2

Views: 148

Answers (1)

Kent
Kent

Reputation: 195039

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

command! -nargs=* -bang W w<bang> <args>

Upvotes: 3

Related Questions