Add alternative install/uninstall script. #56
| @@ -0,0 +1,13 @@ | ||
| +# Setup zsh-autosuggestions | ||
| +source $HOME/.zsh-autosuggestions/autosuggestions.zsh | ||
| + | ||
| +# Enable autosuggestions automatically | ||
| +zle-line-init() { | ||
| + zle autosuggest-start | ||
| +} | ||
| + | ||
| +zle -N zle-line-init | ||
| + | ||
| +# use ctrl+t to toggle autosuggestions(hopefully this wont be needed as | ||
| +# zsh-autosuggestions is designed to be unobtrusive) | ||
| +bindkey '^T' autosuggest-toggle |
|
@baykovr what about commenting this binding by default? It might override a user binding, and it's not actually needed anyway since autosuggestions is "made to work unobtrusively without it". Yeah, I’ve already omitted it from the basic instructions in readme; it’s mentioned only in the configuration section. @ronjouch sure, I just took what the existing install script does without changes. Shall I make an update?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
|
@baykovr thanks, the idea seems nice. A few questions:
- Is usage of
install/alt-installscripts common among zsh plugins? - That will require documentation, can you enrich README.md as part of your pull request?
- No potential conflict with the zgen-based installation method?
@faceleg As I’ve already written in #60, I believe that the “installation” script to copy 4 lines of code to .zshrc is counterproductive, it brings more problems than it solves *. Users should know what they have in their .zshrc file. Some plugins must be loaded in particular order to not interfere with autosuggestions.
* Really, what it’s actually trying to solve? I don’t see any real problem to solve here, only bunch of problems that such installation scripts creates.
Reconsidering my comment after @jirutka 's addition. If installation was conventionally handled by zgen, supporting it would be a real win, but here the benefits are less clear.
By the way, these three lines:
zle-line-init() {
zle autosuggest-start
}
zle -N zle-line-initcould be also contained directly in the autosuggestions.zsh script. Why it’s not here? Well, perhaps because it’s a configuration that should be customizable (e.g. to play well with some other plugins).
It works with zgen out of the box currently, if that is what you meant @ronjouch?
@faceleg I'm sure it works once installed, what I was asking was whether alt-install and install scripts were a convention used by zgen and automatically invoked when installing a new plugin.
@ronjouch Nope, zgen, nor any other plugin manager for ZSH that I know about, doesn’t do that.
The aim of the alt script was to provide an uninstall feature requested in #54.
Also, I did not want to step on any toes by providing a new/conflicting method for configuration. So the current alt script does exactly what the existing install script does, provide some n lines into .zshrc (in an alternative format).
The method used is inspired by .zpreztorc which is configured independently from .zshrc. I think its a clean way of configuring plugin specific settings, although there are certainly some problems with it.
I suppose a healthy discussion now, is a new installer needed and if so what are the requirements for it. I'd be happy to write something everyone is happy with, if needed.
- I'm not sure if most zsh plugins have an install method, although things such as oh-my-zsh and zprezto write directly to zshrc during setup.
- I can add instructions to the readme.
- I have not tested zgen conflicts, yet.
@baykovr Do not get me wrong, but could you please invest your effort to improving autosuggestions itself instead of this? Installation script just for inserting 4 lines of simple configuration code into .zshrc only brings unnecessary complexity and creates more problems. There are already 5 issues related to the installation script.
Everyone who uses ZSH should be able to read and edit her/his .zshrc file. Keep it simple, stupid (KISS)!
Instead of adding multiple conf lines to .zshrc, provide them in .zsh-autosuggestionsrc and add/remove a one line reference to it in .zshrc using "source".
This also allows future configuration changes to be made to .zsh-autosugestionsrc under version control, requiring no updates/changes in user .zshrc.
Summary:
Caveats