Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@f6164bd8c8acb4a71fb2791a8b6c4024ff038dab # v2
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v2
with:
go-version: 1.19

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@f6164bd8c8acb4a71fb2791a8b6c4024ff038dab # v2
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v2
with:
go-version: 1.18

Expand Down
14 changes: 9 additions & 5 deletions shell/completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions test/test_go.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down