Commit Graph

28 Commits (9ad039443f8fca082d93efb16b36c20c92f444e0)

Author SHA1 Message Date
Eric Freese 0d3bbaf8e6 Remove hard-coded ignore of zle-* widgets and add to default config
Use case suggested by @romkatv uses zle-line-init to restore buffer
after running a widget to cd up one level (GitHub #431).

As far as I can tell, the ignoring of zle-line-* was added in commit
9788c2e to support some deprecation warnings that were removed some time
ago.

The pattern was then widened in commit 0c940e7 to zle-* to fix problems
encountered when wrapping zle-isearch-update.

This commit removes the hard coded ignore of all zle-* widgets and adds
zle-* to the default list of widgets to be ignored. Users who want the
plugin to wrap zle-line-init or zle-line-finish can override the
default.
6 years ago
Henré Botha 15bcfd7126 Don't fetch suggestions after copy-earlier-word
Like {up,down}-line-or-beginning-search, this widget relies on
`$LASTWIDGET` being set to function correctly on subsequent invocations.

When asynchronous suggestions are enabled, and the widget triggers a
suggestion to be fetched, `autosuggest-suggest` will be called and
$LASTWIDGET will be set to it.
6 years ago
Eric Freese c1910348c7 Implement completion suggestion strategy (#111)
Based on https://github.com/Valodim/zsh-capture-completion

`zpty -r` with a pattern seems to have some funky behavior on older
versions, giving unpredictable results

Don't use `-s` option to `zmodload`. It is not available in zsh versions
older than 5.3

If running in sync mode and a completion takes a long time, the user can
^C out of it. We need to use `always` in the strategy function or the
pty will not be destroyed in this case and the next time we go to create
it, it will fail, making the shell unusable.

User can have many different completion styles set that will modify what
they've already typed. These styles will result in suggestions that
don't match what the user has already typed. We try our best to unset
some of the more problematic ones, but add some code to fetch to
invalidate suggestions that don't match what the user's already typed.
6 years ago
Eric Freese db290c518b cleanup: Leave max size config unset by default to match other options 6 years ago
Eric Freese e405afab29 Refactor async mode to no longer use zpty
See technique used in `fast-syntax-highlighting`:
- ca2e18bbc9
- http://www.zsh.org/mla/users/2018/msg00424.html

Also see http://www.zsh.org/mla/users/2018/msg00432.html

In async response handler:
- We only want to read data in case of POLLIN or POLLHUP. Not POLLNVAL
  or select error.
- We always want to remove the handler, so it doesn't get called in an
  infinite loop when error is nval or err.

There is an upstream bug that prevents ctrl-c from resetting the prompt
immediately after a suggestion has been fetched asynchronously. A patch
has been submitted, but a workaround for now is to add `command true`
after the exec.

See https://github.com/zsh-users/zsh-autosuggestions/issues/364
6 years ago
dana aee1b10db6 Avoid warn_create_global warnings 7 years ago
Eric Freese 41657e3565 Revert async process substitution & completion strategy
They're not quite ready. Keep them on a feature branch for now.
7 years ago
Eric Nielsen e61442161e Don't overwrite config with default values
otherwise users are obliged to set the config values *after* sourcing
the plugin. They're not able to do it before. Also, re-sourcing the
plugin will reset the values to the defaults again.

See zimfw/zimfw#301

Fixes #335
7 years ago
Eric Freese bd1fd97738 Cleanup unused async pty name 7 years ago
Eric Freese bcbdad83e9 Support fallback strategies by setting array in config 7 years ago
Eric Freese 82b08e2dc8 First pass at getting suggestions from completion engine (#111)
Uses https://github.com/Valodim/zsh-capture-completion with some slight
modifications.
7 years ago
Harm te Hennepe 59c72c6805 Don't break kill ring rotation 7 years ago
Eric Freese 393f7b8bb9 Fix vi-mode partial-accept
Issue #188. PR #324.

Thanks to @toadjaune and @IngoHeimbach.
7 years ago
Eric Freese 3136700ccf Don't fetch suggestions after [up,down]-line-or-beginning-search
These widgets rely on `$LASTWIDGET` being set to restore the cursor
position. When asynchronous suggestions are enabled, and the widget
triggers a suggestion to be fetched, `autosuggest-suggest` will be
called and $LASTWIDGET will be set to it.
7 years ago
Alexander Neumann 1915e28882 Add 'emacs-forward-word'
This commit adds the 'emacs-forward-word' widget to the list of partial
accept widgets.
8 years ago
Eric Freese 83129dd796 Make asynchronous suggestions disabled by default
While they are still experimental
8 years ago
Eric Freese 2c465a932a Rename async pty name config var 8 years ago
Eric Freese e3eb286ea2 Lots of little async cleanups 8 years ago
Eric Freese ab8f295225 First pass at async functionality 8 years ago
Eric Freese 25f4afb058 Add ZSH_AUTOSUGGEST_IGNORE_WIDGETS array 9 years ago
Lorenzo Bolla 2450c95d8a Rename and document new config var 9 years ago
Eric Freese 6d6e7820f3 Fix #143: Add `vi-add-eol` to list of accept widgets. 9 years ago
Eric Freese 83f78d0760 Add suggestion "strategy" concept with default strategy 9 years ago
Kordan Ou aa597eea6d Add an autosuggest widget: autosuggest-execute. 9 years ago
Eric Freese c7c9929490 Add zsh-history-substring-search widgets to CLEAR array by default. 9 years ago
Eric Freese 5e419da326 Remove list of modify widgets and make 'modify' the default behavior. 9 years ago
Eric Freese ebcfc46b72 Comment formatting 9 years ago
Eric Freese 775dd20706 Rewrite 9 years ago