With a basic integration relying only on elm autocomplete N ...
, this is what it looks like:
https://asciinema.org/a/TjAxDkyJN4Si8ToFUv7sjRe09
- Auto-suggestions are layed out horizontally
- Sub-params are also detected and layed out
This is a reasonable first step, it works ok.
Here's what the bower
plugin output looks like:
https://asciinema.org/a/W4UUTnzU1a3ZFd6nrs58tSRO5
- All the commands have descriptions so they're layed out vertially
- Sub-params are contextual with descriptions as well if more than one applies (as seen with
bower install
)
From what I could find this appears to be the extent to which zsh autocomplete makes available out of the box, without installing further plguins.
- ZSH docs on autocompletion
bower
plugin source- oh-my-zsh giant directory of plugin sources
- I found this helpful to browse the source for utilities I'm familiar with to see how they mapped things
I tried reading through the ZSH autocompletion docs to figure out if it was possible – but I didn't have enough time and this is well past my limited knowledge in this domain
I also went through a lot of the oh-my-zsh catalogue of plugins, and as far as I could see, none of the utilities I know well (I looked at bower, heroku, stack, cabal, ruby, rails) had anything covering both params (--port
) and values (8080
) in autocompletion together.
On top of this, I discovered that https://github.com/zsh-users/zsh-autosuggestions is a very popular plugin, that provides " Fish-like fast/unobtrusive autosuggestions for zsh."
This is the effect it produces as per their readme: https://asciinema.org/a/37390
However it does not seem to fundamentally change the auto-suggest, just provides an inline/live display of it like fish – which maybe not all zsh users prefer.
- Create
~/.oh-my-zsh/custom/plugins/elm/elm.plugin.zsh
with the contents of elm.plugin.zsh - Edit
~/.zshrc
and appendelm
to plugins- i.e.
plugins=(x y z)
->plugins=(x y z elm)
- Here is a one-shot command that adds
elm
only if it doesn't already exist (only tested on OS X) sed -i -- '/elm/! s/^plugins=(\(.*\))/plugins=(\1 elm)/g' ~/.zshrc
- i.e.
- Reload zsh
. ~/.zshrc
There does not appear to be any standard folder for zsh config – only the ~/.zshrc
and /etc/zshrc
files.
- Create
~/.elm.plugin.zsh
(?) with the contents of elm.plugin.zsh - Edit
~/.zshrc
and addsource ~/.elm.plugin.zsh
- Here is a one-shot command that adds this only if it doesn't already exist (only tested on OS X)
grep "elm.plugin.zsh" ~/.zshrc || echo "source ~/.elm.plugin.zsh" >> ~/.zshrc
- Reload zsh
. ~/.zshrc