Commit Graph

29 Commits

Author SHA1 Message Date
Pablo Speciale 23f2943455 Add more common widgets to list of clear widgets
Cherry-picked from PR #706 and updates made to src/config.zsh.

Fixes issues #678
2023-09-07 08:49:25 -06:00
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.
2019-06-14 16:38:28 -06:00
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.
2019-06-14 13:19:07 -06:00
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.
2019-04-11 09:53:55 -06:00
Eric Freese db290c518b cleanup: Leave max size config unset by default to match other options 2019-04-10 11:43:20 -06:00
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
2019-04-09 14:45:22 -06:00
dana aee1b10db6 Avoid warn_create_global warnings 2018-12-19 13:38:06 -06:00
Eric Freese 41657e3565 Revert async process substitution & completion strategy
They're not quite ready. Keep them on a feature branch for now.
2018-12-16 20:49:06 -07:00
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
2018-11-18 12:39:23 -07:00
Eric Freese bd1fd97738 Cleanup unused async pty name 2018-07-02 22:38:20 -06:00
Eric Freese bcbdad83e9 Support fallback strategies by setting array in config 2018-06-06 22:03:56 -06:00
Eric Freese 82b08e2dc8 First pass at getting suggestions from completion engine (#111)
Uses https://github.com/Valodim/zsh-capture-completion with some slight
modifications.
2018-05-26 15:35:29 -06:00
Harm te Hennepe 59c72c6805 Don't break kill ring rotation 2018-05-15 12:54:09 -06:00
Eric Freese 393f7b8bb9 Fix vi-mode partial-accept
Issue #188. PR #324.

Thanks to @toadjaune and @IngoHeimbach.
2018-05-15 11:44:42 -06:00
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.
2018-03-23 16:08:11 -06:00
Alexander Neumann 1915e28882 Add 'emacs-forward-word'
This commit adds the 'emacs-forward-word' widget to the list of partial
accept widgets.
2017-08-18 11:14:21 -06:00
Eric Freese 83129dd796 Make asynchronous suggestions disabled by default
While they are still experimental
2017-04-14 08:48:54 -06:00
Eric Freese 2c465a932a Rename async pty name config var 2017-01-29 10:39:07 -07:00
Eric Freese e3eb286ea2 Lots of little async cleanups 2017-01-27 15:18:26 -07:00
Eric Freese ab8f295225 First pass at async functionality 2017-01-24 19:45:11 -07:00
Eric Freese 25f4afb058 Add ZSH_AUTOSUGGEST_IGNORE_WIDGETS array 2016-07-31 19:35:30 -06:00
Lorenzo Bolla 2450c95d8a Rename and document new config var 2016-07-18 10:55:19 +01:00
Eric Freese 6d6e7820f3 Fix #143: Add `vi-add-eol` to list of accept widgets. 2016-04-15 13:37:50 -06:00
Eric Freese 83f78d0760 Add suggestion "strategy" concept with default strategy 2016-03-14 16:51:20 -06:00
Kordan Ou aa597eea6d Add an autosuggest widget: autosuggest-execute. 2016-03-01 13:18:46 -07:00
Eric Freese c7c9929490 Add zsh-history-substring-search widgets to CLEAR array by default. 2016-03-01 13:13:01 -07:00
Eric Freese 5e419da326 Remove list of modify widgets and make 'modify' the default behavior. 2016-02-14 08:54:34 -07:00
Eric Freese ebcfc46b72 Comment formatting 2016-02-14 00:29:43 -07:00
Eric Freese 775dd20706 Rewrite 2016-02-06 21:05:02 -07:00