Add alternative install/uninstall script. #56

Closed
wants to merge 3 commits into
from

4 participants

@baykovr

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:

  • Adds alt-installation method.
  • Adds uninstall method ( #54 ).
  • Resolves ( #46 ).
  • Will not double install on multiple invocations like the existing install script.
  • Creates a backup of .zshrc to .zshrc.bak
  • Compatible but untested with $ZDOTDIR

Caveats

  • Requires repository be located in $HOME/.zsh-autosuggestions (as with existing install method)
baykovr added some commits May 18, 2015
@baykovr baykovr Add alterantive installation method af72bd9
@baykovr baykovr Update .zsh-autosuggestionrc 03c5a52
@baykovr baykovr Fix installation bug.
	If the install script is run from an alternative directory
	the use of pwd incorrectly sets the path to .zsh-autosuggesionsrc
c54c241
@faceleg

@ronjouch @jirutka you want to review this?

@ronjouch ronjouch commented on the diff May 21, 2015
.zsh-autosuggestionsrc
@@ -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
@ronjouch
ronjouch added a line comment May 21, 2015

@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".

@jirutka
jirutka added a line comment May 21, 2015

Yeah, I’ve already omitted it from the basic instructions in readme; it’s mentioned only in the configuration section.

@baykovr
baykovr added a line comment May 22, 2015

@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
@ronjouch

@baykovr thanks, the idea seems nice. A few questions:

  • Is usage of install / alt-install scripts 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?
@jirutka

@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.

@ronjouch

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.

@jirutka

By the way, these three lines:

zle-line-init() {
    zle autosuggest-start
}
zle -N zle-line-init

could 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).

@faceleg

It works with zgen out of the box currently, if that is what you meant @ronjouch?

@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.

@jirutka

@ronjouch Nope, zgen, nor any other plugin manager for ZSH that I know about, doesn’t do that.

@baykovr

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.

@ronjouch

  • 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.
@jirutka

@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)!

@baykovr

@jirutka I agree.

@baykovr baykovr closed this May 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment