tmux is showing zsh for vim with `pane_current_command`

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












For some reason Tmux is showing zsh when it should be showing vim for the output of #pane_current_command, this is screwing up my vim aware pane moving commands in tmux which rely on it working correctly:



# vim aware commands
# pane/split switching
bind -n C-h run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L" #left
bind -n C-j run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D" #down
bind -n C-k run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U" #up
bind -n C-l run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R" #right
bind -n C- run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys 'C-\') || tmux select-pane -l" #next
# pane/split creation
bind | run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-w && tmux send-keys v) || tmux split-window -h" #verticle
bind - run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-w && tmux send-keys s) || tmux split-window -v" #horizontal
# pane/split close
bind x run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-w && tmux send-keys q) || tmux kill-pane "


I'm starting vim via an alias:



alias vim='rbenv only -r 2.3.5 -c "/usr/local/bin/vim" $@'


it is indeed the alias the causing the issue, How do I fix this, is there any way to set the name of the current process?



I found jobs -Z but that doesn't seem to work for an alias.







share|improve this question






















  • Not sure it can help, but I had a similar problem with mutt a few days ago, and posted about it here.
    – Rastapopoulos
    Oct 20 '17 at 11:51











  • I'm just guessing but I imagine tmux just looks up the immediate child process with ps or by looking at /proc files (in your case the child is zsh and vim is a "grandchild" process) and there's nothing you'll be able to do to change that short of hacking tmux code (or, in this example, invoking vim directly, not through intermediate shell). Or write/find code that let's you customize process name from the process (I know it's possible) and wrap your zsh/vim invocation in that. (!!)
    – B Layer
    Oct 20 '17 at 15:01







  • 1




    BTW, I'm assuming rbenv launches a subshell within which your command runs. That would explain the behavior you're seeing. Things might be better if instead it did exec.
    – B Layer
    Oct 20 '17 at 15:12











  • Yeah, I think that's pretty much it as well, any idea on how to fix this?
    – Thermatix
    Oct 23 '17 at 7:27














up vote
0
down vote

favorite












For some reason Tmux is showing zsh when it should be showing vim for the output of #pane_current_command, this is screwing up my vim aware pane moving commands in tmux which rely on it working correctly:



# vim aware commands
# pane/split switching
bind -n C-h run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L" #left
bind -n C-j run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D" #down
bind -n C-k run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U" #up
bind -n C-l run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R" #right
bind -n C- run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys 'C-\') || tmux select-pane -l" #next
# pane/split creation
bind | run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-w && tmux send-keys v) || tmux split-window -h" #verticle
bind - run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-w && tmux send-keys s) || tmux split-window -v" #horizontal
# pane/split close
bind x run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-w && tmux send-keys q) || tmux kill-pane "


I'm starting vim via an alias:



alias vim='rbenv only -r 2.3.5 -c "/usr/local/bin/vim" $@'


it is indeed the alias the causing the issue, How do I fix this, is there any way to set the name of the current process?



I found jobs -Z but that doesn't seem to work for an alias.







share|improve this question






















  • Not sure it can help, but I had a similar problem with mutt a few days ago, and posted about it here.
    – Rastapopoulos
    Oct 20 '17 at 11:51











  • I'm just guessing but I imagine tmux just looks up the immediate child process with ps or by looking at /proc files (in your case the child is zsh and vim is a "grandchild" process) and there's nothing you'll be able to do to change that short of hacking tmux code (or, in this example, invoking vim directly, not through intermediate shell). Or write/find code that let's you customize process name from the process (I know it's possible) and wrap your zsh/vim invocation in that. (!!)
    – B Layer
    Oct 20 '17 at 15:01







  • 1




    BTW, I'm assuming rbenv launches a subshell within which your command runs. That would explain the behavior you're seeing. Things might be better if instead it did exec.
    – B Layer
    Oct 20 '17 at 15:12











  • Yeah, I think that's pretty much it as well, any idea on how to fix this?
    – Thermatix
    Oct 23 '17 at 7:27












up vote
0
down vote

favorite









up vote
0
down vote

favorite











For some reason Tmux is showing zsh when it should be showing vim for the output of #pane_current_command, this is screwing up my vim aware pane moving commands in tmux which rely on it working correctly:



# vim aware commands
# pane/split switching
bind -n C-h run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L" #left
bind -n C-j run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D" #down
bind -n C-k run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U" #up
bind -n C-l run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R" #right
bind -n C- run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys 'C-\') || tmux select-pane -l" #next
# pane/split creation
bind | run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-w && tmux send-keys v) || tmux split-window -h" #verticle
bind - run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-w && tmux send-keys s) || tmux split-window -v" #horizontal
# pane/split close
bind x run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-w && tmux send-keys q) || tmux kill-pane "


I'm starting vim via an alias:



alias vim='rbenv only -r 2.3.5 -c "/usr/local/bin/vim" $@'


it is indeed the alias the causing the issue, How do I fix this, is there any way to set the name of the current process?



I found jobs -Z but that doesn't seem to work for an alias.







share|improve this question














For some reason Tmux is showing zsh when it should be showing vim for the output of #pane_current_command, this is screwing up my vim aware pane moving commands in tmux which rely on it working correctly:



# vim aware commands
# pane/split switching
bind -n C-h run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L" #left
bind -n C-j run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D" #down
bind -n C-k run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U" #up
bind -n C-l run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R" #right
bind -n C- run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys 'C-\') || tmux select-pane -l" #next
# pane/split creation
bind | run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-w && tmux send-keys v) || tmux split-window -h" #verticle
bind - run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-w && tmux send-keys s) || tmux split-window -v" #horizontal
# pane/split close
bind x run "(tmux display-message -p '#pane_current_command' | grep -iq vim && tmux send-keys C-w && tmux send-keys q) || tmux kill-pane "


I'm starting vim via an alias:



alias vim='rbenv only -r 2.3.5 -c "/usr/local/bin/vim" $@'


it is indeed the alias the causing the issue, How do I fix this, is there any way to set the name of the current process?



I found jobs -Z but that doesn't seem to work for an alias.









share|improve this question













share|improve this question




share|improve this question








edited Oct 23 '17 at 9:21

























asked Oct 20 '17 at 11:24









Thermatix

19918




