-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Executes fzf from fzf-tmux with a process name #1056
Executes fzf from fzf-tmux with a process name #1056
Conversation
Thanks, it makes sense but it seems like this will require an extra level of escaping of arguments. e.g. Is there a clear, simple solution to the issue? I'd like to avoid making it even more complicated than it currently is now. |
3711fed
to
518dc67
Compare
I've made changes and now it supports an extra level of escaping of arguments. I've overwritten the previous commit with --amend. |
@@ -185,7 +185,7 @@ else | |||
cat <<< "\"$fzf\" $opts < $fifo1 > $fifo2; echo \$? > $fifo3 $close" >> $argsf | |||
TMUX=$(echo $TMUX | cut -d , -f 1,2) tmux set-window-option synchronize-panes off \;\ | |||
set-window-option remain-on-exit off \;\ | |||
split-window $opt "$envs bash $argsf" $swap \ | |||
split-window $opt "$envs bash -c 'exec -a fzf bash $argsf'" $swap \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update line 181 as well, which is used when fzf is started without stdin pipe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using sh -c
instead? Although /bin/sh
is no different from /bin/bash
on many systems, sometimes it's linked to a lighter posix-compliant shell such as dash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the PR with your suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, there are failing test cases. Haven't looked into it, it could be an issue of test cases. I'll look into it when I get some time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
518dc67
to
38b8faa
Compare
A couple things I found out:
So it becomes: diff --git a/bin/fzf-tmux b/bin/fzf-tmux
index d7ce7a6..79407e6 100755
--- a/bin/fzf-tmux
+++ b/bin/fzf-tmux
@@ -178,14 +178,14 @@ if [[ -n "$term" ]] || [[ -t 0 ]]; then
cat <<< "\"$fzf\" $opts > $fifo2; echo \$? > $fifo3 $close" >> $argsf
TMUX=$(echo $TMUX | cut -d , -f 1,2) tmux set-window-option synchronize-panes off \;\
set-window-option remain-on-exit off \;\
- split-window $opt "cd $(printf %q "$PWD");$envs bash $argsf" $swap \
+ split-window $opt "$envs bash -c 'cd $(printf %q "$PWD"); exec -a fzf bash $argsf'" $swap \
> /dev/null 2>&1
else
mkfifo $fifo1
cat <<< "\"$fzf\" $opts < $fifo1 > $fifo2; echo \$? > $fifo3 $close" >> $argsf
TMUX=$(echo $TMUX | cut -d , -f 1,2) tmux set-window-option synchronize-panes off \;\
set-window-option remain-on-exit off \;\
- split-window $opt "$envs bash $argsf" $swap \
+ split-window $opt "$envs bash -c 'exec -a fzf bash $argsf'" $swap \
> /dev/null 2>&1
cat <&0 > $fifo1 &
fi |
38b8faa
to
889e1b6
Compare
Thanks a lot. I applied your changes and travis is working. Thanks for your time. |
Thanks, let's merge this and see if anyone complains :) |
This is a little improvement useful for my use case, but feel free declining it.
I'm a tmux user and I uses a key binding which depending on the current execution process does several things.
Currently if fzf is the current execution process, the process name is
bash
. With these changes the process name isfzf
and I'm able to capture it in tmux.