Skip to content

Commit

Permalink
plugins/bashmarks: Fix bashmarks completion (#491)
Browse files Browse the repository at this point in the history
Make it work for bm without any arguments
  • Loading branch information
johnf authored Nov 18, 2023
1 parent 9b244fe commit e2917d6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions plugins/bashmarks/bashmarks.plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,13 @@ function _bashmarks_is_valid_bookmark_name {
# completion command
function _bashmarks_comp_cmd_bm {
COMPREPLY=()
if ((COMP_CWORD >= 2)) && [[ ${COMP_WORDS[1]} == -[gpd] ]]; then

# bm, g, p, d, bm -[gpd]
if ((COMP_CWORD == 1)) || { ((COMP_CWORD >= 2)) && [[ ${COMP_WORDS[1]} == -[gpd] ]]; }; then
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=($(compgen -W '$(_bashmarks_list_names)' -- "$cur"))
fi

return 0
}

Expand Down Expand Up @@ -236,8 +239,6 @@ if [[ ${ZSH_VERSION-} ]]; then
else
shopt -s progcomp
complete -F _bashmarks_comp_cmd_bm bm
complete -F _bashmarks_comp_cmd_bm bm
complete -F _bashmarks_comp_cmd_bm bm
complete -F _bashmarks_comp_cmd_bm g
complete -F _bashmarks_comp_cmd_bm p
complete -F _bashmarks_comp_cmd_bm d
Expand Down

0 comments on commit e2917d6

Please sign in to comment.