jesseduffield/lazygit

Cannot moving commit in tmux

nathan22x3 opened this issue · 7 comments

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

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

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

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

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"

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.

Manually unbind did the job! Thank you so much!

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"