Skip to content
Myr

Make completion.bash load faster

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

* Reduce number of `__fzf_orig_completion < <(complete -p "$@" 2> /dev/null)`s * Clean up options in fzf completion * Remove telnet completion

authored by Junegunn Choi · committed by Junegunn Choi · parent fddbfe7 · Browse files · 1 file+15 added−60 removed
This commit

State

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

Diff stats

1 file+15 added−60 removed

  • other:+15 added−60 removed

1 file+15 added−60 removed

modified:shell/completion.bash+15 added-60 removed
98 unmodified lines
99 cur="${COMP_WORDS[COMP_CWORD]}"100 prev="${COMP_WORDS[COMP_CWORD-1]}"101 opts="102 -h --help103 -x --extended103 -e --exact105 --extended-exact104 +x --no-extended107 +e --no-exact105 -q --query106 -f --filter107 --literal111 --no-literal112 --algo108 --scheme109 --expect115 --no-expect116 --enabled --no-phony117 --disabled --phony110 --disabled111 --tiebreak112 --bind113 --color121 --toggle-sort114 -d --delimiter115 -n --nth116 --with-nth125 -s --sort117 +s --no-sort118 --track128 --no-track119 --tac130 --no-tac120 -i121 +i122 -m --multi134 +m --no-multi123 --ansi136 --no-ansi124 --no-mouse125 +c --no-color139 +2 --no-256140 --black141 --no-black142 --bold126 --no-bold127 --layout128 --reverse146 --no-reverse129 --cycle148 --no-cycle130 --keep-right150 --no-keep-right151 --hscroll131 --no-hscroll132 --hscroll-off133 --scroll-off134 --filepath-word156 --no-filepath-word135 --info158 --no-info159 --inline-info160 --no-inline-info136 --separator137 --no-separator163 --scrollbar138 --no-scrollbar139 --jump-labels140 -1 --select-1167 +1 --no-select-1141 -0 --exit-0169 +0 --no-exit-0142 --read0171 --no-read0143 --print0173 --no-print0144 --print-query175 --no-print-query145 --prompt146 --pointer147 --marker148 --sync180 --no-sync181 --async182 --no-history149 --history150 --history-size185 --no-header186 --no-header-lines151 --header152 --header-lines153 --header-first190 --no-header-first154 --ellipsis155 --preview193 --no-preview156 --preview-window157 --height158 --min-height197 --no-height198 --no-margin199 --no-padding200 --no-border159 --border202 --no-border-label160 --border-label161 --border-label-pos205 --no-preview-label162 --preview-label163 --preview-label-pos164 --no-unicode209 --unicode165 --margin166 --padding167 --tabstop168 --listen214 --no-listen215 --clear169 --no-clear170 --version171 --"172173 case "${prev}" in221 --algo)222 COMPREPLY=( $(compgen -W "v1 v2" -- "$cur") )223 return 0224 ;;174 --scheme)175 COMPREPLY=( $(compgen -W "default path history" -- "$cur") )176 return 0177 ;;
294 unmodified lines
472 basename bunzip2 bzip2 chmod chown curl cp dirname du473 find git grep gunzip gzip hg jar474 ln ls mv open rm rsync scp475 svn tar unzip zip"476v_cmds="export unset printenv"477478# Preserve existing completion529__fzf_orig_completion < <(complete -p $d_cmds $a_cmds ssh 2> /dev/null)479__fzf_orig_completion < <(complete -p $d_cmds $a_cmds $v_cmds unalias kill ssh 2> /dev/null)480481if type _comp_load > /dev/null 2>&1; then482 # _comp_load was added in bash-completion 2.12 to replace _completion_loader.483 # We use it without -D option so that it does not use _comp_complete_minimal as the fallback.
27 unmodified lines
511for cmd in $d_cmds; do512 __fzf_defc "$cmd" _fzf_dir_completion "-o bashdefault -o nospace -o dirnames"513done514515# Variables516for cmd in $v_cmds; do517 __fzf_defc "$cmd" _fzf_var_completion "-o default -o nospace -v"518done519520# Aliases521__fzf_defc unalias _fzf_alias_completion "-a"522523# Processes524__fzf_defc kill _fzf_proc_completion "-o default -o bashdefault"525526# ssh527__fzf_defc ssh _fzf_complete_ssh "-o default -o bashdefault"528568unset cmd d_cmds a_cmds529unset cmd d_cmds a_cmds v_cmds530531_fzf_setup_completion() {532 local kind fn cmd533 kind=$1
13 unmodified lines
547 esac548 done549}550590# Environment variables / Aliases / Hosts / Process591_fzf_setup_completion 'var' export unset printenv592_fzf_setup_completion 'alias' unalias593_fzf_setup_completion 'host' telnet594_fzf_setup_completion 'proc' kill595551fi