1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 06:58:01 +00:00

[Fix #532] Integrate autosuggestions

This commit is contained in:
Sorin Ionescu 2016-03-02 16:31:30 -05:00
parent 8bd720b0c7
commit c8b8397728
6 changed files with 104 additions and 0 deletions

3
.gitmodules vendored
View File

@ -16,3 +16,6 @@
[submodule "modules/prompt/functions/pure"]
path = modules/prompt/external/pure
url = https://github.com/sindresorhus/pure.git
[submodule "modules/autosuggestions/external"]
path = modules/autosuggestions/external
url = https://github.com/tarruda/zsh-autosuggestions

View File

@ -10,6 +10,11 @@ Archive
Provides functions to list and extract archives.
Autosuggestions
---------------
Integrates zsh-autosuggestions into Prezto.
Command-Not-Found
-----------------

View File

@ -0,0 +1,53 @@
Autosuggestions
---------------
Integrates zsh-autosuggestions into Prezto.
Autosuggestions
===============
Integrates [zsh-autosuggestions][1] into Prezto, which implements the
[Fish shell][2]'s autosuggestions feature, where the user can type in any part
of a previously entered command and Zsh suggests commands as you type based on
history and completions.
If this module is used in conjuncture with the *syntax-highlighting* module, it
must be loaded **after** it.
If this module is used in conjuncture with the *history-substring-search*
module, it must be loaded **after** it.
Contributors
------------
New features and bug fixes should be submitted to the [zsh-autosuggestions][1]
project according to its rules and regulations. This module will be synchronized
against it.
Settings
--------
### Highlighting
If colors are enabled, *autosuggestions* will automatically highlight
positive results.
To enable highlighting for this module only, add the following line to
*zpreztorc*:
zstyle ':prezto:module:autosuggestions' color 'yes'
To set the query found color, add the following line to *zpreztorc*:
zstyle ':prezto:module:autosuggestions:color' found ''
Authors
-------
*The authors of this module should be contacted via the [issue tracker][3].*
- [Sorin Ionescu](https://github.com/sorin-ionescu)
[1]: https://github.com/tarruda/zsh-autosuggestions
[2]: http://fishshell.com
[3]: https://github.com/sorin-ionescu/prezto/issues

@ -0,0 +1 @@
Subproject commit f0a745576ff69fa608421ee7214d4cd77b43e62f

View File

@ -0,0 +1,35 @@
#
# Integrates zsh-autosuggestions into Prezto.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Load dependencies.
pmodload 'editor'
# Source module files.
source "${0:h}/external/zsh-autosuggestions.zsh" || return 1
#
# Highlighting
#
# Set highlight color, default 'fg=8'.
zstyle -s ':prezto:module:autosuggestions:color' found \
'ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE' || ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
# Disable highlighting.
if ! zstyle -t ':prezto:module:autosuggestions' color; then
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=''
fi
#
# Key Bindings
#
if [[ -n "$key_info" ]]; then
# vi
bindkey -M viins "$key_info[Control]F" vi-forward-word
bindkey -M viins "$key_info[Control]E" vi-add-eol
fi

View File

@ -34,6 +34,13 @@ zstyle ':prezto:load' pmodule \
'completion' \
'prompt'
#
# Autosuggestions
#
# Set the query found color.
# zstyle ':prezto:module:autosuggestions:color' found ''
#
# Editor
#