Skip to content
Myr

[completion] Replace 'tr' with built-in string substitution

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

authored by Junegunn Choi · committed by Junegunn Choi · parent af79407 · Browse files · 2 files+6 added−4 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+6 added−4 removed

  • other:+6 added−4 removed

2 files+6 added−4 removed

modified:shell/completion.bash+3 added-2 removed
410 unmodified lines
411_fzf_proc_completion() {412 local transformer413 transformer='414 if [[ $FZF_KEY =~ ctrl|alt|shift ]] && [[ -n $FZF_NTH ]]; then415 nths=( $(tr , " " <<< "$FZF_NTH") )415 nths=( ${FZF_NTH//,/ } )416 new_nths=()417 found=0418 for nth in ${nths[@]}; do419 if [[ $nth = $FZF_CLICK_HEADER_NTH ]]; then
2 unmodified lines
422 new_nths+=($nth)423 fi424 done425 [[ $found = 0 ]] && new_nths+=($FZF_CLICK_HEADER_NTH)426 new_nths=$(echo ${new_nths[@]} | tr " " ,)426 new_nths=${new_nths[*]}427 new_nths=${new_nths// /,}428 echo "change-nth($new_nths)+change-prompt($new_nths> )"429 else430 if [[ $FZF_NTH = $FZF_CLICK_HEADER_NTH ]]; then431 echo "change-nth()+change-prompt(> )"
194 unmodified lines
modified:shell/completion.zsh+3 added-2 removed
291 unmodified lines
292_fzf_complete_kill() {293 local transformer294 transformer='295 if [[ $FZF_KEY =~ ctrl|alt|shift ]] && [[ -n $FZF_NTH ]]; then296 nths=( $(tr , " " <<< "$FZF_NTH") )296 nths=( ${FZF_NTH//,/ } )297 new_nths=()298 found=0299 for nth in ${nths[@]}; do300 if [[ $nth = $FZF_CLICK_HEADER_NTH ]]; then
2 unmodified lines
303 new_nths+=($nth)304 fi305 done306 [[ $found = 0 ]] && new_nths+=($FZF_CLICK_HEADER_NTH)307 new_nths=$(echo ${new_nths[@]} | tr " " ,)307 new_nths=${new_nths[*]}308 new_nths=${new_nths// /,}309 echo "change-nth($new_nths)+change-prompt($new_nths> )"310 else311 if [[ $FZF_NTH = $FZF_CLICK_HEADER_NTH ]]; then312 echo "change-nth()+change-prompt(> )"
103 unmodified lines