numToStr / Navigator.nvim

:sparkles: Smoothly navigate between neovim and terminal multiplexer(s) :sparkles:
MIT License
391 stars 21 forks source link

Option to move between panes "circularly" #10

Open mrjones2014 opened 2 years ago

mrjones2014 commented 2 years ago

Not sure if the title makes sense, and actually not even sure this is possible with the Neovim API, but basically what I want is, if my cursor is in the leftmost split, and I call require('Navigator').left(), it should go to the rightmost split.

This already works this way with the tmux panes, but not with Neovim splits.

Example of how it works in tmux splits:

CleanShot-2022-03-18-at-09 19 51

vs. in Neovim splits

CleanShot-2022-03-18-at-09 22 28

Does that make sense? Not sure if I explained that too well 😅

numToStr commented 2 years ago

Navigating only between neovim splits is not the goal of this plugin but to move b/w nvim and tmux.

That being said, I won't promise you that i'll implement this but i can try and see if this feels home to me ;)

mrjones2014 commented 2 years ago

Awesome! Let me know if you figure out how to detect if we're currently in the leftmost/rightmost split inside Neovim, I wanted to figure that out for something else too (an idea I had for "smart" window resizing)

numToStr commented 2 years ago

Awesome! Let me know if you figure out how to detect if we're currently in the leftmost/rightmost split inside Neovim

You can do something like

prev_win --> wincmd h | l --> check cur_win == prev_win

I used the same logic to move out from neovim to tmux

mrjones2014 commented 2 years ago

Amazing, thanks! that worked perfectly.

declancm commented 2 years ago

I implemented this in a repo fork if you ever want the feature added :)

mrjones2014 commented 2 years ago

Ended up implementing this functionality in my own smart-splits.nvim plugin, since I don't really use tmux splits often anymore. I mostly use tmux floating windows.

numToStr commented 2 years ago

@declancm I'll be happy to review a PR for it :)