mrjones2014 / smart-splits.nvim

🧠 Smart, seamless, directional navigation and resizing of Neovim + terminal multiplexer splits. Supports tmux, Wezterm, and Kitty. Think about splits in terms of "up/down/left/right".
MIT License
923 stars 39 forks source link

[Bug]: Is impossible to set `Previous` using <C-\> #157

Open ucomru opened 7 months ago

ucomru commented 7 months ago

Similar Issues

Neovim Version

Good day! I use AstroNvim, which is using smart-splits.nvim as default move split plug. With tmux and vim I use christoomey/vim-tmux-navigator. According smart-splits.nvim/README:

bind -n C-\\ if -F "#{@pane-is-vim}" 'send-keys C-\\\\' 'select-pane -l'

smart-splits.nvim do not have previously function like: require('smart-splits').move_cursor_previously), witch may be sated as <C-\>.

*christoomey in the vim-tmux-navigator use tmux_last_pane with direction == 'p' as previous:

function! s:TmuxAwareNavigate(direction)
  let nr = winnr()
  let tmux_last_pane = (a:direction == 'p' && s:tmux_is_last_pane)
  if !tmux_last_pane
    call s:VimNavigate(a:direction)
. . .

I think, many other using and smart-splits.nvim with nvim, and vim-tmux-navigator with vim, because vim using with ssh, crypto vim files, and ...


On other hand, is not right to use force: bind -n C-\\ 'select-pane -l', because vim-tmux-navigator is using smart navigation <C-\>:

Multiplexer Integration

tmux

Multiplexer Version

tmux 3.4

Steps to Reproduce

  1. Create vertical split
  2. push <C->
  3. Nothing.

Expected Behavior

Navigate previously direction according to tmux_last_pane and nvim_last_pane

Actual Behavior

Do nothing.

Minimal Configuration to Reproduce

Additional Details and/or Screenshots

No response

mrjones2014 commented 7 months ago

Sounds like something we should be able to fix. Thanks for the bug report!

mrjones2014 commented 7 months ago

@ucomru can you test on latest master?

mrjones2014 commented 7 months ago

Should be fixed by 5c18899

mrjones2014 commented 7 months ago

Note: renamed function in f6fcb79

ucomru commented 7 months ago

Good day. I was away from keyboard yesterday... I tasted and have 2 things:

1) Now <C-\> working inside the nvim only. If I using tmux 2 panels and nvim in one of it + active panel not with nvim, then put <C-\>, panel switch to the nvim and switch stopping there. If nvim with 2 local panels, the <C-\> switch don't go to the prev tux panel, but switch inside the nvim panels. Its sims tux last status do not work for me.

2) The second is the logically problem with nvim split. If I have single nvim area A and splitting in to the 2 areas, Im getting second area B with became active. A - old panel; B - new active panel. In this case <C-\> is doing nothing. <C-\> will be work after or .

mrjones2014 commented 7 months ago

Your number 2 there sounds like not a problem with the plugin, but rather, you're looking for the splitright option, see :h splitright. It sounds like what split B is actually the original split, so that's why it's not working, because the active window hasn't actually changed. Split A (the unfocused one) is actually the new split.

Number 1 sounds like something we may be able to fix.

ucomru commented 7 months ago

Your number 2 there sounds like not a problem with the plugin, but rather, you're looking for the splitright option, see :h splitright. It sounds like what split B is actually the original split, so that's why it's not working, because the active window hasn't actually changed. Split A (the unfocused one) is actually the new split.

I want to specify at once. As you can to see my English is crazy. Therefore my some words may look strange or a little aggressively. But it because of language misunderstanding. Im no trying to say, that the plugin something wrong. It looks perfect. My target is to say how it's looking from outside.

At num 1 I wrote the result of comparing of christoomey/vim-tmux-navigator and smart-splits.nvim. I think if possible to do according to the num 1, it will be more perfect, more human friendly ;-) I know that your are right with program logic with splitting. But on the other side, human logic are (on my opinion): Im getting new split, the second split - are previous.... About splitright I wrote. As I understand, it's gettin switch on/off change the focus to a new split. With christoomey/vim-tmux-navigator it works with spr and nospr.

Thanks a lot!

ucomru commented 6 months ago

Good day! I wish to add some more things about C-\ with new split. When I toggle explorer first time, the explorer split is creating. On the other toggle it's showing, but not creating. That is, at the first toggling of explorer C-\ are nit working.

I think it's not simple to do it. But, its can to be very friendly option!

Many thanks for you!!!

mrjones2014 commented 6 months ago

What do you mean by "explorer"?

ucomru commented 6 months ago

What do you mean by "explorer"?

Im sorry, I mean NeoTree file explorer. It usually toggled with <leader>e. At the first toggling , its creating new windows area.