clean up the netrwhijack code and make an option to disable it

This commit is contained in:
Martin Grenfell 2008-12-17 20:55:50 +13:00
parent 6b4dca7361
commit 5ff836ed26

View File

@ -54,8 +54,9 @@ call s:initVariable("g:NERDTreeChDirMode", 0)
if !exists("g:NERDTreeIgnore") if !exists("g:NERDTreeIgnore")
let g:NERDTreeIgnore = ['\~$'] let g:NERDTreeIgnore = ['\~$']
endif endif
call s:initVariable("g:NERDTreeHighlightCursorline", 1)
call s:initVariable("g:NERDTreeBookmarksFile", expand('$HOME') . '/.NERDTreeBookmarks') call s:initVariable("g:NERDTreeBookmarksFile", expand('$HOME') . '/.NERDTreeBookmarks')
call s:initVariable("g:NERDTreeHighlightCursorline", 1)
call s:initVariable("g:NERDTreeHijackNetrw", 1)
call s:initVariable("g:NERDTreeMouseMode", 1) call s:initVariable("g:NERDTreeMouseMode", 1)
call s:initVariable("g:NERDTreeNotificationThreshold", 100) call s:initVariable("g:NERDTreeNotificationThreshold", 100)
call s:initVariable("g:NERDTreeQuitOnOpen", 0) call s:initVariable("g:NERDTreeQuitOnOpen", 0)
@ -156,25 +157,12 @@ augroup NERDTree
autocmd VimEnter * call s:Bookmark.CacheBookmarks(0) autocmd VimEnter * call s:Bookmark.CacheBookmarks(0)
augroup END augroup END
if g:NERDTreeHijackNetrw
augroup NERDTreeNetrwHijack augroup NERDTreeHijackNetrw
autocmd! autocmd VimEnter * autocmd! FileExplorer
autocmd VimEnter * call s:removeNetrw()
au BufEnter * call s:checkForBrowse(expand("<amatch>")) au BufEnter * call s:checkForBrowse(expand("<amatch>"))
augroup END
augroup END endif
function! s:removeNetrw()
autocmd! FileExplorer
endfunction
function! s:checkForBrowse(dir)
if !exists("b:NERDTreeProcessed") && a:dir != '' && isdirectory(a:dir)
let b:NERDTreeProcessed = 1
call s:initNerdTreeInPlace(a:dir)
endif
endfunction
"SECTION: Classes {{{1 "SECTION: Classes {{{1
"============================================================ "============================================================
@ -1677,7 +1665,14 @@ function! s:bufInWindows(bnum)
return cnt return cnt
endfunction " >>> endfunction " >>>
"FUNCTION: s:checkForBrowse(dir) {{{2
"inits a secondary nerd tree in the current buffer if appropriate
function! s:checkForBrowse(dir)
if !exists("b:NERDTreeProcessed") && a:dir != '' && isdirectory(a:dir)
let b:NERDTreeProcessed = 1
call s:initNerdTreeInPlace(a:dir)
endif
endfunction
"FUNCTION: s:compareBookmarks(first, second) {{{2 "FUNCTION: s:compareBookmarks(first, second) {{{2
"Compares two bookmarks "Compares two bookmarks
function! s:compareBookmarks(first, second) function! s:compareBookmarks(first, second)