Git Product home page Git Product logo

zsh-autosuggestions's Introduction

zsh-autosuggestions

Fish-like fast/unobtrusive autosuggestions for zsh.

It suggests commands as you type based on history and completions.

Requirements: Zsh v4.3.11 or later

CircleCI Chat on Gitter

Installation

See INSTALL.md.

Usage

As you type commands, you will see a completion offered after the cursor in a muted gray color. This color can be changed by setting the ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE variable. See configuration.

If you press the key (forward-char widget) or End (end-of-line widget) with the cursor at the end of the buffer, it will accept the suggestion, replacing the contents of the command line buffer with the suggestion.

If you invoke the forward-word widget, it will partially accept the suggestion up to the point that the cursor moves to.

Configuration

You may want to override the default global config variables. Default values of these variables can be found here.

Note: If you are using Oh My Zsh, you can put this configuration in a file in the $ZSH_CUSTOM directory. See their comments on overriding internals.

Suggestion Highlight Style

Set ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE to configure the style that the suggestion is shown with. The default is fg=8, which will set the foreground color to color 8 from the 256-color palette. If your terminal only supports 8 colors, you will need to use a number between 0 and 7.

Background color can also be set, and the suggestion can be styled bold, underlined, or standout. For example, this would show suggestions with bold, underlined, pink text on a cyan background:

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ff00ff,bg=cyan,bold,underline"

For more info, read the Character Highlighting section of the zsh manual: man zshzle or online.

Note: Some iTerm2 users have reported not being able to see the suggestions. If this affects you, the problem is likely caused by incorrect color settings. In order to correct this, go into iTerm2's setting, navigate to profile > colors and make sure that the colors for Basic Colors > Background and ANSI Colors > Bright Black are different.

Suggestion Strategy

ZSH_AUTOSUGGEST_STRATEGY is an array that specifies how suggestions should be generated. The strategies in the array are tried successively until a suggestion is found. There are currently three built-in strategies to choose from:

  • history: Chooses the most recent match from history.
  • completion: Chooses a suggestion based on what tab-completion would suggest. (requires zpty module, which is included with zsh since 4.0.1)
  • match_prev_cmd: Like history, but chooses the most recent match whose preceding history item matches the most recently executed command (more info). 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.

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.

Widget Mapping

This plugin works by triggering custom behavior when certain zle widgets are invoked. You can add and remove widgets from these arrays to change the behavior of this plugin:

  • ZSH_AUTOSUGGEST_CLEAR_WIDGETS: Widgets in this array will clear the suggestion when invoked.
  • ZSH_AUTOSUGGEST_ACCEPT_WIDGETS: Widgets in this array will accept the suggestion when invoked.
  • ZSH_AUTOSUGGEST_EXECUTE_WIDGETS: Widgets in this array will execute the suggestion when invoked.
  • ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS: Widgets in this array will partially accept the suggestion when invoked.
  • ZSH_AUTOSUGGEST_IGNORE_WIDGETS: Widgets in this array will not trigger any custom behavior.

Widgets that modify the buffer and are not found in any of these arrays will fetch a new suggestion after they are invoked.

Note: A widget shouldn't belong to more than one of the above arrays.

Disabling suggestion for large buffers

Set ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE to an integer value to disable autosuggestion for large buffers. The default is unset, which means that autosuggestion will be tried for any buffer size. Recommended value is 20. This can be useful when pasting large amount of text in the terminal, to avoid triggering autosuggestion for strings that are too long.

Asynchronous Mode

Suggestions are fetched asynchronously by default in zsh versions 5.0.8 and greater. To disable asynchronous suggestions and fetch them synchronously instead, unset ZSH_AUTOSUGGEST_USE_ASYNC after sourcing the plugin.

Alternatively, if you are using a version of zsh older than 5.0.8 and want to enable asynchronous mode, set the ZSH_AUTOSUGGEST_USE_ASYNC variable after sourcing the plugin (it can be set to anything). Note that there is a bug in versions of zsh older than 5.0.8 where ctrl + c will fail to reset the prompt immediately after fetching a suggestion asynchronously.

