Selaa lähdekoodia

remove NERDTree arrows if in OS X

Weiyi Lou 13 vuotta sitten
vanhempi
commit
9cf3ade0f5
1 muutettua tiedostoa jossa 18 lisäystä ja 3 poistoa
  1. 18 3
      vim/vimrc

+ 18 - 3
vim/vimrc

@@ -41,8 +41,13 @@ if has("autocmd")
 
     " Source the vimrc file after saving it
     autocmd bufwritepost .vimrc source $MYVIMRC
-    " so far, this startup just opens NERDTree when there are no arguments
+
+    " A way to specify startup actions
     autocmd VimEnter * call StartUp()
+ 
+    " if the last window is NERDTree, then close Vim
+    "autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif 
+ 
 else
     set autoindent on
 endif
@@ -53,9 +58,10 @@ endif
 """""""""""""""""""""""""""""""""""""""""""""""""""
 function! StartUp()
     " Stuff in here will be called by autocmd below
-    if 0 == argc()
+    " example, start NERDTree if vim called with no arguments
+    "if 0 == argc()
         "NERDTree
-    end
+    "end
 endfunction
 
 
@@ -253,4 +259,13 @@ nnoremap <silent> <expr> $ ScreenMovement("$")
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""
 
 " let g:NERDTreeQuitOnOpen = 1
+
+" Having problems showing NERDTree arrows in OS X
+if has("unix")
+  let s:uname = system("uname")
+  if s:uname == "Darwin"
+    let g:NERDTreeDirArrows=0 
+  endif
+endif
+
 " let g:SuperTabDefaultCompletionType = 'context'