mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-12-29 07:34:11 +08:00
zpty module is only needed for completion
strategy
This commit is contained in:
parent
dad6be4d5e
commit
5529102afc
1
Makefile
1
Makefile
|
@ -1,7 +1,6 @@
|
|||
SRC_DIR := ./src
|
||||
|
||||
SRC_FILES := \
|
||||
$(SRC_DIR)/setup.zsh \
|
||||
$(SRC_DIR)/config.zsh \
|
||||
$(SRC_DIR)/util.zsh \
|
||||
$(SRC_DIR)/bind.zsh \
|
||||
|
|
|
@ -43,7 +43,7 @@ Set `ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE` to configure the style that the suggestion
|
|||
|
||||
- `history`: Chooses the most recent match from history.
|
||||
- `match_prev_cmd`: Like `history`, but chooses the most recent match whose preceding history item matches the most recently executed command ([more info](src/strategies/match_prev_cmd.zsh)). Note that this strategy won't work as expected with ZSH options that don't preserve the history order such as `HIST_IGNORE_ALL_DUPS` or `HIST_EXPIRE_DUPS_FIRST`.
|
||||
- `completion`: (experimental) Chooses a suggestion based on what tab-completion would suggest.
|
||||
- `completion`: (experimental) Chooses a suggestion based on what tab-completion would suggest. (requires `zpty` and `zutil` modules)
|
||||
|
||||
For example, setting `ZSH_AUTOSUGGEST_STRATEGY=(history completion)` will first try to find a suggestion from your history, but, if it can't find a match, will find a suggestion from the completion engine.
|
||||
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
|
||||
#--------------------------------------------------------------------#
|
||||
# Setup #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Precmd hooks for initializing the library and starting pty's
|
||||
autoload -Uz add-zsh-hook
|
||||
|
||||
# Asynchronous suggestions are generated in a pty
|
||||
zmodload zsh/zpty
|
|
@ -17,4 +17,5 @@ _zsh_autosuggest_start() {
|
|||
}
|
||||
|
||||
# Start the autosuggestion widgets on the next precmd
|
||||
autoload -Uz add-zsh-hook
|
||||
add-zsh-hook precmd _zsh_autosuggest_start
|
||||
|
|
|
@ -87,6 +87,8 @@ _zsh_autosuggest_capture_buffer() {
|
|||
}
|
||||
|
||||
_zsh_autosuggest_capture_completion() {
|
||||
zmodload -s zsh/zpty || return
|
||||
|
||||
typeset -g completion
|
||||
local line REPLY
|
||||
|
||||
|
|
|
@ -25,16 +25,6 @@
|
|||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# Setup #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
# Precmd hooks for initializing the library and starting pty's
|
||||
autoload -Uz add-zsh-hook
|
||||
|
||||
# Asynchronous suggestions are generated in a pty
|
||||
zmodload zsh/zpty
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# Global Configuration Variables #
|
||||
#--------------------------------------------------------------------#
|
||||
|
@ -567,6 +557,8 @@ _zsh_autosuggest_capture_buffer() {
|
|||
}
|
||||
|
||||
_zsh_autosuggest_capture_completion() {
|
||||
zmodload -s zsh/zpty || return
|
||||
|
||||
typeset -g completion
|
||||
local line REPLY
|
||||
|
||||
|
@ -780,4 +772,5 @@ _zsh_autosuggest_start() {
|
|||
}
|
||||
|
||||
# Start the autosuggestion widgets on the next precmd
|
||||
autoload -Uz add-zsh-hook
|
||||
add-zsh-hook precmd _zsh_autosuggest_start
|
||||
|
|
Loading…
Reference in New Issue
Block a user