Disabling automatic widget re-binding

Set ZSH_AUTOSUGGEST_MANUAL_REBIND (it can be set to anything) to disable automatic widget re-binding on each precmd. This can be a big boost to performance, but you'll need to handle re-binding yourself if any of the widget lists change or if you or another plugin wrap any of the autosuggest widgets. To re-bind widgets, run _zsh_autosuggest_bind_widgets.

Ignoring history suggestions that match a pattern

Set ZSH_AUTOSUGGEST_HISTORY_IGNORE to a glob pattern to prevent offering suggestions for history entries that match the pattern. For example, set it to "cd *" to never suggest any cd commands from history. Or set to "?(#c50,)" to never suggest anything 50 characters or longer.

Note: This only affects the history and match_prev_cmd suggestion strategies.

Skipping completion suggestions for certain cases

Set ZSH_AUTOSUGGEST_COMPLETION_IGNORE to a glob pattern to prevent offering completion suggestions when the buffer matches that pattern. For example, set it to "git *" to disable completion suggestions for git subcommands.

Note: This only affects the completion suggestion strategy.

Key Bindings

This plugin provides a few widgets that you can use with bindkey:

  1. autosuggest-accept: Accepts the current suggestion.
  2. autosuggest-execute: Accepts and executes the current suggestion.
  3. autosuggest-clear: Clears the current suggestion.
  4. autosuggest-fetch: Fetches a suggestion (works even when suggestions are disabled).
  5. autosuggest-disable: Disables suggestions.
  6. autosuggest-enable: Re-enables suggestions.
  7. autosuggest-toggle: Toggles between enabled/disabled suggestions.

For example, this would bind ctrl + space to accept the current suggestion.

bindkey '^ ' autosuggest-accept

Troubleshooting

If you have a problem, please search through the list of issues on GitHub to see if someone else has already reported it.

Reporting an Issue

Before reporting an issue, please try temporarily disabling sections of your configuration and other plugins that may be conflicting with this plugin to isolate the problem.

When reporting an issue, please include:

  • The smallest, simplest .zshrc configuration that will reproduce the problem. See this comment for a good example of what this means.
  • The version of zsh you're using (zsh --version)
  • Which operating system you're running

Uninstallation

  1. Remove the code referencing this plugin from ~/.zshrc.

  2. Remove the git repository from your hard drive

    rm -rf ~/.zsh/zsh-autosuggestions # Or wherever you installed

Development

Build Process

Edit the source files in src/. Run make to build zsh-autosuggestions.zsh from those source files.

Pull Requests

Pull requests are welcome! If you send a pull request, please:

  • Request to merge into the develop branch (NOT master)
  • Match the existing coding conventions.
  • Include helpful comments to keep the barrier-to-entry low for people new to the project.
  • Write tests that cover your code as much as possible.

Testing

Tests are written in ruby using the rspec framework. They use tmux to drive a pseudoterminal, sending simulated keystrokes and making assertions on the terminal content.

Test files live in spec/. To run the tests, run make test. To run a specific test, run TESTS=spec/some_spec.rb make test. You can also specify a zsh binary to use by setting the TEST_ZSH_BIN environment variable (ex: TEST_ZSH_BIN=/bin/zsh make test).

A docker image for testing is available on docker hub. It comes with ruby, the bundler dependencies, and all supported versions of zsh installed.

Pull the docker image with:

docker pull ericfreese/zsh-autosuggestions-test

To run the tests for a specific version of zsh (where <version> below is substituted with the contents of a line from the ZSH_VERSIONS file):

docker run -it -e TEST_ZSH_BIN=zsh-<version> -v $PWD:/zsh-autosuggestions zsh-autosuggestions-test make test

License

This project is licensed under MIT license. For the full text of the license, see the LICENSE file.

zsh-autosuggestions's People

Contributors

0atman avatar adamkruszewski avatar amehmeto avatar babaorum avatar calebmeyer avatar demol-ee avatar ericbn avatar ericfreese avatar faceleg avatar gezalore avatar henrebotha avatar jirutka avatar lbolla avatar migimigi avatar mihaisucan avatar okdana avatar piecioshka avatar romkatv avatar rweir avatar seabornlee avatar sorin-ionescu avatar ssiegel avatar sumnerevans avatar tarruda avatar thomas-mcdonald avatar thorerik avatar tirkarthi avatar tsdh avatar vaeth avatar wgallios avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zsh-autosuggestions's Issues

editing historical lines doesn't work at all

to repro:

  • press up a few times
  • press left a few times to change a historical word or character
  • the rest of the line disappears, even though you didn't want to change the whole thing

Terminal freezes on start

Hi,

I have an issue for some time now, and I hoped it will be fixed, but it still isn't. Sometimes when i try to open new split window or open a new terminal window, zsh freezes and it won't show the line to enter anything, just a blinking cursor. Like it is waiting for something. When i press CTRL+C to stop the process that it is doing, command line shows, but then i get the message below No such widget 'autosuggest-start'. It stands there all the time, clear command is not removing it. Also the plugin is not working in that situation. Here's the screenshot:

screenshot_2015-07-13_10-45-03

Sometimes it works out after restarting terminal, and sometimes the only solution is to restart the computer. When I remove autosuggestion init part in the zshrc, everything works fine.

Here's some system information:

System: Xubuntu 15.04 64 bit
Terminal: Terminator
Zsh: Latest version

And this I have in my .zshrc:

#setup zsh-autosuggestions
source ~/.zsh-autosuggestions/autosuggestions.zsh

# Enable autosuggestions automatically
zle-line-init() {
    zle autosuggest-start
}
zle -N zle-line-init

# use ctrl+t to toggle autosuggestions(hopefully this wont be needed as
# zsh-autosuggestions is designed to be unobtrusive)
bindkey '^T' autosuggest-toggle
AUTOSUGGESTION_HIGHLIGHT_COLOR='fg=6'
AUTOSUGGESTION_HIGHLIGHT_CURSOR=0

Is there any way to debug this?

errors when buffer has text but before prompt runs

