hl037_
hl037_

Reputation: 3897

Vim C/C++/php auto replace . by -> when pointers

Is there a plugin existing to auto replace . by -> in insert mode when the variable referred is a pointer (C/C++) or an object in php ? Else, is there an easy way to know the type of the expression just before the cursor to write my own script ?

Upvotes: 0

Views: 175

Answers (1)

Peter Rincker
Peter Rincker

Reputation: 45157

I cannot speak for C/C++ mapping and I very much doubt there is a way to tell if a word in PHP is an object or not as PHP is weakly typed. However do have small script that I use for converting . to -> that works well for me. Save this script as ~/.vim/ftplugin/php_this.vim or ~/.vim/bundle/php_this/ftplugin/php_this.vim if you are using pathogen.

Upvotes: 1

Related Questions