mcchrish / nnn.vim

File manager for vim/neovim powered by n³
BSD 2-Clause "Simplified" License
646 stars 25 forks source link

opening up nested horizontal split overlaps other buffers #27

Closed ldelossa closed 5 years ago

ldelossa commented 5 years ago

How to repeat:

Open 4 buffers with in this format

| 1 | 2 |


| 3 | 4 |

Now place your focus on on buffer 2. Open Nnn and use "ctrl-x" to open a horizontal split. This split will make 2, 5 (the new buffer) and 4 overtake 1 and 2.

I used the key mappings in the readme to get ctrl-x to work.

If I just play around with the opening in splits, the behavior is strange. Sometimes if I focus on area 2, and go to open a horizontal split, it simply just opens the file in buffer 2. Now if I go to vertical split a file, it removes buffers 2 and 4 all together.

mcchrish commented 5 years ago

So you mean the other buffer windows are being closed when opening a file via nnn using the custom action key-bindings? What's your vim/neovim version?

ldelossa commented 5 years ago

@mcchrish

I went to retry this, but now I cannot get ctrl-x and crtl-v to open in a split. Is there a known issue? Here is my vimrc - https://github.com/ldelossa/dotfiles/blob/master/vimrc

When I attempt a ctrl-x in the nnn window, it simply opens the file in the current buffer, no split is used.

mcchrish commented 5 years ago

Hi @ldelossa thanks for getting back on the issue. I'm able to replicate the bug. I made a branch that contains a fix to be tested. You can test it using Plug 'mcchrish/nnn.vim', { 'branch': 'fix-issue-27' }.

ldelossa commented 5 years ago

@mcchrish that did fix the issue. And now I can give a better example of the issue I face.

Open one buffer, and have nnn open a horizontal split: image

Now I put focus on the buffer below, and I open nnn, and I want to make a vertical split. My assumption is that the bottom buffer gets split into two. But instead a vertical split takes over both buffers:

image

There is also a quick error message that pops up when attempting to do that which I didn't catch.

My desired result using netrw is as follows:

image

Contents of the buffers are arbitrary, just the layout is what I'm expressing.

mcchrish commented 5 years ago

You can check the error my running :messages.

I think I got it fixed. It might be due to the split explorer feature I've added, and the internal logic of switching back previous buffer from the nnn buffer after opening a file. Do you mind testing again?

ldelossa commented 5 years ago

@mcchrish looks like the issue is still there. It seems like any buffer manipulation I try that involves more then two spits (whether horizontal or vertical) results in only two buffers (the newly created split is just placed as a full length vertical or horizontal buffer with the other one currently in focus)

mcchrish commented 5 years ago

I somehow able to replicate the issue, but fixed in the latest commit.

What's the output of :messages after seeing the issue? Can you reproduce it with a minimal vimrc? e.g.

" minimalvimrc file
set nocompatible
set noswapfile

call plug#begin('~/.local/share/nvim/plugged')
Plug 'mcchrish/nnn.vim', { 'branch': 'fix-issue-27' }
call plug#end()

let g:nnn#action = {
      \ '<c-x>': 'split',
      \ '<c-v>': 'vsplit' }

Then nvim -u minimalvimrc

mcchrish commented 5 years ago
screen shot 2019-01-22 at 8 54 59 am

I get this result afterwards. Steps:

  1. open nvim
  2. run :NnnPicker
  3. open a file pressing enter
  4. run :NnnPicker
  5. open a file pressing <c-x> to open it in a split
  6. focus on the split below
  7. run :NnnPicker
  8. open a file pressing <c-v> to open it in a vertical split
ldelossa commented 5 years ago

@mcchrish my fault, plug didn't update to the latest commit. This in fact working now!

Thanks this is a much better workflow now.

mcchrish commented 5 years ago

@ldelossa welcome! and thanks for the detailed bug report.

ldelossa commented 5 years ago

Anytime.