I actually am not really sure how to repro this, but basically, I did a git push --tags and started to type git fetch --prune while it was pushing. This happened:

  tungsten ☠ (1) [38027] ~/code/Catalyst-Action-REST «master» $ git push --tags               
  Host key fingerprint is 50:83:ed:b9:a6:33:a0:6f:b9:30:02:9f:48:5f:bc:51
  +--[ RSA 2048]----+
  |       oo        |
  |      ....       |
  |      .E .       |
  |    . ..o        |
  |..   +  S.       |
  |oo..o o o        |
  |o =o + o         |
  | ..oo +          |
  |   oo. o         |
  +-----------------+

  git Counting objects: 1, done.
  Writing objects: 100% (1/1), 175 bytes | 0 bytes/s, done.
  Total 1 (delta 0), reused 0 (delta 0)
  fetch --prremote: To [email protected]:perl-catalyst/Catalyst-Action-REST.git
  remote:    5832c2d..2a64bbd  mirror/rrwo/not_modified -> mirror/rrwo/not_modified
  remote:  * [new tag]         1.12 -> 1.12
  To [email protected]:Catalyst-Action-REST
   * [new tag]         1.12 -> 1.12
  tungsten ☠ (1) [38028] ~/code/Catalyst-Action-REST «master» $ 
  (eval):zle:1: no such widget `autosuggest-menu-select-orig'
  tungsten ☠ (1) [38028] ~/code/Catalyst-Action-REST «master» $ g
  (eval):zle:1: no such widget `autosuggest-menu-select-orig'
  tungsten ☠ (1) [38028] ~/code/Catalyst-Action-REST «master» $ gi
  (eval):zle:1: no such widget `autosuggest-menu-select-orig'
  tungsten ☠ (1) [38028] ~/code/Catalyst-Action-REST «master» $ git 
  (eval):zle:1: no such widget `autosuggest-menu-select-orig'
  tungsten ☠ (1) [38028] ~/code/Catalyst-Action-REST «master» $ git f
  (eval):zle:1: no such widget `autosuggest-menu-select-orig'
  tungsten ☠ (1) [38028] ~/code/Catalyst-Action-REST «master» $ git fe
  (eval):zle:1: no such widget `autosuggest-menu-select-orig'
  tungsten ☠ (1) [38028] ~/code/Catalyst-Action-REST «master» $ git fet
  (eval):zle:1: no such widget `autosuggest-menu-select-orig'
  tungsten ☠ (1) [38028] ~/code/Catalyst-Action-REST «master» $ git fetc
  (eval):zle:1: no such widget `autosuggest-menu-select-orig'
  tungsten ☠ (1) [38028] ~/code/Catalyst-Action-REST «master» $ git fetch 
  (eval):zle:1: no such widget `autosuggest-menu-select-orig'
  tungsten ☠ (1) [38028] ~/code/Catalyst-Action-REST «master» $ git fetch -
  (eval):zle:1: no such widget `autosuggest-menu-select-orig'
  tungsten ☠ (1) [38028] ~/code/Catalyst-Action-REST «master» $ git fetch --
  (eval):zle:1: no such widget `autosuggest-menu-select-orig'
  tungsten ☠ (1) [38028] ~/code/Catalyst-Action-REST «master» $ git fetch --prune
   x [deleted]         (none)     -> origin/drolsky/get_html
   x [deleted]         (none)     -> origin/drolsky/immutabilize-everything
   x [deleted]         (none)     -> origin/factor-out-data-serialization
   x [deleted]         (none)     -> origin/wreis/default_head
   x [deleted]         (none)     -> origin/wreis/deserialize_json
   x [deleted]         (none)     -> origin/xeno/statuses
  tungsten ☠ (1) [38029] ~/code/Catalyst-Action-REST «master» $ 

autocompletion moves history "cursor"

I do reverse history searches A LOT. If the autocompleter shows something from your history, but you want to search, reverse search will only search for things before what was autocompleted, instead of before the current command.

Suggestion: Tag the version

I recommend you tag the version for the project. So it will be easier for users to arrange and update. Also it will allow package manger to handle such a good plugin.

Please tag the version, so I can create a homebrew formula for this.

zsh at 100% CPU

After setting up autosuggestions every zsh shell process is taking up 100% CPU after using suggestions once. From my zshrc:

source ~/.zsh-autosuggestions/autosuggestions.zsh
export AUTOSUGGESTION_HIGHLIGHT_COLOR='fg=248'
bindkey '^F' forward-word
zle-line-init() {
  zle autosuggest-start
}
zle -N zle-line-init

zsh:

$ zsh --version
zsh 5.0.5 (x86_64-apple-darwin13.0.2)

Let me know if I can help.

Support full menu completion like auto-fu

auto-fu is a set of scripts that lists all of the completions menu-style. I love the zsh-autosuggestions async method and the whole idea of history based completion. Is it possible to menu-complete asynchronously in the spirit of auto-fu? I have several conditions to make sure auto-fu isn't too slow:

  • Number of matches N
  • Number of displayed lines N
  • Percent lines of whole terminal

It's really cool being able too see all of the completions available (including contextual information too) and be able to choose from them. History based suggestions are also cool, but only when they're correct. Having both would be awesome.

If this isn't possible, is there a way I can have zsh-autosuggestions supply only history suggestions and have auto-fu do the rest?

Thanks for the awesome code!
PythonNut

Join Wahoo?

We are still relatively new in town, and just getting started, but we are more stable than the other options, namely OMF. I think some of these functions could be turned into a handful of Wahoo plugins or maybe some could be even make it to core. We are always accepting feature request and feedback. I would love if you could give Wahoo a look.

Regards 😄

Install fails on Mac (no option -e for readlink)

There is no -e option on the readlink installed on Mac OSX, so the install fails completely (see L11 on install here)

bash-3.2$ sh /Users/me/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-tarruda-SLASH-zsh-autosuggestions.git/install
readlink: illegal option -- e
usage: readlink [-n] [file ...]
usage: dirname path

Setup completed successfully!

Refer to this commit: 32fb793

Plugin breaks zsh vi mode insert

If vi mode is on (bindkey -v), the following happens:

  1. Type some text
  2. Hit escape to enter normal mode
  3. Navigate backwards on the line so your cursor is within that text
  4. Pressing a (append) or i (insert) will cause any text after the cursor to disappear because autosuggestions kicks in with that text after the cursor as the suggestion, and once you diverge from it by inserting text, it's gone.

Contrast this with using the arrow keys to move backwards without ever leaving insert mode and any typed text is inserted in the middle as expected.

context-based auto-suggestions

For commands like cd, vim, etc. the suggestion based on history alone is not always applicable/relevant in a given context (for example, if I just cded to a given directory, the latest cd in my history is no longer useful, relative cd commands are also not relevant if the path is not visible from the current directory). It may be nice to perform a check if this command is relevant based on $PWD, or allow users a way to define their own filters for relevant commands. I understand that this will not be possible for exotic commands and user scripts, but doesn't seem like it would be hard to do for common system tools (zsh already does this for its tab completion). Allowing the users to easily setup their own macros for this, on the other hand, could allow them to create more relevant filters for their own use cases (like ssh tab completion based on /etc/hosts).

How to toggle through suggestions

Hello,

Is there a way to toggle through suggestions? I'm not sure this is the correct way to say it but what I mean is this:

I type for eexample "git diff" (and the remaining of my last git diff appears here)

I would like to, for example, press UP / DOWN to toggle though the other applicable entries to this suggestion.

Is this possible ?

Accept line with enter/return?

Hi tarruda,

thanks for your plugin. I'm quite new to zsh and maybe I did something wrong, but I expected to accept a suggested line via enter/return. Instead the suggestion was removed and I accepted everything before the suggestion. I commented out two lines (https://github.com/tarruda/zsh-autosuggestions/blob/master/autosuggestions.zsh#L36, https://github.com/tarruda/zsh-autosuggestions/blob/master/autosuggestions.zsh#L147) to get my desired effect. Can I get the same effect somehow without modifying the source?

install script emits bad characters on cygwin

The install script has a cosmetic issue when running on Cygwin/Windows 7 for me. The \n characters are printed literally instead of turning in to newlines, even when explicitly run under bash.

install on cygwin-win7 under mintty

This is on Windows 7, with Cygwin updated as of about 1/25/2015.

$ uname -a
CYGWIN_NT-6.1 gwydion 1.7.34(0.285/5/3) 2015-02-04 12:14 x86_64 Cygwin

I think this is because echo is non-portable when used with escape sequences or options. Different shells and even different bashes might behave differently on different systems. Described here. It'll probably affect Fedora 21 and FreeBSD as well, based on a similar issue I've seen with oh-my-zsh (ohmyzsh/ohmyzsh#3658).

Looks like it could be fixed by replacing echo with printf calls.

Autocompletion broken

This was reported at #29 by @k4nar . I'm facing the same issue so here is a proper issue for it.

Autocompletion for files, git etc is not working with this plugin loaded. Unloading the plugin fixes the problem.

I'm using antigen.

Will add more info when I have time to take a deeper look at the problem.

Clarification of install operations

The installation instruction asks users to run sh ~/.zsh-autosuggestions/install for installation. But sh is symlinked to dash in ubuntu 12.04 and probably in many Debian distros. Since dash doesn't support SOURCE="${BASH_SOURCE[0]}" it throws up an error. It will be good if there is an explanation for this in the instructions for Debian based distros to run it with bash or to ask users to run it with /bin/bash directly.

pressing up arrow only does the expected thing once

Input:

» echo "hi"                                              
hi
» echo "bye"                                              
bye
  • type in "echo"
  • press up arrow once: expected result is echo "hi". Pass
  • press up arrow again. expected result is echo "bye". Actual result: something random. :(
  • Press up arrow a few more times: a random walk through history.

In fish, the result would be an orderly series of results which start with "echo"

Unexpected Backspace (backward-delete-char) Behaviour

screen shot 2014-09-16 at 9 32 35 pm
When typing, autosuggest behaves as expected. However when the backspace button is pressed, the suggestion is not cleared from the line as in Fish
screen shot 2014-09-16 at 9 32 54 pm
The suggestion is cleared upon entering vi-command-mode.
zsh version: zsh 5.0.2 (x86_64-apple-darwin13.0)
other plug-ins: history-substring-search zsh-syntax-highlighting
using oh-my-zsh

Bind right arrow to autocomplete whole line (or single word)?

I love this plugin, it's making the switch from fish to zsh easier and easier. I was happy to see it now integrates well with the syntax highlighting plugin.

However, it doesn't emulate the default behavior of fish. In fish, if I hit right arrow when a possible completion is shown, it will complete the whole thing at once.

This plugin currently completes a single character when I press the right arrow.

Is there some way to bind right arrow to complete the whole prediction?
Is there some way to bind right arrow to complete by word?

I'm running brew installed zsh 5.0.7 and the latest oh-my-zsh in iTerm2 on Mac OS X 10.10.3 (the latest yosemite) if it makes any difference.

zsh-autosuggestions (in antigen?) breaks some keybindings

I'm trying to use zsh-autosuggestions with antigen, apparently it works, but it breaks some keybindings:

  1. The Home and End key do nothing, but ^A and ^E still work to move the cursor to the beginning and end of line;
  2. ^C has to be pressed two times to kill the line (^U still works, but I find ^C more convenient);
  3. The right arrow does not accept the autosuggestion, but here I'm not sure if it is supposed to do so.

It does not matter if I add "antigen use oh-my-zsh" in my zshrc, I still get these problems. No errors are printed.

If you need me to perform any test just let me know.
Thanks!

How can I uninistall?

The default file auto-complete got broken with this; plus I can't tab complete at all.

Plugin doesn't start automatically as expected

Hey there, anyone who can help with the issue I'm facing? Basically it seems there is no way I can get zsh-autosuggestions to work out of the box. I need to call autosuggestion-toggle via key bind everytime I start a session. Here is my current config file, anyone who can spot what am I doing wrong?

I'm running all the latest versions of zsh, oh-my-zsh and the tools required on OSX

Thanks a lot for your help.

autosuggestion color persists once typed command diverges from prediction

It seems that whatever color zsh-autosuggestions uses for its guess sticks around for the remaining length of the guess once the input diverges from the guess. For example, if cd has ~/code/repo as the guess, but I type cd ~/code/ocaml/, parts of ocaml will still be the color that zsh-autosuggestions uses, and text after that will be normally colored.

ex1

Deleting a single differently-colored character seems to cause all of the colored text to correct itself.

Autosuggestions do not work with zsh-syntax-highlighting

It is somewhat expected since both plugins are using the same zle widgets. I guess you need to cooperate and work out some standard that will allow using both plugins.

Fish has both completion and highlighting and it looks nice. I do not like much more limited capabilities of it though.

No such widget `autosuggest-...-orig'

