Skip to content

Instantly share code, notes, and snippets.

@enaeseth
Created February 21, 2011 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enaeseth/837628 to your computer and use it in GitHub Desktop.
Save enaeseth/837628 to your computer and use it in GitHub Desktop.
Automatically open NERDTree when running vim with no arguments
function! AutoOpenNERDTree()
if has('gui_running') && argc() == 0
:NERDTree
endif
endfunction
function! AutoFocusAwayFromNERDTree()
if has('gui_running') && argc() == 0
:wincmd l
endif
endfunction
autocmd GUIEnter * call AutoOpenNERDTree()
autocmd VimEnter * call AutoFocusAwayFromNERDTree()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment