preservim / nerdtree

A tree explorer plugin for vim.
Do What The F*ck You Want To Public License
19.56k stars 1.44k forks source link

Opening nerdtree with :NERDTree shows `Press ENTER or type command to continue` after opening it #1336

Closed darthdeus closed 10 months ago

darthdeus commented 1 year ago

Environment

Steps to Reproduce the Issue

  1. run :NERDTree

Current Behavior (Include screenshots where appropriate.)

A Press ENTER or type command to continue message appears, and NERDTree opens only after hitting ENTER

image

Expected Result

NERDTree opens immediately. This used to work until about a month or two ago, but seems the behavior changed. Commenting out the following line fixes the issue https://github.com/preservim/nerdtree/blob/master/autoload/nerdtree.vim#L221

Maybe I'm misunderstanding the purpose of this call, but shouldn't it rather be

function! nerdtree#echo(msg) abort
    redraw
    if !empty(a:msg)
        echomsg 'NERDTree: ' . a:msg
    endif
endfunction

to avoid echoing an empty message when there's nothing to show?

imLew commented 1 year ago

I can't say for sure but I think with the change you propose the behaviour of that function would change. Afaict right now it echoes as empty message if the argument is an empty message, and other prepends "NERDtree: " to the argument and then echoes it. With your change it would only do the latter and simply do nothing when the argument is empty.

Anyway, for me calling :NERDtree works as expected. I am also using neovim v0.8.1 and NERDtree 6.10.16. Did you try with all other plugins disable? e.g. with neovim -u testrc where testrc is a file that only loads NERDtree.

unplugred commented 1 year ago

Not sure if that's what the author is experiencing, but I've been getting similar problems when set cmdheight=0 or lua vim.o.ch=0 is set in vimrc

rzvxa commented 10 months ago

This problem isn't specific to NERDTree and is unreproducible there is most likely another issue in your configuration, I'm going to close this issue since it's been a while since the last comment here feel free to reopen it with a minimal Vim/Neovim configuration that can reproduce this issue.