From 22ba58b0a8a0c9d797c92a786cdfba1de79e643b Mon Sep 17 00:00:00 2001 From: Ricky Zhou Date: Mon, 21 May 2018 15:10:35 -0700 Subject: [PATCH 1/2] zsh completion: Add support for per-command completion triggers. Allow users to configure custom completion triggers on a per-command basis. For example, if FZF_COMPLETION_TRIGGER='**' and FZF_PER_CMD_COMPLETION_TRIGGERS[ssh]='', then: ssh triggers fzf completion. but ls will not. --- shell/completion.zsh | 14 +++++++++----- test/test_go.rb | 8 ++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/shell/completion.zsh b/shell/completion.zsh index 417d03c0f4a..7ac221936cc 100644 --- a/shell/completion.zsh +++ b/shell/completion.zsh @@ -4,10 +4,11 @@ # / __/ / /_/ __/ # /_/ /___/_/ completion.zsh # -# - $FZF_TMUX (default: 0) -# - $FZF_TMUX_OPTS (default: '-d 40%') -# - $FZF_COMPLETION_TRIGGER (default: '**') -# - $FZF_COMPLETION_OPTS (default: empty) +# - $FZF_TMUX (default: 0) +# - $FZF_TMUX_OPTS (default: '-d 40%') +# - $FZF_COMPLETION_TRIGGER (default: '**') +# - $FZF_PER_CMD_COMPLETION_TRIGGERS (default: none) +# - $FZF_COMPLETION_OPTS (default: empty) # Both branches of the following `if` do the same thing -- define # __fzf_completion_options such that `eval $__fzf_completion_options` sets @@ -274,8 +275,11 @@ fzf-completion() { cmd=$(__fzf_extract_command "$LBUFFER") + # Use a per-command completion trigger if available. Otherwise, fall + # back to $FZF_COMPLETION_TRIGGER. + trigger=${FZF_PER_CMD_COMPLETION_TRIGGERS[$cmd]-${FZF_COMPLETION_TRIGGER-'**'}} + # Explicitly allow for empty trigger. - trigger=${FZF_COMPLETION_TRIGGER-'**'} [ -z "$trigger" -a ${LBUFFER[-1]} = ' ' ] && tokens+=("") # When the trigger starts with ';', it becomes a separate token diff --git a/test/test_go.rb b/test/test_go.rb index 6371e0e26b7..6c3c630fcaf 100755 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -2648,6 +2648,14 @@ def test_complete_quoted_command tmux.send_keys 'C-c' end end + + def test_per_cmd_completion_triggers + tmux.send_keys 'declare -A FZF_PER_CMD_COMPLETION_TRIGGERS', :Enter + tmux.send_keys 'FZF_PER_CMD_COMPLETION_TRIGGERS[ls]=""', :Enter + tmux.send_keys 'ls /', :Tab + tmux.until { |lines| assert_operator lines.match_count, :>, 0 } + tmux.send_keys :Enter + end end class TestFish < TestBase From 71894bc5977462a78a644049e4f9f696cc3dbba7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Mar 2023 22:06:14 +0000 Subject: [PATCH 2/2] Bump ruby/setup-ruby from 1.101.0 to 1.143.0 Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.101.0 to 1.143.0. - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Commits](https://github.com/ruby/setup-ruby/compare/ebaea52cb20fea395b0904125276395e37183dac...31a7f6d628878b80bc63375a93ae079ec50a1601) --- updated-dependencies: - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/linux.yml | 2 +- .github/workflows/macos.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 68a783d4d51..ce44a074c00 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -25,7 +25,7 @@ jobs: go-version: 1.19 - name: Setup Ruby - uses: ruby/setup-ruby@ebaea52cb20fea395b0904125276395e37183dac + uses: ruby/setup-ruby@31a7f6d628878b80bc63375a93ae079ec50a1601 with: ruby-version: 3.0.0 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 06b63d6b21f..e5e5123dc11 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -25,7 +25,7 @@ jobs: go-version: 1.18 - name: Setup Ruby - uses: ruby/setup-ruby@ebaea52cb20fea395b0904125276395e37183dac + uses: ruby/setup-ruby@31a7f6d628878b80bc63375a93ae079ec50a1601 with: ruby-version: 3.0.0