Skip to content

Latest commit

 

History

History
524 lines (361 loc) · 11.3 KB

zsh-autosuggestions.zsh.adoc

File metadata and controls

524 lines (361 loc) · 11.3 KB

zsh-autosuggestions.zsh(1)

NAME

zsh-autosuggestions.zsh - a shell script

SYNOPSIS

Documentation automatically generated with `zshelldoc'

FUNCTIONS

 _zsh_autosuggest_accept
 _zsh_autosuggest_async_pty_create
 _zsh_autosuggest_async_pty_destroy
 _zsh_autosuggest_async_request
 _zsh_autosuggest_async_response
 _zsh_autosuggest_async_server
 _zsh_autosuggest_async_start
 _zsh_autosuggest_bind_widget
 _zsh_autosuggest_clear
 _zsh_autosuggest_disable
 _zsh_autosuggest_enable
 _zsh_autosuggest_escape_command
 _zsh_autosuggest_execute
 _zsh_autosuggest_feature_detect_zpty_returns_fd
 _zsh_autosuggest_fetch
 _zsh_autosuggest_get_bind_count
 _zsh_autosuggest_highlight_apply
 _zsh_autosuggest_highlight_reset
 _zsh_autosuggest_incr_bind_count
 _zsh_autosuggest_invoke_original_widget
 _zsh_autosuggest_modify
 _zsh_autosuggest_partial_accept
 _zsh_autosuggest_strategy_default
 _zsh_autosuggest_strategy_match_prev_cmd
 _zsh_autosuggest_suggest
 _zsh_autosuggest_toggle
AUTOLOAD add-zsh-hook
PRECMD-HOOK _zsh_autosuggest_async_pty_recreate
PRECMD-HOOK _zsh_autosuggest_bind_widgets
PRECMD-HOOK _zsh_autosuggest_start

DETAILS

Script Body

Has 71 line(s). Calls functions:

Script-Body
`-- add-zsh-hook

_zsh_autosuggest_accept

# Accept the entire suggestion

Has 11 line(s). Calls functions:

_zsh_autosuggest_accept
`-- _zsh_autosuggest_invoke_original_widget

Not called by script or any function, may be a hook or Zle widget, etc.

_zsh_autosuggest_async_pty_create

Has 13 line(s). Doesn’t call other functions.

Uses feature(s): zle, zpty

Called by:

_zsh_autosuggest_async_pty_recreate

_zsh_autosuggest_async_pty_destroy

Has 4 line(s). Doesn’t call other functions.

Uses feature(s): zle, zpty

Called by:

_zsh_autosuggest_async_pty_recreate

_zsh_autosuggest_async_pty_recreate

Has 2 line(s). Is a precmd hook. Calls functions:

_zsh_autosuggest_async_pty_recreate
|-- _zsh_autosuggest_async_pty_create
`-- _zsh_autosuggest_async_pty_destroy

Called by:

_zsh_autosuggest_async_start

_zsh_autosuggest_async_request

Has 1 line(s). Doesn’t call other functions.

Uses feature(s): zpty

Called by:

_zsh_autosuggest_fetch

_zsh_autosuggest_async_response

# Called when new data is ready to be read from the pty
# First arg will be fd ready for reading
# Second arg will be passed in case of error

Has 6 line(s). Doesn’t call other functions.

Uses feature(s): zle, zpty

Not called by script or any function, may be a hook or Zle widget, etc.

_zsh_autosuggest_async_server

# Zpty process is spawned running this function

Has 21 line(s). Doesn’t call other functions.

Uses feature(s): kill

Not called by script or any function, may be a hook or Zle widget, etc.

_zsh_autosuggest_async_start

Has 5 line(s). Calls functions:

_zsh_autosuggest_async_start
|-- _zsh_autosuggest_async_pty_recreate
|   |-- _zsh_autosuggest_async_pty_create
|   `-- _zsh_autosuggest_async_pty_destroy
|-- _zsh_autosuggest_feature_detect_zpty_returns_fd
`-- add-zsh-hook

