Disable root node refresh on window focus
Asked Answered
H

2

8

Whenever I focus my MacVim window it freezes for several seconds. It seems that this is due to NERDTree refreshing it's root node (It prints NERDTree: Refreshing root node. This could take a while... DONE)

Since I often switch in and out of MacVim this is very annoying and slows down my workflow. Is there a way of configuring NERDTree not to do this automatically?

EDIT: I am using janus

Habitancy answered 7/12, 2014 at 21:16 Comment(0)
L
13

I'm going to go out on a limb and say that you're using janus. Janus adds a FocusGained event, and so when you do :au FocusGained as Kazuki mentioned, you'll see something like:

AuNERDTreeCmd  FocusGained
    *         call s:UpdateNERDTree()

You can remove that focus event binding by adding the following to your .vimrc.after:

autocmd! AuNERDTreeCmd FocusGained
Larina answered 18/12, 2014 at 20:54 Comment(1)
Thanks - that worked! I was indeed using janus (I really should have mention in my question - I'm going to add that now). One small comment - I think in janus the appropriate file to add the above command to is .vimrc.afterHabitancy
M
2

I think NERDTree itself doesn't do refresh the root node automatically. Actually I can't reproduce the problem. You need to input R key (default) to refresh the root node.

Whenever I focus my MacVim window it freezes for several seconds

It sounds you are using FocusGained autocommand event to do something. You can check it using the following command.

:au FocusGained

You will get the list of FocusGained autocommand events.

--- Auto-Commands ---
FocusGained
    * ...

For example, you can auto-refresh NERDTree root like this.

Merc answered 16/12, 2014 at 23:20 Comment(1)
Thanks, Kazuki - that pointed me in the correct direction, but I ended up accepting BBonifield's answer because he provided a remedy with it.Habitancy

© 2022 - 2024 — McMap. All rights reserved.