Error:

> ~/workSpace $
No such widget `autosuggest-cd-complete-orig'

I defined a widget like this:

cd-complete() {
  if [[ ! -n $BUFFER ]] ; then
    BUFFER="cd "
    zle end-of-line
  fi
  zle expand-or-complete
}
zle -N cd-complete
bindkey "\t" cd-complete

How can I fix it?

make it fuzzy

i don't know if it's possible right now but make all suggestions inline and make them fuzzy. much line fzf:

this should go nicely with @jirutka's autosuggest-execute-suggestion (#61)

filepath autosuggestions?

Is there any way to enable fish-alike file/directory autosuggestion in commands that receiving it, like cd, ls etc.? Any other plugin maybe? thx

Integration with zprezto

It would be nice to be able to use zsh-autosuggestions with prezto (https://github.com/sorin-ionescu/prezto). There are a few issues with it, especially with the 'history-substring-search' module.

A simple, bare install of prezto and zsh-autosuggestions doesn't seem to be working properly.

Need a better way to hook into completion widgets

Currently all completion widgets are replaced by wrappers that remove RBUFFER before invoking the original widget. I'm not sure if this approach will be compatible with all configurations

In a perfect world theres a zle 'before completion' hook that can be used to achieve the same effect, but unfortunately I couldn't find one

error with up/down-line-or-history widget

When I press my up/down arrow key to invoke the up/down-line-or-history widgets, I get the following error: autosuggest-suspend:1: job table full or recursion limit exceeded

Autosuggestion breaks syntax-highlighting of history searches

So, I'm using zsh-syntax-highlighting, zsh-history-substring-search, and zsh-autosuggestions together; unfortunately, once an autosuggestion has highlighted some content, the length of that content remains $AUTOSUGGESTION_HIGHLIGHT_COLOR indefinitely thereafter:

an unsuggest widget

  • i don't know if the following is possible to do. it's more of a support question than a bug report but couldn't find mailing-list of irc channel for the project.
  • this is mainly the behaviour of autocompletion in apple's Safari address bar. i think webkit drivatives (e.g. chrome) do the same if you don't have access to osx.
  • i will try to expalin this as best as i can but please let me know if it's not clear.

say user types 'vi' and suggestion is provided in front of the cursor as '~/.zshrc'. now:

  1. user wants this [accept]
  2. user wants to stop right up to what he's typed in. [unsuggest]
    .. and perhaps continue later one. [suggest-ON]
  3. user wants this to be modified. [edit]

a. to aceept, majority of cases since we know how good zsh-autosuggestions is, is default.
b. to unsuggest, to just take the suggestion out of the line, right now deletes the last char typed by the user.
to turn suggestion back ON, .
c. to edit, . notice that now the suggestion becomes real, it's inserted for the user to edit and mode is changed into vicmd.

  1. a menu of suggestions which can be cycled through with

Text color on right of cursor

On my install (zsh, terminator, crunchbang/debian) the text on the right is not grey, it is the same color as the left.
I dont know if this is a bug or if this is just my setup but its really annoying.

Tab doesn't auto complete any more.

Hi @tarruda,

First of all, this looks great! Thanks for creating it.

My problem is, after I enable this plugin, the native zsh auto completion stop working.
For example, when I cd to some dir and click tab for some dir name suggestion, it won't show up any more.

The suggestion by zsh-autosuggestions can not be accepted by the tab key as well. They just disappears after i click tab.

Here is my .zshrc, maybe helpful for identifying the problem.

# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="mytheme"

# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"

# Uncomment this to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment to change how often before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13

# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"

# Uncomment following line if you want to disable autosetting terminal title.
DISABLE_AUTO_TITLE="true"

# Uncomment following line if you want to disable command autocorrection
# DISABLE_CORRECTION="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
COMPLETION_WAITING_DOTS="true"

# Uncomment following line if you want to disable marking untracked files under
# VCS as dirty. This makes repository status check for large repositories much,
# much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git osx autojump brew node npm pip pod sublime)

source $ZSH/oh-my-zsh.sh

# Config history
setopt hist_ignore_all_dups
setopt hist_ignore_space

# Autojump init
# [[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh
autoload -U compinit && compinit

# rbenv
eval "$(rbenv init -)"


# Setup zsh-autosuggestions
source ~/.zsh-autosuggestions/autosuggestions.zsh

# Enable autosuggestions automatically
zle-line-init() {
    zle autosuggest-start
}
zle -N zle-line-init

# use ctrl+t to toggle autosuggestions(hopefully this wont be needed as
# zsh-autosuggestions is designed to be unobtrusive)
bindkey '^T' autosuggest-toggle

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.