Called by:

_zsh_autosuggest_start

_zsh_autosuggest_bind_widget

# Bind a single widget to an autosuggest widget, saving a reference to the original widget

Has 29 line(s). Calls functions:

_zsh_autosuggest_bind_widget
|-- _zsh_autosuggest_get_bind_count
`-- _zsh_autosuggest_incr_bind_count

Uses feature(s): eval, zle

Called by:

_zsh_autosuggest_bind_widgets

_zsh_autosuggest_bind_widgets

# Map all configured widgets to the right autosuggest widgets

Has 24 line(s). Is a precmd hook. Calls functions:

_zsh_autosuggest_bind_widgets
`-- _zsh_autosuggest_bind_widget
    |-- _zsh_autosuggest_get_bind_count
    `-- _zsh_autosuggest_incr_bind_count

Called by:

_zsh_autosuggest_start

_zsh_autosuggest_clear

# Clear the suggestion

Has 3 line(s). Calls functions:

_zsh_autosuggest_clear
`-- _zsh_autosuggest_invoke_original_widget

Called by:

_zsh_autosuggest_disable

_zsh_autosuggest_disable

# Disable suggestions

Has 2 line(s). Calls functions:

_zsh_autosuggest_disable
`-- _zsh_autosuggest_clear
    `-- _zsh_autosuggest_invoke_original_widget

Called by:

_zsh_autosuggest_toggle

_zsh_autosuggest_enable

# Enable suggestions

Has 5 line(s). Calls functions:

_zsh_autosuggest_enable
`-- _zsh_autosuggest_fetch
    |-- _zsh_autosuggest_async_request
    `-- _zsh_autosuggest_suggest

Called by:

_zsh_autosuggest_toggle

_zsh_autosuggest_escape_command

#--------------------------------------------------------------------#
# Utility Functions                                                  #
#--------------------------------------------------------------------#

Has 2 line(s). Doesn’t call other functions.

Not called by script or any function, may be a hook or Zle widget, etc.

_zsh_autosuggest_execute

# Accept the entire suggestion and execute it

Has 3 line(s). Calls functions:

_zsh_autosuggest_execute
`-- _zsh_autosuggest_invoke_original_widget

Not called by script or any function, may be a hook or Zle widget, etc.

_zsh_autosuggest_feature_detect_zpty_returns_fd

#--------------------------------------------------------------------#
# Feature Detection                                                  #
#--------------------------------------------------------------------#

Has 12 line(s). Doesn’t call other functions.

Uses feature(s): zpty

Called by:

_zsh_autosuggest_async_start

_zsh_autosuggest_fetch

# Fetch a new suggestion based on what's currently in the buffer

Has 7 line(s). Calls functions:

_zsh_autosuggest_fetch
|-- _zsh_autosuggest_async_request
`-- _zsh_autosuggest_suggest

Uses feature(s): zpty

Called by:

_zsh_autosuggest_enable
_zsh_autosuggest_modify

_zsh_autosuggest_get_bind_count

Has 5 line(s). Doesn’t call other functions.

Called by:

_zsh_autosuggest_bind_widget

_zsh_autosuggest_highlight_apply

# If there's a suggestion, highlight it

Has 8 line(s). Doesn’t call other functions.

Not called by script or any function, may be a hook or Zle widget, etc.

_zsh_autosuggest_highlight_reset

# If there was a highlight, remove it

Has 6 line(s). Doesn’t call other functions.

Not called by script or any function, may be a hook or Zle widget, etc.

_zsh_autosuggest_incr_bind_count

#--------------------------------------------------------------------#
# Widget Helpers                                                     #
#--------------------------------------------------------------------#

Has 7 line(s). Doesn’t call other functions.

Called by:

_zsh_autosuggest_bind_widget

_zsh_autosuggest_invoke_original_widget

