alexghergh / nvim-tmux-navigation

Easy Neovim-Tmux navigation, completely written in Lua
MIT License
273 stars 21 forks source link

Always switch tmux panes in floating windows #22

Open toupeira opened 3 months ago

toupeira commented 3 months ago

Another one :grinning:

This fixes a problem with floating windows, usually navigating away from these inside Vim is weird because the cursor might end up behind the window.

This is really only an issue with large windows like :Lazy or fzf-lua popups, with smaller floating windows it might still make sense to want to navigate windows. So let me know if this should be behind an option too.

alexghergh commented 2 months ago

Ah,

This is an interesting one. I don't usually work with floating windows much, but I understand if this is something desirable. I'm completely fine to make this an option exposed to the user.

Additionally, we could check if the floating window is covering most of the screen (i.e. 70-80-90% of width/height) and automatically enable/disable the option (this would be an auto mode, I suppose).

There's a few friction points to investigate; i.e. what happens when the tmux pane gets zoomed/unzoomed, what happens when you resize the floating window, what happens on multiple floating windows etc.

I think first of all we would need a working version, though, and then we could worry about the above.

Again, thank you for the pull request! Let me know your thoughts.

toupeira commented 2 months ago

Rebased on https://github.com/alexghergh/nvim-tmux-navigation/pull/22 for the configuration changes, marking this PR as draft until that one's merged.

I added a setting skip_floating now, will also add that to the README later.

I tried implementing a basic auto behaviour (looking at height > 75%) but then wasn't sure how to actually test it :sweat_smile: Navigating with Ctrl-W+hjkl doesn't seem to select floating windows, and I'm not sure how else to access them without using the mouse. So I discarded that part again, but if you want to give it a try it boils down to checking:

nvim_win_get_config(0).height >= vim.o.lines * 0.8
alexghergh commented 2 months ago

Alright, let me take a look at this in the next few days and I'll be back with a resolution on this.

Off the top of my head, you can simply Ctrl-W+w to navigate windows without specifying a direction. You can also prepend a count.

toupeira commented 2 months ago

My thinking was more: Who's actually going to use this auto mode? I personally don't find it useful since navigating between floating windows is tricky anyway, so I don't want to sink too much time into it :wink: