nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 9b5851c36cc7db04a2122aece2cd656c18e940a6
parent 2dd198c6c412b4ddd361b43586b01981e8383239
Author: Martin Grenfell <martin.grenfell@gmail.com>
Date:   Tue, 30 Aug 2011 03:58:05 -0700

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)

Diffstat:
Mplugin/NERD_tree.vim | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -66,6 +66,7 @@ call s:initVariable("g:NERDTreeShowFiles", 1)
 call s:initVariable("g:NERDTreeShowHidden", 0)
 call s:initVariable("g:NERDTreeShowLineNumbers", 0)
 call s:initVariable("g:NERDTreeSortDirs", 1)
+call s:initVariable("g:NERDTreeStopInsert", 0)
 call s:initVariable("g:NERDTreeDirArrows", 0)
 
 if !exists("g:NERDTreeSortOrder")
@@ -169,6 +170,12 @@ command! -n=0 -bar NERDTreeFind call s:findAndRevealPath()
 augroup NERDTree
     "Save the cursor position whenever we close the nerd tree
     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
     autocmd VimEnter * call s:Bookmark.CacheBookmarks(0)