I described how to auto-complete method names of an object on Vim but here let me describe about a bit more restricted one. How can we auto-complete method names of an object that goes to a given object?
An example here that you send
next on an object 1 when you want to get an object 2.
1.succ #=> 2
first method will let you get an object
[:a, :b, :c].
[:a, :b, :c].first #=> :a
It is natural that you expect Vim automatically completes the method names when the cursor is on the
. just after the object.
A neocomplcache plugin, neco-rubymf, does exactly what I described above.
Install a Rubygems package
$ gem install methodfinder
Install the neocomplcache plugin neco-rubymf. If your Vim still don't have neocomplcache, install it as well.
Try inputting the following line in a buffer where the
ruby. Note that ¶ means cursor here.
1.¶ #=> 2
That shows methods
succ in completion popup automatically, which the method an object 1 owns and also the returning value is 2.
[:a, :b, :c].¶ #=> :a
The screenshots below are other examples.
※The last example occurs stochastically.