1

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?

user2706035
  • 95
  • 1
  • 1
  • 6
  • 1
    How about `inoremap .. ->`? If you press `.` twice, vim replaces it with `->`. `..` isn't really used too much in C++. Maybe only with varargs. – geza Dec 16 '18 at 17:09
  • @geza ... is used a lot with variadic templates. I write them all the time on my day job. – n. m. could be an AI Dec 16 '18 at 17:19
  • @n.m.: me too, I forgot about them :) adding a `inoremap ... ...` maybe solves this issue, though. – geza Dec 16 '18 at 17:21

1 Answers1

1

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.

alexgolec
  • 26,898
  • 33
  • 107
  • 159