-
-
Notifications
You must be signed in to change notification settings - Fork 651
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
Seamlessly navigate through tmux/vim #967
Comments
Hi! I also like to use neovim with Zellij. but, currently, the Zellij does not provide that feature. I personally think this feature should be processed in vim/neovim (using plugin). Of course, we can add the feature for vim/nvim, but i don't know if that's the right direction. |
There does need to be some level of zellij (or zellij plugin) specific behavior, since it needs to only conditionally forward the original binding to vim in the even the pane's running process is vim Re the vim side, I'm willing to fork the (n)vim plugin i reference for myself for that side, what's unclear to me is how such a plugin would work. i.e. whether zellij supports the external control required for support it. |
@DanCardin Thanks for the explanation! First, I looked at how So, I thought about whether the above function can be implemented using the current Zellij plugin system. The conclusion seems to be impossible at present. Because by default the Zellij plugin has an isolated environment using WASM. In plugin, there are some convenience function that can communicate with the Host (Zellij Server). For examples, hook the keyboard event. But, the problem is, there is still no function to trigger a specific event of Zellij inside the plugin. For example, the navigation of the pane, etc. Also, it seems difficult to confirm that vim/nvim is currently running. Because the inside of the plugin is a WASM VM, it is isolated from the host's environment variables. Therefore, further development related to WASM is required to implement the You can check which functions the plugin can use through the |
I'm not super tuned into how the plugin interface works, but it seems like a being able to subscribe to an event like this seems like it would be useful elsewhere. For example, I dont know if this is default, but my tmux's tabs automatically display "nvim" or "zsh" as the tab name depending on which is focused in the currently active tab. |
I am also very interested for something like christoomey/vim-tmux-navigator. I think this might be the last thing that keeps me from going completely to zellij. |
I've spent some time looking into this issue to try to create a neovim plugin to mirror the same features as above mentioned plugin. TmuxReading Chris' code, it effectively uses the following cli command to navigate to another frame:
It works! ZellijLuckily for us, zellij has as an action argument where you can navigate using
What gives?! An error! So, unless this bug is fixed which I believe will need some internal refactors of zellij and how it handles communication between client and server, this is blocked. |
@Lilja Thank you for your interest in this feature. I am also constantly interested in this feature, and did some testing after a new version was released. local pipe = io.popen("zellij action move-focus down")
pipe:close() -- necessary I hope this will help you with your work. |
Thanks @jaeheonji! That worked. I created a neovim plugin to solve this problem, Lilja/zellij.nvim which has vim-tmux-navigator compatible keybindings. Feel free to try it out. |
Thank you for making a awesome plugin Lilja/zellij.nvim! But, for natural navigation like tmux-nvigator, there seems to be more to be implemented in zellij side. Therefore, I will keep this issue as it is now. |
Here is something that is getting close. I just need some help sending
It would be nice to be able to
|
From @casonadams find above. I was able to make it work, with a small adjustment. But it's not working well. If you disregard sending
☝️ note the newline. It's important as we need something to press after the command has been completed. This doesn't work fully as the run command will open a pane, because it's expected to be used for running certain long running commands like So we probably need a flag for |
It would be awesome if we could implement this not only for vim but also for helix (or other programs) |
IdeaIn order to achieve this zellij can follow tmux like approach: create a custom "vim locked mode", then use plugin provided by #967 (comment). How it would work
Depends on: |
@Dzordzu I believe your last point might be already addressed (in nvim at least) by this the zellij-nav.nvim plugin. |
It might be obvious to some, but maybe not. If such a partial lock mode existed, it should probably be named something more generic. Maybe "Partial Lock" or "Subprocess Lock" But maybe those two features should be separated?
If the features get separated then "Partial Lock" would make sense If they are joined as a single feature then "Subprocess Lock" might make more sense. |
The recent patch version (0.40.1) adds the ability to:
I think this should give anyone wishing to implement this sort of navigation all the tools they need (more info here: #2434 (comment)) |
I have created a plugin which solves this issue! See vim-zellij-navigator as the Zellij version of vim-tmux-navigator! Currently, it relies on an additional plugin in Neovim to know whether Neovim is running, I will change this to use list-clients once that command becomes available to plugins. |
@hiasr - if you want, until this command is directly available to plugins, you can invoke |
Also @hiasr - if I may offer another suggestion: could be cool if you make the plugin generic: a sort of discrete piece of logic that you can bind to a key and does: "move |
Good idea! I am currently working on migrating towards |
And also, while I'm at it: another piece of advice - I'd recommend not using |
I think this sort of approach is the solution to this problem. I referenced vim-zellij-navigator and built a plugin to support this approach, in pursuit of seamless navigation for Vim and other programs that benefit from The result: fresh2dev/zellij-autolock |
(originally commented about this on reddit and was directed to suggest it here.
The relevant tmux plugin is christoomey/vim-tmux-navigator and the corresponding vim plugin (which i use, there are a few) is aserowy/tmux.nvim.
At a high level, the idea is to bind the same tmux and vim keybinds and for both navigation and pane resize to work contextually to whether vim is focused or not (ideally interacting with vim splits seamlessly also.
The comment on reddit suggested that zellij might be able to get away without a vim plugin. Because of vim split navigation, im skeptical this can be done (fully) without a vim plugin, but I'm personally happy to fork the plugin, so long as the hooks necessary for the vim plugin to function correctly exist (relevant portion of the vim plugin i use)
But in order to be fully specified, i'll lay out the expected behavior in the event it can all be done in zellij, but being aware that if that's not possible, some of the behaviors laid out will be handled by the vim plugin
Given some layout
Suppose keybind of C-h, C-j, C-k, C-l for navigation and M-h, M-j, M-k, M-l resizing:
navigation
resizing
With a similar table for vertical naviation.
I notice that zoom is not currently implemented today. but the above plugins (really just the vim one) have the option to only navigate vim splits when zommed. I.e. disable pane navigation if zoomed. Personally, that's the behavior i have enabled (right now), but just to be aware that this (and i suppose normal pane navigation keybinds) interact with a theoretical zoom feature
The text was updated successfully, but these errors were encountered: