From c1910348c703dd6f0726a056a37850eddf1029a9 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Fri, 23 Nov 2018 10:18:15 -0700 Subject: [PATCH 01/20] 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. --- Makefile | 1 - README.md | 7 +- spec/integrations/client_zpty_spec.rb | 14 +++ spec/strategies/completion_spec.rb | 26 ++++++ src/config.zsh | 4 + src/fetch.zsh | 5 +- src/setup.zsh | 10 -- src/start.zsh | 1 + src/strategies/completion.zsh | 109 ++++++++++++++++++++++ zsh-autosuggestions.zsh | 129 +++++++++++++++++++++++--- 10 files changed, 281 insertions(+), 25 deletions(-) create mode 100644 spec/integrations/client_zpty_spec.rb create mode 100644 spec/strategies/completion_spec.rb delete mode 100644 src/setup.zsh create mode 100644 src/strategies/completion.zsh diff --git a/Makefile b/Makefile index 93b8d94..f6d13a7 100644 --- a/Makefile +++ b/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 \ diff --git a/README.md b/README.md index f5a57e0..1435c99 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ _[Fish](http://fishshell.com/)-like fast/unobtrusive autosuggestions for zsh._ -It suggests commands as you type, based on command history. +It suggests commands as you type. Requirements: Zsh v4.3.11 or later @@ -39,10 +39,13 @@ Set `ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE` to configure the style that the suggestion ### 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 two built-in strategies to choose from: +`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. - `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. (requires `zpty` module) + +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 diff --git a/spec/integrations/client_zpty_spec.rb b/spec/integrations/client_zpty_spec.rb new file mode 100644 index 0000000..b8abb37 --- /dev/null +++ b/spec/integrations/client_zpty_spec.rb @@ -0,0 +1,14 @@ +describe 'a running zpty command' do + let(:before_sourcing) { -> { session.run_command('zmodload zsh/zpty && zpty -b kitty cat') } } + + context 'when using `completion` strategy' do + let(:options) { ["ZSH_AUTOSUGGEST_STRATEGY=completion"] } + + it 'is not affected' do + session.send_keys('a').send_keys('C-h') + session.run_command('zpty -t kitty; echo $?') + + wait_for { session.content }.to end_with("\n0") + end + end +end diff --git a/spec/strategies/completion_spec.rb b/spec/strategies/completion_spec.rb new file mode 100644 index 0000000..bd2c72d --- /dev/null +++ b/spec/strategies/completion_spec.rb @@ -0,0 +1,26 @@ +describe 'the `completion` suggestion strategy' do + let(:options) { ['ZSH_AUTOSUGGEST_STRATEGY=completion'] } + let(:before_sourcing) do + -> do + session. + run_command('autoload compinit && compinit'). + run_command('_foo() { compadd bar }'). + run_command('compdef _foo baz') + end + end + + it 'suggests the first completion result' do + session.send_string('baz ') + wait_for { session.content }.to eq('baz bar') + end + + context 'when async mode is enabled' do + let(:options) { ['ZSH_AUTOSUGGEST_USE_ASYNC=true', 'ZSH_AUTOSUGGEST_STRATEGY=completion'] } + + it 'suggests the first completion result' do + session.send_string('baz ') + wait_for { session.content }.to eq('baz bar') + end + end +end + diff --git a/src/config.zsh b/src/config.zsh index 2f46aed..1ab878b 100644 --- a/src/config.zsh +++ b/src/config.zsh @@ -85,3 +85,7 @@ typeset -g ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig- yank-pop ) } + +# Pty name for capturing completions for completion suggestion strategy +(( ! ${+ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME} )) && +typeset -g ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME=zsh_autosuggest_completion_pty diff --git a/src/fetch.zsh b/src/fetch.zsh index 1517018..fef2715 100644 --- a/src/fetch.zsh +++ b/src/fetch.zsh @@ -18,7 +18,10 @@ _zsh_autosuggest_fetch_suggestion() { # Try to get a suggestion from this strategy _zsh_autosuggest_strategy_$strategy "$1" - # Break once we've found a suggestion + # Ensure the suggestion matches the prefix + [[ "$suggestion" != "$1"* ]] && unset suggestion + + # Break once we've found a valid suggestion [[ -n "$suggestion" ]] && break done } diff --git a/src/setup.zsh b/src/setup.zsh deleted file mode 100644 index c74489f..0000000 --- a/src/setup.zsh +++ /dev/null @@ -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 diff --git a/src/start.zsh b/src/start.zsh index 0125ab8..5991039 100644 --- a/src/start.zsh +++ b/src/start.zsh @@ -19,4 +19,5 @@ _zsh_autosuggest_start() { } # Start the autosuggestion widgets on the next precmd +autoload -Uz add-zsh-hook add-zsh-hook precmd _zsh_autosuggest_start diff --git a/src/strategies/completion.zsh b/src/strategies/completion.zsh new file mode 100644 index 0000000..bf4ed9a --- /dev/null +++ b/src/strategies/completion.zsh @@ -0,0 +1,109 @@ + +#--------------------------------------------------------------------# +# Completion Suggestion Strategy # +#--------------------------------------------------------------------# +# Fetches a suggestion from the completion engine +# + +_zsh_autosuggest_capture_postcompletion() { + # Always insert the first completion into the buffer + compstate[insert]=1 + + # Don't list completions + unset compstate[list] +} + +_zsh_autosuggest_capture_completion_widget() { + local -a +h comppostfuncs + comppostfuncs=(_zsh_autosuggest_capture_postcompletion) + + # Only capture completions at the end of the buffer + CURSOR=$#BUFFER + + # Run the original widget wrapping `.complete-word` so we don't + # recursively try to fetch suggestions, since our pty is forked + # after autosuggestions is initialized. + zle -- ${(k)widgets[(r)completion:.complete-word:_main_complete]} + + # The completion has been added, print the buffer as the suggestion + echo -nE - $'\0'$BUFFER$'\0' +} + +zle -N autosuggest-capture-completion _zsh_autosuggest_capture_completion_widget + +_zsh_autosuggest_capture_setup() { + # There is a bug in zpty module in older zsh versions by which a + # zpty that exits will kill all zpty processes that were forked + # before it. Here we set up a zsh exit hook to SIGKILL the zpty + # process immediately, before it has a chance to kill any other + # zpty processes. + if ! is-at-least 5.4; then + zshexit() { + kill -KILL $$ + sleep 1 # Block for long enough for the signal to come through + } + fi + + # Try to avoid any suggestions that wouldn't match the prefix + zstyle ':completion:*' matcher-list '' + zstyle ':completion:*' path-completion false + zstyle ':completion:*' max-errors 0 not-numeric + + bindkey '^I' autosuggest-capture-completion +} + +_zsh_autosuggest_capture_completion_sync() { + _zsh_autosuggest_capture_setup + + zle autosuggest-capture-completion +} + +_zsh_autosuggest_capture_completion_async() { + _zsh_autosuggest_capture_setup + + zmodload zsh/parameter 2>/dev/null || return # For `$functions` + + # Make vared completion work as if for a normal command line + # https://stackoverflow.com/a/7057118/154703 + autoload +X _complete + functions[_original_complete]=$functions[_complete] + _complete () { + unset 'compstate[vared]' + _original_complete "$@" + } + + # Open zle with buffer set so we can capture completions for it + vared 1 +} + +_zsh_autosuggest_strategy_completion() { + typeset -g suggestion + local line REPLY + + # Exit if we don't have completions + whence compdef >/dev/null || return + + # Exit if we don't have zpty + zmodload zsh/zpty 2>/dev/null || return + + # Zle will be inactive if we are in async mode + if zle; then + zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME _zsh_autosuggest_capture_completion_sync + else + zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME _zsh_autosuggest_capture_completion_async "\$1" + zpty -w $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME $'\t' + fi + + { + # The completion result is surrounded by null bytes, so read the + # content between the first two null bytes. + zpty -r $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME line '*'$'\0''*'$'\0' + + # On older versions of zsh, we sometimes get extra bytes after the + # second null byte, so trim those off the end + suggestion="${${${(M)line:#*$'\0'*$'\0'*}#*$'\0'}%%$'\0'*}" + } always { + # Destroy the pty + zpty -d $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME + } +} diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 7be3415..cebdc3e 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -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 # #--------------------------------------------------------------------# @@ -122,6 +112,10 @@ typeset -g ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig- ) } +# Pty name for capturing completions for completion suggestion strategy +(( ! ${+ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME} )) && +typeset -g ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME=zsh_autosuggest_completion_pty + #--------------------------------------------------------------------# # Utility Functions # #--------------------------------------------------------------------# @@ -486,6 +480,115 @@ _zsh_autosuggest_partial_accept() { zle -N autosuggest-toggle _zsh_autosuggest_widget_toggle } +#--------------------------------------------------------------------# +# Completion Suggestion Strategy # +#--------------------------------------------------------------------# +# Fetches a suggestion from the completion engine +# + +_zsh_autosuggest_capture_postcompletion() { + # Always insert the first completion into the buffer + compstate[insert]=1 + + # Don't list completions + unset compstate[list] +} + +_zsh_autosuggest_capture_completion_widget() { + local -a +h comppostfuncs + comppostfuncs=(_zsh_autosuggest_capture_postcompletion) + + # Only capture completions at the end of the buffer + CURSOR=$#BUFFER + + # Run the original widget wrapping `.complete-word` so we don't + # recursively try to fetch suggestions, since our pty is forked + # after autosuggestions is initialized. + zle -- ${(k)widgets[(r)completion:.complete-word:_main_complete]} + + # The completion has been added, print the buffer as the suggestion + echo -nE - $'\0'$BUFFER$'\0' +} + +zle -N autosuggest-capture-completion _zsh_autosuggest_capture_completion_widget + +_zsh_autosuggest_capture_setup() { + # There is a bug in zpty module in older zsh versions by which a + # zpty that exits will kill all zpty processes that were forked + # before it. Here we set up a zsh exit hook to SIGKILL the zpty + # process immediately, before it has a chance to kill any other + # zpty processes. + if ! is-at-least 5.4; then + zshexit() { + kill -KILL $$ + sleep 1 # Block for long enough for the signal to come through + } + fi + + # Try to avoid any suggestions that wouldn't match the prefix + zstyle ':completion:*' matcher-list '' + zstyle ':completion:*' path-completion false + zstyle ':completion:*' max-errors 0 not-numeric + + bindkey '^I' autosuggest-capture-completion +} + +_zsh_autosuggest_capture_completion_sync() { + _zsh_autosuggest_capture_setup + + zle autosuggest-capture-completion +} + +_zsh_autosuggest_capture_completion_async() { + _zsh_autosuggest_capture_setup + + zmodload zsh/parameter 2>/dev/null || return # For `$functions` + + # Make vared completion work as if for a normal command line + # https://stackoverflow.com/a/7057118/154703 + autoload +X _complete + functions[_original_complete]=$functions[_complete] + _complete () { + unset 'compstate[vared]' + _original_complete "$@" + } + + # Open zle with buffer set so we can capture completions for it + vared 1 +} + +_zsh_autosuggest_strategy_completion() { + typeset -g suggestion + local line REPLY + + # Exit if we don't have completions + whence compdef >/dev/null || return + + # Exit if we don't have zpty + zmodload zsh/zpty 2>/dev/null || return + + # Zle will be inactive if we are in async mode + if zle; then + zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME _zsh_autosuggest_capture_completion_sync + else + zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME _zsh_autosuggest_capture_completion_async "\$1" + zpty -w $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME $'\t' + fi + + { + # The completion result is surrounded by null bytes, so read the + # content between the first two null bytes. + zpty -r $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME line '*'$'\0''*'$'\0' + + # On older versions of zsh, we sometimes get extra bytes after the + # second null byte, so trim those off the end + suggestion="${${${(M)line:#*$'\0'*$'\0'*}#*$'\0'}%%$'\0'*}" + } always { + # Destroy the pty + zpty -d $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME + } +} + #--------------------------------------------------------------------# # History Suggestion Strategy # #--------------------------------------------------------------------# @@ -589,7 +692,10 @@ _zsh_autosuggest_fetch_suggestion() { # Try to get a suggestion from this strategy _zsh_autosuggest_strategy_$strategy "$1" - # Break once we've found a suggestion + # Ensure the suggestion matches the prefix + [[ "$suggestion" != "$1"* ]] && unset suggestion + + # Break once we've found a valid suggestion [[ -n "$suggestion" ]] && break done } @@ -683,4 +789,5 @@ _zsh_autosuggest_start() { } # Start the autosuggestion widgets on the next precmd +autoload -Uz add-zsh-hook add-zsh-hook precmd _zsh_autosuggest_start From e7c7efe2e21ba355dc88869d294cc9440a021ebf Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Mon, 15 Apr 2019 12:46:21 -0600 Subject: [PATCH 02/20] Set options immediately after sourcing the plugin before next precmd So that you can access defaults to e.g. add elements to an existing array. --- spec/spec_helper.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abea917..cb149ef 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -11,8 +11,7 @@ RSpec.shared_context 'terminal session' do around do |example| before_sourcing.call - session.run_command(options.join('; ')) - session.run_command('source zsh-autosuggestions.zsh') + session.run_command(['source zsh-autosuggestions.zsh', *options].join('; ')) after_sourcing.call session.clear_screen From ce6ee94f30abeaa63cfd5d3c861175e15045f615 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Mon, 15 Apr 2019 12:47:21 -0600 Subject: [PATCH 03/20] Add spec to demonstrate bracketed-paste-magic bug workaround Add `bracketed-paste` to list of widgets that clear the suggestion as a workaround for GitHub #351 --- spec/integrations/bracketed_paste_magic_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/integrations/bracketed_paste_magic_spec.rb b/spec/integrations/bracketed_paste_magic_spec.rb index 64092ad..41ff267 100644 --- a/spec/integrations/bracketed_paste_magic_spec.rb +++ b/spec/integrations/bracketed_paste_magic_spec.rb @@ -24,4 +24,20 @@ describe 'pasting using bracketed-paste-magic' do end end end + + context 'with `bracketed-paste` added to the list of widgets that clear the suggestion' do + let(:options) { ['ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(bracketed-paste)'] } + + it 'does not retain an old suggestion' do + with_history ('echo foo') do + session.send_string('echo ') + wait_for { session.content }.to eq('echo foo') + session.paste_string('bar') + wait_for { session.content }.to eq('echo bar') + session.send_keys('C-a') # Any cursor movement works + sleep 1 + expect(session.content).to eq('echo bar') + end + end + end end From 474c577f3c2a572728c02ff8e6bfdec4d0e626e1 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Mon, 27 May 2019 14:18:21 -0600 Subject: [PATCH 04/20] Allow setting max size to empty string (GitHub #422) Some people have gotten used to setting ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE to an empty string rather than leaving it unset. This lets them continue to do that without getting any warnings (e.g. "bad math expression: operand expected at end of string"). --- src/widgets.zsh | 2 +- zsh-autosuggestions.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets.zsh b/src/widgets.zsh index 7fb1183..450ed3c 100644 --- a/src/widgets.zsh +++ b/src/widgets.zsh @@ -85,7 +85,7 @@ _zsh_autosuggest_modify() { # Get a new suggestion if the buffer is not empty after modification if (( $#BUFFER > 0 )); then - if (( ! ${+ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE} )) || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then + if [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then _zsh_autosuggest_fetch fi fi diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index f6f6a84..16c6ccc 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -346,7 +346,7 @@ _zsh_autosuggest_modify() { # Get a new suggestion if the buffer is not empty after modification if (( $#BUFFER > 0 )); then - if (( ! ${+ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE} )) || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then + if [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then _zsh_autosuggest_fetch fi fi From b714f6667c8222f4ee4a5c6925b1c797677a6400 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Mon, 27 May 2019 14:56:19 -0600 Subject: [PATCH 05/20] Improve documentation for configuring highlight style Supersedes PR #430 and gives additional info. https://stackoverflow.com/questions/47310537/how-to-change-zsh-autosuggestions-color --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1435c99..1dac45c 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,15 @@ You may want to override the default global config variables. Default values of ### Suggestion Highlight Style -Set `ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE` to configure the style that the suggestion is shown with. The default is `fg=8`. +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: + +```sh +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](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting). ### Suggestion Strategy From 9ceeacc797359230d9868a3576629804bf19c684 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Fri, 14 Jun 2019 12:49:57 -0600 Subject: [PATCH 06/20] Try to make async ^C spec less flaky Was intermittently failing, sleep for a little longer to increase chances of false negatives. --- spec/async_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/async_spec.rb b/spec/async_spec.rb index c4029a1..814ea70 100644 --- a/spec/async_spec.rb +++ b/spec/async_spec.rb @@ -34,9 +34,9 @@ context 'with asynchronous suggestions enabled' do it 'terminates the prompt and begins a new one' do session.send_keys('e') - sleep 0.1 + sleep 0.5 session.send_keys('C-c') - sleep 0.1 + sleep 0.5 session.send_keys('echo') wait_for { session.content }.to eq("e\necho") From 15bcfd712664bb301113761f886718fd3bea7bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henr=C3=A9=20Botha?= Date: Fri, 14 Jun 2019 17:48:31 +0200 Subject: [PATCH 07/20] 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. --- spec/async_spec.rb | 23 +++++++++++++++++++++++ src/config.zsh | 1 + zsh-autosuggestions.zsh | 1 + 3 files changed, 25 insertions(+) diff --git a/spec/async_spec.rb b/spec/async_spec.rb index 814ea70..0af7232 100644 --- a/spec/async_spec.rb +++ b/spec/async_spec.rb @@ -27,6 +27,29 @@ context 'with asynchronous suggestions enabled' do end end + describe '`copy-earlier-word`' do + let(:before_sourcing) do + -> do + session. + run_command('autoload -Uz copy-earlier-word'). + run_command('zle -N copy-earlier-word'). + run_command('bindkey "^N" copy-earlier-word') + end + end + + it 'should cycle through previous words in the buffer' do + session.clear_screen + session.send_string('foo bar baz') + sleep 0.5 + session.send_keys('C-n') + wait_for { session.content }.to eq('foo bar bazbaz') + session.send_keys('C-n') + wait_for { session.content }.to eq('foo bar bazbar') + session.send_keys('C-n') + wait_for { session.content }.to eq('foo bar bazfoo') + end + end + describe 'pressing ^C after fetching a suggestion' do before do skip 'Workaround does not work below v5.0.8' if session.zsh_version < Gem::Version.new('5.0.8') diff --git a/src/config.zsh b/src/config.zsh index 1ab878b..4e82c42 100644 --- a/src/config.zsh +++ b/src/config.zsh @@ -35,6 +35,7 @@ typeset -g ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig- up-line-or-history down-line-or-history accept-line + copy-earlier-word ) } diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 16c6ccc..5f920c9 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -61,6 +61,7 @@ typeset -g ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig- up-line-or-history down-line-or-history accept-line + copy-earlier-word ) } From 0d3bbaf8e6eee660190a4bb1158a60ea6d39374c Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Mon, 27 May 2019 13:37:25 -0600 Subject: [PATCH 08/20] 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. --- spec/line_init_spec.rb | 17 +++++++++++++++++ src/bind.zsh | 1 - src/config.zsh | 1 + zsh-autosuggestions.zsh | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 spec/line_init_spec.rb diff --git a/spec/line_init_spec.rb b/spec/line_init_spec.rb new file mode 100644 index 0000000..826277f --- /dev/null +++ b/spec/line_init_spec.rb @@ -0,0 +1,17 @@ +context 'with zle-line-init unignored' do + let(:after_sourcing) do + -> do + session. + run_command('setopt extendedglob'). + run_command('ZSH_AUTOSUGGEST_IGNORE_WIDGETS=(${(@)ZSH_AUTOSUGGEST_IGNORE_WIDGETS:#zle-\*} zle-\^line-init)'). + run_command('zle-line-init() { BUFFER="echo" }') + end + end + + it 'should fetch a suggestion on each line initialization' do + with_history('echo foo') do + session.run_command('zle -N zle-line-init') + wait_for { session.content }.to end_with('echo foo') + end + end +end diff --git a/src/bind.zsh b/src/bind.zsh index a2e86e1..fc2da9e 100644 --- a/src/bind.zsh +++ b/src/bind.zsh @@ -69,7 +69,6 @@ _zsh_autosuggest_bind_widgets() { ignore_widgets=( .\* _\* - zle-\* autosuggest-\* $ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX\* $ZSH_AUTOSUGGEST_IGNORE_WIDGETS diff --git a/src/config.zsh b/src/config.zsh index 4e82c42..5a0ebd8 100644 --- a/src/config.zsh +++ b/src/config.zsh @@ -84,6 +84,7 @@ typeset -g ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig- which-command yank yank-pop + zle-\* ) } diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 5f920c9..f2fe337 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -110,6 +110,7 @@ typeset -g ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig- which-command yank yank-pop + zle-\* ) } @@ -198,7 +199,6 @@ _zsh_autosuggest_bind_widgets() { ignore_widgets=( .\* _\* - zle-\* autosuggest-\* $ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX\* $ZSH_AUTOSUGGEST_IGNORE_WIDGETS From 2b05f5ed2d44799e1d71ce3f186bcb5b07abd277 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Wed, 17 Apr 2019 23:28:20 -0600 Subject: [PATCH 09/20] Add a comment explaining post-completion hook --- src/strategies/completion.zsh | 3 +++ zsh-autosuggestions.zsh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/strategies/completion.zsh b/src/strategies/completion.zsh index bf4ed9a..c2d52f0 100644 --- a/src/strategies/completion.zsh +++ b/src/strategies/completion.zsh @@ -14,6 +14,9 @@ _zsh_autosuggest_capture_postcompletion() { } _zsh_autosuggest_capture_completion_widget() { + # Add a post-completion hook to be called after all completions have been + # gathered. The hook can modify compstate to affect what is done with the + # gathered completions. local -a +h comppostfuncs comppostfuncs=(_zsh_autosuggest_capture_postcompletion) diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index f2fe337..449d68b 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -496,6 +496,9 @@ _zsh_autosuggest_capture_postcompletion() { } _zsh_autosuggest_capture_completion_widget() { + # Add a post-completion hook to be called after all completions have been + # gathered. The hook can modify compstate to affect what is done with the + # gathered completions. local -a +h comppostfuncs comppostfuncs=(_zsh_autosuggest_capture_postcompletion) From 7e048c3f53ad6e56148efd98f752f15654637774 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Wed, 17 Apr 2019 23:25:43 -0600 Subject: [PATCH 10/20] Fix error that was hidden in zpty Without the quotes, this was blowing up with: _zsh_autosuggest_capture_postcompletion:unset:5: not enough arguments --- src/strategies/completion.zsh | 2 +- zsh-autosuggestions.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/strategies/completion.zsh b/src/strategies/completion.zsh index c2d52f0..b280608 100644 --- a/src/strategies/completion.zsh +++ b/src/strategies/completion.zsh @@ -10,7 +10,7 @@ _zsh_autosuggest_capture_postcompletion() { compstate[insert]=1 # Don't list completions - unset compstate[list] + unset 'compstate[list]' } _zsh_autosuggest_capture_completion_widget() { diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 449d68b..2d9c751 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -492,7 +492,7 @@ _zsh_autosuggest_capture_postcompletion() { compstate[insert]=1 # Don't list completions - unset compstate[list] + unset 'compstate[list]' } _zsh_autosuggest_capture_completion_widget() { From fdf4502c5c84459d9343b4299006ea063f130ef1 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Wed, 17 Apr 2019 23:28:51 -0600 Subject: [PATCH 11/20] We need to autoload is-at-least for it to be available This error was hidden inside the zpty --- src/strategies/completion.zsh | 2 ++ zsh-autosuggestions.zsh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/strategies/completion.zsh b/src/strategies/completion.zsh index b280608..f869aa2 100644 --- a/src/strategies/completion.zsh +++ b/src/strategies/completion.zsh @@ -35,6 +35,8 @@ _zsh_autosuggest_capture_completion_widget() { zle -N autosuggest-capture-completion _zsh_autosuggest_capture_completion_widget _zsh_autosuggest_capture_setup() { + autoload -Uz is-at-least + # There is a bug in zpty module in older zsh versions by which a # zpty that exits will kill all zpty processes that were forked # before it. Here we set up a zsh exit hook to SIGKILL the zpty diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 2d9c751..ffc0a1a 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -517,6 +517,8 @@ _zsh_autosuggest_capture_completion_widget() { zle -N autosuggest-capture-completion _zsh_autosuggest_capture_completion_widget _zsh_autosuggest_capture_setup() { + autoload -Uz is-at-least + # There is a bug in zpty module in older zsh versions by which a # zpty that exits will kill all zpty processes that were forked # before it. Here we set up a zsh exit hook to SIGKILL the zpty From e9ce05c4c1aaff9aef12ddc375e718fd4e41d9c9 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Fri, 14 Jun 2019 21:27:21 -0600 Subject: [PATCH 12/20] Ensure that `kill` succeeds even in older buggy versions of zsh See https://unix.stackexchange.com/a/477647/156673 --- src/strategies/completion.zsh | 8 ++++++-- zsh-autosuggestions.zsh | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/strategies/completion.zsh b/src/strategies/completion.zsh index f869aa2..246f0bd 100644 --- a/src/strategies/completion.zsh +++ b/src/strategies/completion.zsh @@ -44,8 +44,12 @@ _zsh_autosuggest_capture_setup() { # zpty processes. if ! is-at-least 5.4; then zshexit() { - kill -KILL $$ - sleep 1 # Block for long enough for the signal to come through + # The zsh builtin `kill` fails sometimes in older versions + # https://unix.stackexchange.com/a/477647/156673 + kill -KILL $$ 2>&- || command kill -KILL $$ + + # Block for long enough for the signal to come through + sleep 1 } fi diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index ffc0a1a..753228e 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -526,8 +526,12 @@ _zsh_autosuggest_capture_setup() { # zpty processes. if ! is-at-least 5.4; then zshexit() { - kill -KILL $$ - sleep 1 # Block for long enough for the signal to come through + # The zsh builtin `kill` fails sometimes in older versions + # https://unix.stackexchange.com/a/477647/156673 + kill -KILL $$ 2>&- || command kill -KILL $$ + + # Block for long enough for the signal to come through + sleep 1 } fi From c04e015d13fdee2903af9740e46540fa7c9295c4 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Wed, 17 Apr 2019 23:29:52 -0600 Subject: [PATCH 13/20] Add to explanation of extra stuff after `zpty -r` --- src/strategies/completion.zsh | 6 ++++-- zsh-autosuggestions.zsh | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/strategies/completion.zsh b/src/strategies/completion.zsh index 246f0bd..8dc1f9d 100644 --- a/src/strategies/completion.zsh +++ b/src/strategies/completion.zsh @@ -108,8 +108,10 @@ _zsh_autosuggest_strategy_completion() { # content between the first two null bytes. zpty -r $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME line '*'$'\0''*'$'\0' - # On older versions of zsh, we sometimes get extra bytes after the - # second null byte, so trim those off the end + # Extract the suggestion from between the null bytes. On older + # versions of zsh (older than 5.3), we sometimes get extra bytes after + # the second null byte, so trim those off the end. + # See http://www.zsh.org/mla/workers/2015/msg03290.html suggestion="${${${(M)line:#*$'\0'*$'\0'*}#*$'\0'}%%$'\0'*}" } always { # Destroy the pty diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 753228e..cef55f8 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -590,8 +590,10 @@ _zsh_autosuggest_strategy_completion() { # content between the first two null bytes. zpty -r $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME line '*'$'\0''*'$'\0' - # On older versions of zsh, we sometimes get extra bytes after the - # second null byte, so trim those off the end + # Extract the suggestion from between the null bytes. On older + # versions of zsh (older than 5.3), we sometimes get extra bytes after + # the second null byte, so trim those off the end. + # See http://www.zsh.org/mla/workers/2015/msg03290.html suggestion="${${${(M)line:#*$'\0'*$'\0'*}#*$'\0'}%%$'\0'*}" } always { # Destroy the pty From d94475ca1b6a39cf92a3957d3b437903c15c4c93 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Fri, 14 Jun 2019 22:08:15 -0600 Subject: [PATCH 14/20] Simplify logic to extract suggestion from between null bytes Just remove up to and including the first null byte and after and including the last null byte. I also looked into using `${${(0)line}[2]}`, but it fails when `$line` starts with a null byte, since the first split string will be empty and thus not included in the resulting array. --- src/strategies/completion.zsh | 2 +- zsh-autosuggestions.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/strategies/completion.zsh b/src/strategies/completion.zsh index 8dc1f9d..06edc20 100644 --- a/src/strategies/completion.zsh +++ b/src/strategies/completion.zsh @@ -112,7 +112,7 @@ _zsh_autosuggest_strategy_completion() { # versions of zsh (older than 5.3), we sometimes get extra bytes after # the second null byte, so trim those off the end. # See http://www.zsh.org/mla/workers/2015/msg03290.html - suggestion="${${${(M)line:#*$'\0'*$'\0'*}#*$'\0'}%%$'\0'*}" + suggestion="${${line#*$'\0'}%$'\0'*}" } always { # Destroy the pty zpty -d $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index cef55f8..e7d9861 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -594,7 +594,7 @@ _zsh_autosuggest_strategy_completion() { # versions of zsh (older than 5.3), we sometimes get extra bytes after # the second null byte, so trim those off the end. # See http://www.zsh.org/mla/workers/2015/msg03290.html - suggestion="${${${(M)line:#*$'\0'*$'\0'*}#*$'\0'}%%$'\0'*}" + suggestion="${${line#*$'\0'}%$'\0'*}" } always { # Destroy the pty zpty -d $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME From e263845beda6b261f3654bcc2ef3ca91b7aace15 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Wed, 17 Apr 2019 23:27:26 -0600 Subject: [PATCH 15/20] Add an extra completion to better exercise choosing first --- spec/strategies/completion_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/strategies/completion_spec.rb b/spec/strategies/completion_spec.rb index bd2c72d..1b4002b 100644 --- a/spec/strategies/completion_spec.rb +++ b/spec/strategies/completion_spec.rb @@ -4,7 +4,7 @@ describe 'the `completion` suggestion strategy' do -> do session. run_command('autoload compinit && compinit'). - run_command('_foo() { compadd bar }'). + run_command('_foo() { compadd bar; compadd bat }'). run_command('compdef _foo baz') end end From 68343c8de405da28a8bfa9baaa2cf0bc4b94f706 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Mon, 15 Apr 2019 14:12:55 -0600 Subject: [PATCH 16/20] Allow suggestions to suggest trailing newlines Command substitution via $() trims trailing newlines so the old approach to reading everything from the fd was preventing suggestions from ending with newlines. Found the read solution here: https://stackoverflow.com/a/15184414/154703 --- src/async.zsh | 5 ++++- zsh-autosuggestions.zsh | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/async.zsh b/src/async.zsh index b038cb0..d7e9fe8 100644 --- a/src/async.zsh +++ b/src/async.zsh @@ -56,9 +56,12 @@ _zsh_autosuggest_async_request() { _zsh_autosuggest_async_response() { emulate -L zsh + local suggestion + if [[ -z "$2" || "$2" == "hup" ]]; then # Read everything from the fd and give it as a suggestion - zle autosuggest-suggest -- "$(cat <&$1)" + IFS='' read -rd '' -u $1 suggestion + zle autosuggest-suggest -- "$suggestion" # Close the fd exec {1}<&- diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index e7d9861..11ff7bd 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -769,9 +769,12 @@ _zsh_autosuggest_async_request() { _zsh_autosuggest_async_response() { emulate -L zsh + local suggestion + if [[ -z "$2" || "$2" == "hup" ]]; then # Read everything from the fd and give it as a suggestion - zle autosuggest-suggest -- "$(cat <&$1)" + IFS='' read -rd '' -u $1 suggestion + zle autosuggest-suggest -- "$suggestion" # Close the fd exec {1}<&- From f543ba08c33453c30d36195ce6fc91b6514369c9 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Wed, 17 Apr 2019 23:30:48 -0600 Subject: [PATCH 17/20] Fix cr/lf handling in completion strategy --- spec/strategies/completion_spec.rb | 12 ++++++++++++ src/strategies/completion.zsh | 10 ++++++++++ zsh-autosuggestions.zsh | 10 ++++++++++ 3 files changed, 32 insertions(+) diff --git a/spec/strategies/completion_spec.rb b/spec/strategies/completion_spec.rb index 1b4002b..e8cc8ce 100644 --- a/spec/strategies/completion_spec.rb +++ b/spec/strategies/completion_spec.rb @@ -14,6 +14,12 @@ describe 'the `completion` suggestion strategy' do wait_for { session.content }.to eq('baz bar') end + it 'does not add extra carriage returns when prefix has a line feed' do + skip '`stty` does not work inside zpty below zsh version 5.0.3' if session.zsh_version < Gem::Version.new('5.0.3') + session.send_string('baz \\').send_keys('C-v', 'C-j') + wait_for { session.content }.to eq("baz \\\nbar") + end + context 'when async mode is enabled' do let(:options) { ['ZSH_AUTOSUGGEST_USE_ASYNC=true', 'ZSH_AUTOSUGGEST_STRATEGY=completion'] } @@ -21,6 +27,12 @@ describe 'the `completion` suggestion strategy' do session.send_string('baz ') wait_for { session.content }.to eq('baz bar') end + + it 'does not add extra carriage returns when prefix has a line feed' do + skip '`stty` does not work inside zpty below zsh version 5.0.3' if session.zsh_version < Gem::Version.new('5.0.3') + session.send_string('baz \\').send_keys('C-v', 'C-j') + wait_for { session.content }.to eq("baz \\\nbar") + end end end diff --git a/src/strategies/completion.zsh b/src/strategies/completion.zsh index 06edc20..4c60e90 100644 --- a/src/strategies/completion.zsh +++ b/src/strategies/completion.zsh @@ -28,6 +28,16 @@ _zsh_autosuggest_capture_completion_widget() { # after autosuggestions is initialized. zle -- ${(k)widgets[(r)completion:.complete-word:_main_complete]} + if is-at-least 5.0.3; then + # Don't do any cr/lf transformations. We need to do this immediately before + # output because if we do it in setup, onlcr will be re-enabled when we enter + # vared in the async code path. There is a bug in zpty module in older versions + # where the tty is not properly attached to the pty slave, resulting in stty + # getting stopped with a SIGTTOU. See zsh-workers thread 31660 and upstream + # commit f75904a38 + stty -onlcr -ocrnl -F /dev/tty + fi + # The completion has been added, print the buffer as the suggestion echo -nE - $'\0'$BUFFER$'\0' } diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 11ff7bd..5f2401d 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -510,6 +510,16 @@ _zsh_autosuggest_capture_completion_widget() { # after autosuggestions is initialized. zle -- ${(k)widgets[(r)completion:.complete-word:_main_complete]} + if is-at-least 5.0.3; then + # Don't do any cr/lf transformations. We need to do this immediately before + # output because if we do it in setup, onlcr will be re-enabled when we enter + # vared in the async code path. There is a bug in zpty module in older versions + # where the tty is not properly attached to the pty slave, resulting in stty + # getting stopped with a SIGTTOU. See zsh-workers thread 31660 and upstream + # commit f75904a38 + stty -onlcr -ocrnl -F /dev/tty + fi + # The completion has been added, print the buffer as the suggestion echo -nE - $'\0'$BUFFER$'\0' } From 43ba8417424ec219cbc222e32e767e11a4152205 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Sat, 15 Jun 2019 21:39:10 -0600 Subject: [PATCH 18/20] Update changelog for v0.6.0 release --- CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 036c1e3..5dc699f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## v0.6.0 +- Added `completion` suggestion strategy powered by completion system (#111) +- Allow setting `ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE` to an empty string (#422) +- Don't fetch suggestions after copy-earlier-word (#439) +- Allow users to unignore zle-\* widgets (e.g. zle-line-init) (#432) + + ## v0.5.2 - Allow disabling automatic widget re-binding for better performance (#418) - Fix async suggestions when `SH_WORD_SPLIT` is set @@ -46,7 +53,7 @@ - Experimental support for asynchronous suggestions (#170) - Fix problems with multi-line suggestions (#225) - Optimize case where manually typing in suggestion -- Avoid wrapping any zle-* widgets (#206) +- Avoid wrapping any zle-\* widgets (#206) - Remove support for deprecated options from v0.0.x - Handle history entries that begin with dashes - Gracefully handle being sourced multiple times (#126) From 3250778ce852566f0e3213699dfee7bdf97f133f Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Sat, 15 Jun 2019 21:39:57 -0600 Subject: [PATCH 19/20] v0.6.0 --- VERSION | 2 +- zsh-autosuggestions.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index b0c2058..60f6343 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.5.2 +v0.6.0 diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 5f2401d..f214147 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -1,6 +1,6 @@ # Fish-like fast/unobtrusive autosuggestions for zsh. # https://github.com/zsh-users/zsh-autosuggestions -# v0.5.2 +# v0.6.0 # Copyright (c) 2013 Thiago de Arruda # Copyright (c) 2016-2018 Eric Freese # From 19c976f62a6a8b1609db6ae26ef7fac33737dc34 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Sat, 15 Jun 2019 21:40:39 -0600 Subject: [PATCH 20/20] Update license copyright year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index bcbc8b9..ef7cfb6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ Copyright (c) 2013 Thiago de Arruda -Copyright (c) 2016-2018 Eric Freese +Copyright (c) 2016-2019 Eric Freese Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation