lambdalisue / vim-fern

🌿 General purpose asynchronous tree viewer written in Pure Vim script
MIT License
1.29k stars 49 forks source link

Opens fern-rep buffer in a horizontal split, how to avoid it showing up? #311

Closed poetaman closed 3 years ago

poetaman commented 3 years ago

Since some commit, Fern . or perhaps something like Fern . -drawer also opens a fern-rep buffer in a new split (split made in last focussed buffer). How can I disable that from happening? When I had first installed this plugin, it didn't do anything like that (I just want to see drawer, for instance, when I run Fern . -drawer) Thanks!

Here's a GIF that shows the problem:

Screen Recording 2021-03-13 at 7 49 20 PM

lambdalisue commented 3 years ago

We have no idea. I performed replace action and did same thing but could not reproduced in Vim/Neovim.

https://user-images.githubusercontent.com/546312/111063290-14730880-84f1-11eb-89d2-60ed6c081225.mp4

I think, that behavior comes from your configuration.

See https://github.com/lambdalisue/fern.vim/issues/290#issuecomment-769325553 to try fern.vim with minimal vimrc.

poetaman commented 3 years ago

@lambdalisue Narrowed down to the following minimal configuration. You should be able to reproduce this behavior with it. (of course update the runtime path to yours)

if exists('+compatible') && &compatible
  set nocompatible
endif

set packpath=
set runtimepath^=~/.vim/plugged/fern.vim/
filetype plugin indent on
syntax on

augroup nofoldonopen
    autocmd!
    autocmd BufWinEnter * normal zR
augroup END
lambdalisue commented 3 years ago

Because R is mapped to rename action in fern. Use normal! instead to make sure Vim's native mapping is used instead like

augroup nofoldonopen
    autocmd!
    autocmd BufWinEnter * normal! zR
augroup END
poetaman commented 3 years ago

@lambdalisue Thanks!