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

chopper
  • 6,649
  • 7
  • 36
  • 53

2 Answers2

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
BBonifield
  • 4,983
  • 19
  • 36
  • 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.after` – chopper Dec 20 '14 at 13:01
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.

Community
  • 1
  • 1
Kazuki Sakamoto
  • 13,929
  • 2
  • 34
  • 96
  • Thanks, Kazuki - that pointed me in the correct direction, but I ended up accepting BBonifield's answer because he provided a remedy with it. – chopper Dec 20 '14 at 13:03