fresh2dev / zellij.vim

Vim plugin for integration with Zellij.
MIT License
29 stars 1 forks source link

The plugin causes zellij to lock #2

Closed Eloquencere closed 2 months ago

Eloquencere commented 2 months ago

Hi, I'm aware after reading the README that it's not a bug but a feature. But, I've changed my zellij keybinds to not interfere with nvim. Can I change any settings to prevent the plugin from locking me out of zellij?

fresh2dev commented 2 months ago

I will try to find time to parametrize the autolocking behavior.

In the meantime, you can set g:zellij_navigator_enabled = 0, then configure the plugin however you want.

You can reference: https://github.com/fresh2dev/zellij.vim/blob/main/plugin/zellij_navigator.vim

Eloquencere commented 2 months ago

Thanks a lot! I'll use this as a stop-gap solution in anticipation for the permanent one.

Eloquencere commented 2 months ago

I just implemented the changes you described and I set g:zellij_navigator_enabled = 0 and removed lines 7 & 8. The good part is the plugin doesn't lock zellij and works the way it did before but, it doesn't facilitate my navigation between vim windows so, I'm just stuck on one split and hitting ctrl + h/j/k/l takes me to the other zellij pane. Not what I expected.

fresh2dev commented 2 months ago

I just pushed v0.2.2 which will not create any autocommands with this variable defined:

let g:zellij_navigator_disable_autolock = 1

LMK if this helps 🤙

Eloquencere commented 2 months ago

Yeah, it works(to an extent), it's great that it doesn't lock me out of zellij. But, it seems to exhibit the same issue as before, I'm not able to move between windows within nvim, the traversal commands (Ctrl h/j/k/l) only toggle my focus from one zellij pane to another.

I did try running ZellijNavigateLeft! ZellijNavigateRight! on one of the windows in nvim and it correctly moved the cursor to the other window, but it doesn't seem to be happening with the traversal commands.

fresh2dev commented 2 months ago

Sounds like your Zellij bindings are conflicting with Vim bindings; it is likely that Zellij is intercepting Ctrl h/j/k/l before it gets to Vim. I was able to repro the issue you described, then I removed these conflicting bindings from my Zellij config and observed the expected behavior:

bind "Ctrl h" { MoveFocus "Left"; }
bind "Ctrl l" { MoveFocus "Right"; }
bind "Ctrl j" { MoveFocus "Down"; }
bind "Ctrl k" { MoveFocus "Up"; }

If you want to use the same mappings (Ctrl + h/j/k/l) to seamlessly navigate between Vim windows and Zellij Panes, the autolock mechanism (enabled by the combo of zellij.vim and zellij-autolock) is the only way I've been able to make it work to my satisfaction.

Eloquencere commented 2 months ago

Oh yeah, you are right! It didn't occur to me that zellij is doing that. Thank you so much for putting the effort to sort out the issue. I'll take your advice on zellij-autolock.