Skip to content
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

Cannot moving commit in tmux #3525

Closed
nathan22x3 opened this issue Apr 25, 2024 · 7 comments
Closed

Cannot moving commit in tmux #3525

nathan22x3 opened this issue Apr 25, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@nathan22x3
Copy link

Describe the bug
Moving commit in tmux using shortcut (<c-j> and <c-k> by default) is not working but option in keybindings menu.

To Reproduce
Steps to reproduce the behavior:

  1. Start interactive rebase
  2. Try to moving commits using shortcut
  3. Nothing happened

Expected behavior
Able to moving commit in tmux using shortcut.

Version info:
commit=3675570a391b1a49ddd198b4c7e71e17701d4404, build date=2024-03-23T09:09:11Z, build source=binaryRelease, version=0.41.0, os=darwin, arch=arm64, git version=2.43.0
git version 2.43.0

@nathan22x3 nathan22x3 added the bug Something isn't working label Apr 25, 2024
@mark2185
Copy link
Collaborator

Did you override the <c-k>/<c-j> in your .tmux.conf by any chance?

@nathan22x3
Copy link
Author

Did you override the <c-k>/<c-j> in your .tmux.conf by any chance?

At first I thought I did, but no. I even unbind them, but nothing changed

unbind C-j
unbind C-k

@mark2185
Copy link
Collaborator

Could you please check if tmux list-keys lists C-j somewhere?

I managed to get the desired behavior by unbinding them like this:

unbind -T root -n C-j
unbind -T root -n C-k

@nathan22x3
Copy link
Author

It seems like I used to bind them, but I can't unbind them with your instruction

Could you please check if tmux list-keys lists C-j somewhere?

I managed to get the desired behavior by unbinding them like this:

unbind -T root -n C-j
unbind -T root -n C-k

This is my tmux list-keys look like:

bind-key    -T root         C-j                  if-shell "ps -o state= -o comm= -t '#{pane_tty}'     | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" "send-keys C-j" "select-pane -D"
bind-key    -T root         C-k                  if-shell "ps -o state= -o comm= -t '#{pane_tty}'     | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" "send-keys C-k" "select-pane -U"

@mark2185
Copy link
Collaborator

How do you unbind them? Manually via tmux unbind -T root -n C-j, or adding them to a config and reloading it?

If you're adding it to your config, it could be one of your plugins (if you have any) binds them again so make sure you put the unbind as far down as you can.

@nathan22x3
Copy link
Author

Manually unbind did the job! Thank you so much!

@mark2185
Copy link
Collaborator

mark2185 commented Apr 25, 2024

If you're still using vim and just want to add lazygit to the list of programs that can handle C-j, you can just modify the regex:

- ... | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" "send-keys C-j" "select-pane -D"
+ ... | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?(g?(view|n?vim?x?)(diff)?|lazygit)$'" "send-keys C-j" "select-pane -D"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants