user2706035
user2706035

Reputation: 95

vim automaticly replace . with -> in cpp

Eclipse cdt has a feature I really like, it automaticly converts . to -> if it is used on a pointer. Since on a european keyboard, its a pain to have to type -> all the time.
So basicly is there a plugin or a way that recognozes that -> is used on a pointer and automaticly converts it in edit mode?
Or if that isn't possible, is there at least a way to just press c-. or altgr-. and have it autmaticly type a -> when in insert mode?

Upvotes: 1

Views: 99

Answers (1)

alexgolec
alexgolec

Reputation: 28262

Try adding the following to your .vimrc:

inoremap <C-p> ->

This will insert -> whenever you hit CTRL+p

Thanks to Amadeus for pointing out this <C-whatever> doesn't work with the period key.

Upvotes: 1

Related Questions