Skip to content
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

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

Open
1 task done
ucomru opened this issue Feb 22, 2024 · 10 comments
Open
1 task done

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

ucomru opened this issue Feb 22, 2024 · 10 comments
Assignees
Labels
bug Something isn't working PRs-welcome I'd love to see a PR for this

Comments

@ucomru
Copy link

ucomru commented Feb 22, 2024

Similar Issues

  • Before filing, I have searched for 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-\>:

  • if last step is vim split -- it's going to the vim last split;
  • if last step is tmux split -- it's going to the tmux last split.

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

@ucomru ucomru added the bug Something isn't working label Feb 22, 2024
@mrjones2014
Copy link
Owner

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

@mrjones2014
Copy link
Owner

@ucomru can you test on latest master?

@mrjones2014
Copy link
Owner

Should be fixed by 5c18899

@mrjones2014
Copy link
Owner

Note: renamed function in f6fcb79

@ucomru
Copy link
Author

ucomru commented Mar 5, 2024

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 mrjones2014 reopened this Mar 5, 2024
@mrjones2014
Copy link
Owner

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
Copy link
Author

ucomru commented Mar 5, 2024

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
Copy link
Author

ucomru commented Mar 18, 2024

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
Copy link
Owner

What do you mean by "explorer"?

@ucomru
Copy link
Author

ucomru commented Mar 18, 2024

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.

@mrjones2014 mrjones2014 added the PRs-welcome I'd love to see a PR for this label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PRs-welcome I'd love to see a PR for this
Projects
None yet
Development

No branches or pull requests

2 participants