jcfaria/Vim-R-plugin — pull request #105 by mdlerch (2014-06-19 22:45:47+00:00)
Title: Make argument completion list libraries

When loading packages with require() or library() it would be really nice to get completion of installed packages. So I could just type `require(vim` and then complete this to `require(vimcom.plus)`, for example.

I hacked together some code to make this happen, but I'm not sure if it's the best strategy. You can merge the pull request or just use it as inspiration as you wish!

Most of the work is in vimcom.plus, and I'll make a pull request there, too. The two potential issues I could see someone having with my method are:

1. This uses the argument completion function so you won't get argument completion for library() or require() just a list of installed packages. This doesn't bother me because I have never had the need for arguments for these functions and I wouldn't want to have to introduce another completion function and therefore another keybinding.

2. This only works if R has been started. If R is not started, it falls back on the prebuilt objects and that will probably give you the arguments for require() and library() and not the list of installed packages.