summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-01-27 19:19:08 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-01-27 19:19:08 +0900
commit2bf5fa27be9201cd8a29d9212550ab989968050e (patch)
tree6f67451826938abd15531ff6f5bfff56a1fb4827 /shell
parentaf7940746f73c14c5d498d762c8d29f45e02043f (diff)
downloadfzf-2bf5fa27be9201cd8a29d9212550ab989968050e.tar.gz
[completion] Replace 'tr' with built-in string substitution
Diffstat (limited to 'shell')
-rw-r--r--shell/completion.bash5
-rw-r--r--shell/completion.zsh5
2 files changed, 6 insertions, 4 deletions
diff --git a/shell/completion.bash b/shell/completion.bash
index 0c53e8e6..686ca4c6 100644
--- a/shell/completion.bash
+++ b/shell/completion.bash
@@ -412,7 +412,7 @@ _fzf_proc_completion() {
local transformer
transformer='
if [[ $FZF_KEY =~ ctrl|alt|shift ]] && [[ -n $FZF_NTH ]]; then
- nths=( $(tr , " " <<< "$FZF_NTH") )
+ nths=( ${FZF_NTH//,/ } )
new_nths=()
found=0
for nth in ${nths[@]}; do
@@ -423,7 +423,8 @@ _fzf_proc_completion() {
fi
done
[[ $found = 0 ]] && new_nths+=($FZF_CLICK_HEADER_NTH)
- new_nths=$(echo ${new_nths[@]} | tr " " ,)
+ new_nths=${new_nths[*]}
+ new_nths=${new_nths// /,}
echo "change-nth($new_nths)+change-prompt($new_nths> )"
else
if [[ $FZF_NTH = $FZF_CLICK_HEADER_NTH ]]; then
diff --git a/shell/completion.zsh b/shell/completion.zsh
index 1199ac54..22c662b0 100644
--- a/shell/completion.zsh
+++ b/shell/completion.zsh
@@ -293,7 +293,7 @@ _fzf_complete_kill() {
local transformer
transformer='
if [[ $FZF_KEY =~ ctrl|alt|shift ]] && [[ -n $FZF_NTH ]]; then
- nths=( $(tr , " " <<< "$FZF_NTH") )
+ nths=( ${FZF_NTH//,/ } )
new_nths=()
found=0
for nth in ${nths[@]}; do
@@ -304,7 +304,8 @@ _fzf_complete_kill() {
fi
done
[[ $found = 0 ]] && new_nths+=($FZF_CLICK_HEADER_NTH)
- new_nths=$(echo ${new_nths[@]} | tr " " ,)
+ new_nths=${new_nths[*]}
+ new_nths=${new_nths// /,}
echo "change-nth($new_nths)+change-prompt($new_nths> )"
else
if [[ $FZF_NTH = $FZF_CLICK_HEADER_NTH ]]; then