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

Loading custom completions after a28dbc8? #4048

Closed
deanishe opened this issue Jun 16, 2015 · 14 comments
Closed

Loading custom completions after a28dbc8? #4048

deanishe opened this issue Jun 16, 2015 · 14 comments

Comments

@deanishe
Copy link

Since a28dbc8 (which moves custom *.zsh file sourcing before plugins), I'm getting loads of command not found: compdef errors from my custom completions file (including completion.zsh.inc from the Google Cloud SDK).

Any idea how I go about fixing this?

@eyenx
Copy link

eyenx commented Jun 16, 2015

I have this issue too.

Could this be because compinit is called on line 68 after loading custom configs on line 32?

@mcornella
Copy link
Member

You should convert those files that need completion to custom plugins, and then add them to your plugins=() array in the zshrc file.
The reason behind moving that logic was that it was necessary to enable people to override oh-my-zsh lib files. But it's a work in progress, in the future we may move the compinit statement to let lib files (default or custom ones) to use completion features.

@deanishe
Copy link
Author

That's not really a viable solution as the files are typically from 3rd-party libraries. Editing them would break updating.

Is it possible to write a plugin that would source the files instead?

@ncanceill
Copy link
Contributor

@deanishe you need not edit the files to convert them as plugins; simply move-rename symlink them like so:

  • $ZSH_CUSTOM/plugins/<name>/<name>.plugin.zsh for scripts
  • $ZSH_CUSTOM/plugins/<name>/_<name> for completion files

@deanishe
Copy link
Author

I'm afraid that won't work as I have different files on different systems, so there'd be dangling symlinks all over the place. I need to test if the files exist first.

Can I add a script at, say $ZSH_CUSTOM/plugins/mycompletion/mycompletion.plugin.zsh, and source the files from within there?

@scott-joe
Copy link

I'm having issues where the git plugin is overwriting aliases I've set in my custom/
Commenting out the offending alias in the git plugin appears to be the only solution for now, but that's not really ideal. Solution?

@azmodude
Copy link

Same issue is hitting me with the vi-mode plugin now overriding custom keybindings set in my custom/keybindings.zsh file (C-A and C-R et al).

So the way forward is converting most (all?) your custom .zsh files to plugins and adding them in correct order to the plugins array? Did I get that right?

@scott-joe
Copy link

I was under the impression that adding one there would overwrite the whole plugin. my git aliases are significantly smaller in number to the plugin. so i'd only want to overwrite a few. but perhaps that's the wrong way of thinking about it

@azmodude
Copy link

@scott-joe-williams The way I am looking at it right now is that I'd do a custom my-keybindings plugin and put it sort of last in my plugins array. That would (should) override the aliases set by former plugins. But then again, I could be totally wrong.

@scott-joe
Copy link

Yeah. I guess they could be considered a plugin. Thanks @azmd

@ncanceill
Copy link
Contributor

@azmd this is a good solution, would you consider documenting it in the wiki?

@azmodude
Copy link

Sure, gladly. I'll try to find some time later in the week.

@apjanke
Copy link
Contributor

apjanke commented Jul 7, 2015

Caused by #3617 (merged under #3809). (Just putting this here so there's a link between the issues.)

@mcornella
Copy link
Member

Fixed in #4230

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

7 participants