# Given the name of an original widget and args, invoke it, if it exists

Has 9 line(s). Doesn’t call other functions.

Uses feature(s): zle

Called by:

_zsh_autosuggest_accept
_zsh_autosuggest_clear
_zsh_autosuggest_execute
_zsh_autosuggest_modify
_zsh_autosuggest_partial_accept

_zsh_autosuggest_modify

# Modify the buffer and get a new suggestion

Has 31 line(s). Calls functions:

_zsh_autosuggest_modify
|-- _zsh_autosuggest_fetch
|   |-- _zsh_autosuggest_async_request
|   `-- _zsh_autosuggest_suggest
`-- _zsh_autosuggest_invoke_original_widget

Not called by script or any function, may be a hook or Zle widget, etc.

_zsh_autosuggest_partial_accept

# Partially accept the suggestion

Has 13 line(s). Calls functions:

_zsh_autosuggest_partial_accept
`-- _zsh_autosuggest_invoke_original_widget

Not called by script or any function, may be a hook or Zle widget, etc.

_zsh_autosuggest_start

# Start the autosuggestion widgets

Has 8 line(s). Is a precmd hook. Calls functions:

_zsh_autosuggest_start
|-- _zsh_autosuggest_async_start
|   |-- _zsh_autosuggest_async_pty_recreate
|   |   |-- _zsh_autosuggest_async_pty_create
|   |   `-- _zsh_autosuggest_async_pty_destroy
|   |-- _zsh_autosuggest_feature_detect_zpty_returns_fd
|   `-- add-zsh-hook
|-- _zsh_autosuggest_bind_widgets
|   `-- _zsh_autosuggest_bind_widget
|       |-- _zsh_autosuggest_get_bind_count
|       `-- _zsh_autosuggest_incr_bind_count
`-- add-zsh-hook

Not called by script or any function, may be a hook or Zle widget, etc.

_zsh_autosuggest_strategy_default

#--------------------------------------------------------------------#
# Default Suggestion Strategy                                        #
#--------------------------------------------------------------------#
# Suggests the most recent history item that matches the given
# prefix.

Has 4 line(s). Doesn’t call other functions.

Not called by script or any function, may be a hook or Zle widget, etc.

_zsh_autosuggest_strategy_match_prev_cmd

#--------------------------------------------------------------------#
# Match Previous Command Suggestion Strategy                         #
#--------------------------------------------------------------------#
# Suggests the most recent history item that matches the given
# prefix and whose preceding history item also matches the most
# recently executed command.
#
# For example, suppose your history has the following entries:
#   - pwd
#   - ls foo
#   - ls bar
#   - pwd
#
# Given the history list above, when you type 'ls', the suggestion
# will be 'ls foo' rather than 'ls bar' because your most recently
# executed command (pwd) was previously followed by 'ls foo'.
#
# 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`.

Has 13 line(s). Doesn’t call other functions.

Not called by script or any function, may be a hook or Zle widget, etc.

_zsh_autosuggest_suggest

# Offer a suggestion

Has 7 line(s). Doesn’t call other functions.

Called by:

_zsh_autosuggest_fetch

_zsh_autosuggest_toggle

# Toggle suggestions (enable/disable)

Has 5 line(s). Calls functions:

_zsh_autosuggest_toggle
|-- _zsh_autosuggest_disable
|   `-- _zsh_autosuggest_clear
|       `-- _zsh_autosuggest_invoke_original_widget
`-- _zsh_autosuggest_enable
    `-- _zsh_autosuggest_fetch
        |-- _zsh_autosuggest_async_request
        `-- _zsh_autosuggest_suggest

Not called by script or any function, may be a hook or Zle widget, etc.

add-zsh-hook

Has 93 line(s). Doesn’t call other functions.

Uses feature(s): autoload

Called by:

Script-Body
_zsh_autosuggest_async_start
_zsh_autosuggest_start