Skip to content
Myr

[completion] Add undocumented bash variables for completion commands

Before adoption: this commit came in with the history the project adopted, so no landing records it.

And allow empty FZF_COMPLETION_DIR_COMMANDS

authored by Junegunn Choi · committed by Junegunn Choi · parent 767f125 · Browse files · 2 files+8 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+8 added−5 removed

  • other:+8 added−5 removed

2 files+8 added−5 removed

modified:shell/completion.bash+7 added-4 removed
461 unmodified lines
462# itself. As a quick improvement we take fzf's completion. Adding the few extra463# fzf-tmux specific options (like `-w WIDTH`) are left as a future patch.464complete -o default -F _fzf_opts_completion fzf-tmux465466d_cmds="${FZF_COMPLETION_DIR_COMMANDS:-cd pushd rmdir}"467a_cmds="466d_cmds="${FZF_COMPLETION_DIR_COMMANDS-cd pushd rmdir}"467468# NOTE: $FZF_COMPLETION_PATH_COMMANDS and $FZF_COMPLETION_VAR_COMMANDS are469# undocumented and subject to change in the future.470a_cmds="${FZF_COMPLETION_PATH_COMMANDS-"471 awk bat cat diff diff3472 emacs emacsclient ex file ftp g++ gcc gvim head hg hx java473 javac ld less more mvim nvim patch perl python ruby474 sed sftp sort source tail tee uniq vi view vim wc xdg-open475 basename bunzip2 bzip2 chmod chown curl cp dirname du476 find git grep gunzip gzip hg jar477 ln ls mv open rm rsync scp475 svn tar unzip zip"476v_cmds="export unset printenv"478 svn tar unzip zip"}"479v_cmds="${FZF_COMPLETION_VAR_COMMANDS-export unset printenv}"480481# Preserve existing completion482__fzf_orig_completion < <(complete -p $d_cmds $a_cmds $v_cmds unalias kill ssh 2> /dev/null)483
71 unmodified lines
modified:shell/completion.zsh+1 added-1 removed
325 unmodified lines
326 tail=${LBUFFER:$(( ${#LBUFFER} - ${#trigger} ))}327328 # Trigger sequence given329 if [ ${#tokens} -gt 1 -a "$tail" = "$trigger" ]; then330 d_cmds=(${=FZF_COMPLETION_DIR_COMMANDS:-cd pushd rmdir})330 d_cmds=(${=FZF_COMPLETION_DIR_COMMANDS-cd pushd rmdir})331332 [ -z "$trigger" ] && prefix=${tokens[-1]} || prefix=${tokens[-1]:0:-${#trigger}}333 if [[ $prefix = *'$('* ]] || [[ $prefix = *'<('* ]] || [[ $prefix = *'>('* ]] || [[ $prefix = *':='* ]] || [[ $prefix = *'`'* ]]; then334 return
32 unmodified lines