19918











  • Not sure it can help, but I had a similar problem with mutt a few days ago, and posted about it here.
    – Rastapopoulos
    Oct 20 '17 at 11:51











  • I'm just guessing but I imagine tmux just looks up the immediate child process with ps or by looking at /proc files (in your case the child is zsh and vim is a "grandchild" process) and there's nothing you'll be able to do to change that short of hacking tmux code (or, in this example, invoking vim directly, not through intermediate shell). Or write/find code that let's you customize process name from the process (I know it's possible) and wrap your zsh/vim invocation in that. (!!)
    – B Layer
    Oct 20 '17 at 15:01







  • 1




    BTW, I'm assuming rbenv launches a subshell within which your command runs. That would explain the behavior you're seeing. Things might be better if instead it did exec.
    – B Layer
    Oct 20 '17 at 15:12











  • Yeah, I think that's pretty much it as well, any idea on how to fix this?
    – Thermatix
    Oct 23 '17 at 7:27
















  • Not sure it can help, but I had a similar problem with mutt a few days ago, and posted about it here.
    – Rastapopoulos
    Oct 20 '17 at 11:51











  • I'm just guessing but I imagine tmux just looks up the immediate child process with ps or by looking at /proc files (in your case the child is zsh and vim is a "grandchild" process) and there's nothing you'll be able to do to change that short of hacking tmux code (or, in this example, invoking vim directly, not through intermediate shell). Or write/find code that let's you customize process name from the process (I know it's possible) and wrap your zsh/vim invocation in that. (!!)
    – B Layer
    Oct 20 '17 at 15:01







  • 1




    BTW, I'm assuming rbenv launches a subshell within which your command runs. That would explain the behavior you're seeing. Things might be better if instead it did exec.
    – B Layer
    Oct 20 '17 at 15:12











  • Yeah, I think that's pretty much it as well, any idea on how to fix this?
    – Thermatix
    Oct 23 '17 at 7:27















Not sure it can help, but I had a similar problem with mutt a few days ago, and posted about it here.
– Rastapopoulos
Oct 20 '17 at 11:51





Not sure it can help, but I had a similar problem with mutt a few days ago, and posted about it here.
– Rastapopoulos
Oct 20 '17 at 11:51













I'm just guessing but I imagine tmux just looks up the immediate child process with ps or by looking at /proc files (in your case the child is zsh and vim is a "grandchild" process) and there's nothing you'll be able to do to change that short of hacking tmux code (or, in this example, invoking vim directly, not through intermediate shell). Or write/find code that let's you customize process name from the process (I know it's possible) and wrap your zsh/vim invocation in that. (!!)
– B Layer
Oct 20 '17 at 15:01





I'm just guessing but I imagine tmux just looks up the immediate child process with ps or by looking at /proc files (in your case the child is zsh and vim is a "grandchild" process) and there's nothing you'll be able to do to change that short of hacking tmux code (or, in this example, invoking vim directly, not through intermediate shell). Or write/find code that let's you customize process name from the process (I know it's possible) and wrap your zsh/vim invocation in that. (!!)
– B Layer
Oct 20 '17 at 15:01





1




1




BTW, I'm assuming rbenv launches a subshell within which your command runs. That would explain the behavior you're seeing. Things might be better if instead it did exec.
– B Layer
Oct 20 '17 at 15:12





BTW, I'm assuming rbenv launches a subshell within which your command runs. That would explain the behavior you're seeing. Things might be better if instead it did exec.
– B Layer
Oct 20 '17 at 15:12













Yeah, I think that's pretty much it as well, any idea on how to fix this?
– Thermatix
Oct 23 '17 at 7:27




Yeah, I think that's pretty much it as well, any idea on how to fix this?
– Thermatix
Oct 23 '17 at 7:27










1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










Ok, so after seeing the comment left by @B-Layer I created a simple bash function to replace the alias I was using that allows me to have my cake and eat it!



The function:



function vim()

cmd="exec /usr/local/bin/vim $@"
rbenv only -r $GLOBAL_RUB_VERSION -c "$cmd";



Now it allows me to start vim using rbenv only so it always starts with the same version of ruby that vim was compiled against. Now (the reason for this song and dance) YouCompleteMe won't ever complain/crash because I switched ruby versions.






share|improve this answer






















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f399329%2ftmux-is-showing-zsh-for-vim-with-pane-current-command%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    Ok, so after seeing the comment left by @B-Layer I created a simple bash function to replace the alias I was using that allows me to have my cake and eat it!



    The function:



    function vim()

    cmd="exec /usr/local/bin/vim $@"
    rbenv only -r $GLOBAL_RUB_VERSION -c "$cmd";



    Now it allows me to start vim using rbenv only so it always starts with the same version of ruby that vim was compiled against. Now (the reason for this song and dance) YouCompleteMe won't ever complain/crash because I switched ruby versions.






    share|improve this answer


























      up vote
      1
      down vote



      accepted










      Ok, so after seeing the comment left by @B-Layer I created a simple bash function to replace the alias I was using that allows me to have my cake and eat it!



      The function:



      function vim()

      cmd="exec /usr/local/bin/vim $@"
      rbenv only -r $GLOBAL_RUB_VERSION -c "$cmd";



      Now it allows me to start vim using rbenv only so it always starts with the same version of ruby that vim was compiled against. Now (the reason for this song and dance) YouCompleteMe won't ever complain/crash because I switched ruby versions.






      share|improve this answer
























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        Ok, so after seeing the comment left by @B-Layer I created a simple bash function to replace the alias I was using that allows me to have my cake and eat it!



        The function:



        function vim()

        cmd="exec /usr/local/bin/vim $@"
        rbenv only -r $GLOBAL_RUB_VERSION -c "$cmd";



        Now it allows me to start vim using rbenv only so it always starts with the same version of ruby that vim was compiled against. Now (the reason for this song and dance) YouCompleteMe won't ever complain/crash because I switched ruby versions.






        share|improve this answer














        Ok, so after seeing the comment left by @B-Layer I created a simple bash function to replace the alias I was using that allows me to have my cake and eat it!



        The function:



        function vim()

        cmd="exec /usr/local/bin/vim $@"
        rbenv only -r $GLOBAL_RUB_VERSION -c "$cmd";



        Now it allows me to start vim using rbenv only so it always starts with the same version of ruby that vim was compiled against. Now (the reason for this song and dance) YouCompleteMe won't ever complain/crash because I switched ruby versions.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 18 '17 at 14:29









        Jeff Schaller

        32.1k849109




        32.1k849109










        answered Oct 23 '17 at 9:17









        Thermatix

        19918




        19918



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f399329%2ftmux-is-showing-zsh-for-vim-with-pane-current-command%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay