Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glaive appears not to work in .vimrc #4

Closed
chiphogg opened this issue Dec 25, 2013 · 6 comments
Closed

Glaive appears not to work in .vimrc #4

chiphogg opened this issue Dec 25, 2013 · 6 comments

Comments

@chiphogg
Copy link
Contributor

I'm rewriting my plugin to use maktaba, and I want to use Glaive to configure it.

The relevant (I think) parts of my .vimrc:

" Google's vim enhancements
Bundle 'google/glaive'
Bundle 'google/maktaba'

" My productivity system
Bundle 'chiphogg/vim-vtd'

Glaive vim-vtd plugin[mappings]

This fails like so:

Error detected while processing /home/chogg/.vimrc: 
line  331: 
E492: Not an editor command: Glaive vim-vtd plugin[mappings]

Yet, when I run :Glaive vim-vtd plugin[mappings] by hand inside vim, it works just fine. I even verified that it changes the value of the plugin flag from an empty dict to mappings: 1.

Is Glaive not ready by .vimrc-time?

More broadly: how would one enable mappings in a maktaba plugin without Glaive?

@Soares
Copy link
Contributor

Soares commented Dec 26, 2013

The plugin is installed but not loaded. Vim loads plugins after vimrc time, before startup is completed. Commands become available after the plugin is loaded, which is why Glaive is working after startup completes.

In order to load Glaive during the vimrc (and thus make the commands available in the vimrc) you must either source the bootstrap file or call the glaive#Install() function.

@chiphogg
Copy link
Contributor Author

Ah; I think I understand better now. I also read up on the maktaba docs.

It looks like the order of operations is:

  1. Add a plugin to the rtp
  2. "Install" the plugin
  3. Configure the plugin (using Glaive, or cumbersome direct maktaba function calls, or some other means)
  4. Load the plugin

I previously thought step 1 and 2 were the same.

It stlil seems like they should be the same. That's how it is internally at Google, and it's much more convenient.

Is it fair to say that as things stand now, Glaive is somewhat difficult to use? In that the user needs to call glaive#Install() manually, and also needs to call myplugin#Install() (or worse, maktaba#plugin#Install('/full/path/to/myplugin')) for each plugin?

Is it also fair to say that this problem won't be fixed until we have a maktaba-native plugin manager? (Unless of course other plugin managers start supporting maktaba natively, and I see no reason to think they will.) A maktaba-native plugin manager could roll up all 3 of the first steps into 1.

An explicit example illustrates what a big difference a maktaba-native plugin manager could make. Configuration could be as easy as

Install 'chiphogg/vim-vtd' contexts=`['-home']`

Whereas currently, this looks like

Bundle 'google/maktaba'
Bundle 'google/glaive'
call glaive#Install()
Bundle 'chiphogg/vim-vtd'
call vtd#Install()
Glaive vim_vtd contexts=`['-home']`

@dbarnett
Copy link
Contributor

Is it fair to say that as things stand now, Glaive is somewhat difficult to use? In that the user needs to call…

Nate's pull req #1 will make this slightly better by letting Glaive auto-install the plugin via maktaba if it's on runtimepath but maktaba doesn't know about it yet. That should obviate the need for the per-plugin calls like vtd#Install() above for plugins that don't otherwise need explicit installation (e.g., to trigger instant/ files).

Of course, maktaba is designed to be a plugin manager library and not a plugin manager per se, so a maktaba-native plugin manager will definitely make things nicer and we're not heavily optimizing the convenience of the you-are-the-plugin-manager case.

@chiphogg
Copy link
Contributor Author

"Slightly" better? Are you kidding -- that's a huge improvement! That takes it from N extraneous lines down to 1 (the glaive#Install()). It makes Glaive usable.

It's funny -- when that pull request first came out, I didn't understand the distinction between rtp-adding, installing, and loading. By the time I encountered the problem myself, I'd completely forgotten about it.

Nate -- any reason this pull request hasn't been merged yet? It got the LGTM 18 days ago. And, it fixes some real usability problems with Glaive.

@dbarnett
Copy link
Contributor

Well, I said "slightly" because in your example it only saves one line, so

Bundle 'google/maktaba'
Bundle 'google/glaive'
call glaive#Install()
Bundle 'chiphogg/vim-vtd'
call vtd#Install()
Glaive vim_vtd contexts=`['-home']`

becomes

Bundle 'google/maktaba'
Bundle 'google/glaive'
call glaive#Install()
Bundle 'chiphogg/vim-vtd'
Glaive vim_vtd contexts=`['-home']`

Having a plugin manager that speaks maktaba will allow us to coalesce this down a lot more.

Nate -- any reason this pull request hasn't been merged yet?

I suspect he just forgot it's there because it's easier to forget pending changes in github. I'll ping him on Monday if he doesn't notice it, but he probably will after all this related discussion.

@Soares
Copy link
Contributor

Soares commented Dec 30, 2013

Merged.

@Soares Soares closed this as completed Dec 30, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants