mjfer.net

   

TUTORIALS/VIM/HOW-TO-FIX-NEOVIM-NERDTREE-RENDERING-ISSUE

how-to-fix-neovim-nerdtree-rendering-issue

I really like neovim since COC is integrated with it to work nicely. Plus, I like the defaults and the fact there's a lot of active development on extensions. I didn't use it for a long time because I needed NerdTree but every time I'd scroll the window, I'd get a mess.

The Problem

Now, yes, I know I'm a heretic for using the arrow keys and not just jumping around, but I thought it was weird I didn't see this issue anywhere else. Also, vim doesn't have this problem.

It's also not because of my meme tmux setup, the same issue happens in terminator, which I happened to have installed.

The Attempt

There's a better way to do this, but I first figured just triggering a redraw on scroll would do the trick. You can do so by adding the following line to your init.vim file:

au WinScrolled * redraw!

As it turns out, the "WinScrolled" event only exists in neovim, so this command won't work in plain vim (see :help autocmd-events for the list of events in each program).

The Actual Solution

After installing COC and running a healthcheck, I realized that my TERM variable was set to 'xterm'. I'm not sure if I did that intentionally to run something or if it's just a legacy thing I left in from Debian's default bashrc, but all I had to do was change it:

export TERM='tmux256-color'

No more hacky autocommands!

If I had the foresight to test the issue in xterm first, I probably would have seen it right away....

Go up to parent folder (/tutorials/vim)

CC0
To the extent possible under law, The author has waived all copyright and related or neighboring rights to content on mjfer.net. All work may be cited without attribution at the reader's discretion. However, if you do use the work here, or otherwise benefit from it, the author would love to hear about it! This work is published from: United States.