summaryrefslogtreecommitdiffstats
path: root/.md/tutorials/vim/how-to-fix-neovim-nerdtree-rendering-issue.md
blob: 1ff6fe72ba864c8b8b73a899abba3116e803f057 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
I really like neovim since [COC](https://github.com/neoclide/coc.nvim)
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

![](/static/media/mess.gif)

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.

![](/static/media/nomess-vim.gif)

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

![](/static/media/mess-terminator.gif)

## 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:

```vimscript
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:

```bash
export TERM='tmux256-color'
```

![](/static/media/fixed.gif)

No more hacky autocommands!

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