Merge pull request #84 from kml/master

wycats's "disallow insert mode"

An explanation from vguerci@github:

Insert mode can be entered in nerdtree not sure the exact sequence / reason, but i guess that involve using mouse (sounds weird, a bug?) :

- open nerdtree, select a buffer, enter insert mode in buffer.
- select nerdtree buffer with mouse, you're in insert mode.

...then you can easily get E21, E382 errors.
Not a big deal but that can happen, if you use mouse... (which I don't)
(reproduced this on latests macvim (vim 7.3.260) from terminal (vim) or macvim)
This commit is contained in:
Martin Grenfell 2011-08-30 03:58:05 -07:00
commit 9b5851c36c

View File

@ -66,6 +66,7 @@ call s:initVariable("g:NERDTreeShowFiles", 1)
call s:initVariable("g:NERDTreeShowHidden", 0) call s:initVariable("g:NERDTreeShowHidden", 0)
call s:initVariable("g:NERDTreeShowLineNumbers", 0) call s:initVariable("g:NERDTreeShowLineNumbers", 0)
call s:initVariable("g:NERDTreeSortDirs", 1) call s:initVariable("g:NERDTreeSortDirs", 1)
call s:initVariable("g:NERDTreeStopInsert", 0)
call s:initVariable("g:NERDTreeDirArrows", 0) call s:initVariable("g:NERDTreeDirArrows", 0)
if !exists("g:NERDTreeSortOrder") if !exists("g:NERDTreeSortOrder")
@ -169,6 +170,12 @@ command! -n=0 -bar NERDTreeFind call s:findAndRevealPath()
augroup NERDTree augroup NERDTree
"Save the cursor position whenever we close the nerd tree "Save the cursor position whenever we close the nerd tree
exec "autocmd BufWinLeave ". s:NERDTreeBufName ."* call <SID>saveScreenState()" exec "autocmd BufWinLeave ". s:NERDTreeBufName ."* call <SID>saveScreenState()"
if g:NERDTreeStopInsert
"disallow insert mode in the NERDTree
exec "autocmd BufEnter ". s:NERDTreeBufName ."* stopinsert"
endif
"cache bookmarks when vim loads "cache bookmarks when vim loads
autocmd VimEnter * call s:Bookmark.CacheBookmarks(0) autocmd VimEnter * call s:Bookmark.CacheBookmarks(0)