From 15383e6b4dac62fda7b55156a5ba5d6d76de26c2 Mon Sep 17 00:00:00 2001 From: Wenxuan Zhang Date: Wed, 10 Mar 2021 09:56:31 +0800 Subject: [PATCH] fix: fix copy without newline (#141) Don't known why `tr -d '\n'` inner fzf options doesn't work. Use `tr -d '[:space:]'` instead. It's OK for this scenario. --- conf.d/forgit.plugin.fish | 4 ++-- forgit.plugin.zsh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conf.d/forgit.plugin.fish b/conf.d/forgit.plugin.fish index 43bef8c..d6bede5 100644 --- a/conf.d/forgit.plugin.fish +++ b/conf.d/forgit.plugin.fish @@ -42,7 +42,7 @@ function forgit::log -d "git commit viewer" $FORGIT_FZF_DEFAULT_OPTS +s +m --tiebreak=index --bind=\"enter:execute($cmd |env LESS='-r' less)\" - --bind=\"ctrl-y:execute-silent(echo {} |grep -Eo '[a-f0-9]+' | head -1 | tr -d '\n' | $copy_cmd)\" + --bind=\"ctrl-y:execute-silent(echo {} |grep -Eo '[a-f0-9]+' | head -1 | tr -d '[:space:]' |$copy_cmd)\" $FORGIT_LOG_FZF_OPTS " @@ -259,7 +259,7 @@ function forgit::rebase -d "git rebase " set opts " $FORGIT_FZF_DEFAULT_OPTS +s +m --tiebreak=index - --bind=\"ctrl-y:execute-silent(echo {} |grep -Eo '[a-f0-9]+' | head -1 | tr -d '\n' |$copy_cmd)\" + --bind=\"ctrl-y:execute-silent(echo {} |grep -Eo '[a-f0-9]+' | head -1 | tr -d '[:space:]' |$copy_cmd)\" $FORGIT_REBASE_FZF_OPTS " eval "$cmd" | FZF_DEFAULT_OPTS="$opts" fzf --preview="$preview" | diff --git a/forgit.plugin.zsh b/forgit.plugin.zsh index 4b799c6..94f75fd 100755 --- a/forgit.plugin.zsh +++ b/forgit.plugin.zsh @@ -22,7 +22,7 @@ forgit::log() { $FORGIT_FZF_DEFAULT_OPTS +s +m --tiebreak=index --bind=\"enter:execute($cmd | LESS='-r' less)\" - --bind=\"ctrl-y:execute-silent(echo {} |grep -Eo '[a-f0-9]+' | head -1 | tr -d '\n' |${FORGIT_COPY_CMD:-pbcopy})\" + --bind=\"ctrl-y:execute-silent(echo {} |grep -Eo '[a-f0-9]+' | head -1 | tr -d '[:space:]' |${FORGIT_COPY_CMD:-pbcopy})\" $FORGIT_LOG_FZF_OPTS " graph=--graph @@ -174,7 +174,7 @@ forgit::rebase() { opts=" $FORGIT_FZF_DEFAULT_OPTS +s +m --tiebreak=index - --bind=\"ctrl-y:execute-silent(echo {} |grep -Eo '[a-f0-9]+' | head -1 | tr -d '\n' |${FORGIT_COPY_CMD:-pbcopy})\" + --bind=\"ctrl-y:execute-silent(echo {} |grep -Eo '[a-f0-9]+' | head -1 | tr -d '[:space:]' |${FORGIT_COPY_CMD:-pbcopy})\" $FORGIT_REBASE_FZF_OPTS " commit=$(eval "$cmd" | FZF_DEFAULT_OPTS="$opts" fzf --preview="$preview" |