Start NERDTree when starting Vim

6 views
Skip to first unread message

Simon Ruderich

unread,
Dec 2, 2008, 3:10:06 PM12/2/08
to vim...@googlegroups.com
Hi,

I'm trying to automatically start NERDTree when Vim is started. This worked
fine:

autocmd VimEnter * NERDTree

But this leaves the NERDTree window active and I want the new window to be
active so I can start working without <C-w>h. Can this be done?

Another question regarding NERDTree: Is it possible that the NERDTree window
is automatically closed when I close all normal windows (like it works with
help pages)?

Thanks for your help,
Simon
--
+ privacy is necessary
+ using http://gnupg.org
+ public key id: 0x6115F804EFB33229

Matt Wozniski

unread,
Dec 2, 2008, 5:44:28 PM12/2/08
to vim...@googlegroups.com
On Tue, Dec 2, 2008 at 3:10 PM, Simon Ruderich wrote:
> Hi,
>
> I'm trying to automatically start NERDTree when Vim is started. This worked
> fine:
>
> autocmd VimEnter * NERDTree
>
> But this leaves the NERDTree window active and I want the new window to be
> active so I can start working without <C-w>h. Can this be done?

autocmd VimEnter * exe 'NERDTree' | wincmd l

works for me, though change that last l to an h if NERDTree opens on
the right for you...

> Another question regarding NERDTree: Is it possible that the NERDTree window
> is automatically closed when I close all normal windows (like it works with
> help pages)?

I'm not sure what the best way to do this one is.

~Matt

Simon Ruderich

unread,
Dec 3, 2008, 9:18:44 AM12/3/08
to vim...@googlegroups.com
On Tue, Dec 02, 2008 at 05:44:28PM -0500, Matt Wozniski wrote:
>
> autocmd VimEnter * exe 'NERDTree' | wincmd l
>
> works for me, though change that last l to an h if NERDTree opens on
> the right for you...

Thanks, this works perfectly.

Reply all
Reply to author
Forward
0 new messages