Closed ldelossa closed 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?
@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.
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' }
.
@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:
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:
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:
Contents of the buffers are arbitrary, just the layout is what I'm expressing.
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?
@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)
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
I get this result afterwards. Steps:
:NnnPicker
enter
:NnnPicker
<c-x>
to open it in a split:NnnPicker
<c-v>
to open it in a vertical split@mcchrish my fault, plug didn't update to the latest commit. This in fact working now!
Thanks this is a much better workflow now.
@ldelossa welcome! and thanks for the detailed bug report.
Anytime.
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.