Created
January 28, 2011 18:24
-
-
Save utsengar/800687 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment