diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 291aaf7c1d2..e04b625c235 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -33,12 +33,12 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@1ed1437484560351c5be56cf73a48a279d116b78 + uses: github/codeql-action/init@32dc499307d133bb5085bae78498c0ac2cf762d5 with: languages: ${{ matrix.language }} - name: Autobuild - uses: github/codeql-action/autobuild@1ed1437484560351c5be56cf73a48a279d116b78 + uses: github/codeql-action/autobuild@32dc499307d133bb5085bae78498c0ac2cf762d5 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@1ed1437484560351c5be56cf73a48a279d116b78 + uses: github/codeql-action/analyze@32dc499307d133bb5085bae78498c0ac2cf762d5 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