diff --git a/vimrcs/extended.vim b/vimrcs/extended.vim index 255a31cfca..6110d79570 100644 --- a/vimrcs/extended.vim +++ b/vimrcs/extended.vim @@ -10,7 +10,8 @@ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Set font according to system if has("mac") || has("macunix") - set gfn=Source\ Code\ Pro:h15,Menlo:h15 + " set gfn=Source\ Code\ Pro:h15,Menlo:h15 + set gfn=Source\ Code\ Pro:h12,Menlo:h12 elseif has("win16") || has("win32") set gfn=Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11 elseif has("linux") @@ -19,11 +20,11 @@ elseif has("unix") set gfn=Monospace\ 11 endif -" Open MacVim in fullscreen mode -if has("gui_macvim") - set fuoptions=maxvert,maxhorz - au GUIEnter * set fullscreen -endif +" " Open MacVim in fullscreen mode +" if has("gui_macvim") +" set fuoptions=maxvert,maxhorz +" au GUIEnter * set fullscreen +" endif " Disable scrollbars (real hackers don't use scrollbars for navigation!) set guioptions-=r diff --git a/vimrcs/my_config.vim b/vimrcs/my_config.vim new file mode 100644 index 0000000000..e19c1e53f1 --- /dev/null +++ b/vimrcs/my_config.vim @@ -0,0 +1,35 @@ +" always show line numbers +set number + +" autmoatically load NERDTree with vim +autocmd VimEnter * NERDTree +" and put the cursor in editor window +autocmd VimEnter * wincmd p + +" exit NERDTree when the only window is closed +" https://github.com/scrooloose/nerdtree/issues/21 +function! NERDTreeQuit() + redir => buffersoutput + silent buffers + redir END + + " 1BufNo 2Mods. 3File 4LineNo + let pattern = '^\s*\(\d\+\)\(.....\) "\(.*\)"\s\+line \(\d\+\)$' + let windowfound = 0 + + for bline in split(buffersoutput, "\n") + let m = matchlist(bline, pattern) + + if (len(m) > 0) + if (m[2] =~ '..a..') + let windowfound = 1 + endif + endif + endfor + + if (!windowfound) + quitall + endif +endfunction + +autocmd WinEnter * call NERDTreeQuit()