nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 82c93a64486c5eaab437ae1adebcff2723688eb9
parent 49b88757b019143ec6604b35c399de8f9bd2d954
Author: Martin Grenfell <martin.grenfell@gmail.com>
Date:   Wed, 21 Dec 2011 12:50:05 +0000

Merge remote-tracking branch 'gnap/master'

Diffstat:
Mplugin/NERD_tree.vim | 190++++++++++++++++++++++++++++++++++++++++----------------------------------------
Asyntax/nerdtree.vim | 88+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 183 insertions(+), 95 deletions(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -2694,9 +2694,9 @@ function! s:initNerdTreeInPlace(dir)
     call s:bindMappings()
     setfiletype nerdtree
     " syntax highlighting
-    if has("syntax") && exists("g:syntax_on")
-        call s:setupSyntaxHighlighting()
-    endif
+    "if has("syntax") && exists("g:syntax_on")
+        "call s:setupSyntaxHighlighting()
+    "endif
 
     call s:renderView()
 endfunction
@@ -2925,9 +2925,9 @@ function! s:createTreeWin()
     call s:bindMappings()
     setfiletype nerdtree
     " syntax highlighting
-    if has("syntax") && exists("g:syntax_on")
-        call s:setupSyntaxHighlighting()
-    endif
+    "if has("syntax") && exists("g:syntax_on")
+        "call s:setupSyntaxHighlighting()
+    "endif
 endfunction
 
 "FUNCTION: s:dumpHelp  {{{2
@@ -3413,95 +3413,95 @@ function! s:setupStatusline()
     endif
 endfunction
 "FUNCTION: s:setupSyntaxHighlighting() {{{2
-function! s:setupSyntaxHighlighting()
-    "NERDTreeFlags are syntax items that should be invisible, but give clues as to
-    "how things should be highlighted
-    syn match NERDTreeFlag #\~#
-    syn match NERDTreeFlag #\[RO\]#
-
-    "highlighting for the .. (up dir) line at the top of the tree
-    execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
-
-    "highlighting for the ~/+ symbols for the directory nodes
-    syn match NERDTreeClosable #\~\<#
-    syn match NERDTreeClosable #\~\.#
-    syn match NERDTreeOpenable #+\<#
-    syn match NERDTreeOpenable #+\.#he=e-1
-
-    "highlighting for the tree structural parts
-    syn match NERDTreePart #|#
-    syn match NERDTreePart #`#
-    syn match NERDTreePartFile #[|`]-#hs=s+1 contains=NERDTreePart
-
-    "quickhelp syntax elements
-    syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#hs=s+2,he=e-1
-    syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#hs=s+2,he=e-1
-    syn match NERDTreeHelpTitle #" .*\~#hs=s+2,he=e-1 contains=NERDTreeFlag
-    syn match NERDTreeToggleOn #".*(on)#hs=e-2,he=e-1 contains=NERDTreeHelpKey
-    syn match NERDTreeToggleOff #".*(off)#hs=e-3,he=e-1 contains=NERDTreeHelpKey
-    syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3
-    syn match NERDTreeHelp  #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeFlag,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand
-
-    "highlighting for readonly files
-    syn match NERDTreeRO #.*\[RO\]#hs=s+2 contains=NERDTreeFlag,NERDTreeBookmark,NERDTreePart,NERDTreePartFile
-
-    "highlighting for sym links
-    syn match NERDTreeLink #[^-| `].* -> # contains=NERDTreeBookmark,NERDTreeOpenable,NERDTreeClosable,NERDTreeDirSlash
-
-    "highlighing for directory nodes and file nodes
-    syn match NERDTreeDirSlash #/#
-    syn match NERDTreeDir #[^-| `].*/# contains=NERDTreeLink,NERDTreeDirSlash,NERDTreeOpenable,NERDTreeClosable
-    syn match NERDTreeExecFile  #[|` ].*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark
-    syn match NERDTreeFile  #|-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
-    syn match NERDTreeFile  #`-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
-    syn match NERDTreeCWD #^[</].*$#
-
-    "highlighting for bookmarks
-    syn match NERDTreeBookmark # {.*}#hs=s+1
-
-    "highlighting for the bookmarks table
-    syn match NERDTreeBookmarksLeader #^>#
-    syn match NERDTreeBookmarksHeader #^>-\+Bookmarks-\+$# contains=NERDTreeBookmarksLeader
-    syn match NERDTreeBookmarkName #^>.\{-} #he=e-1 contains=NERDTreeBookmarksLeader
-    syn match NERDTreeBookmark #^>.*$# contains=NERDTreeBookmarksLeader,NERDTreeBookmarkName,NERDTreeBookmarksHeader
-
-    if g:NERDChristmasTree
-        hi def link NERDTreePart Special
-        hi def link NERDTreePartFile Type
-        hi def link NERDTreeFile Normal
-        hi def link NERDTreeExecFile Title
-        hi def link NERDTreeDirSlash Identifier
-        hi def link NERDTreeClosable Type
-    else
-        hi def link NERDTreePart Normal
-        hi def link NERDTreePartFile Normal
-        hi def link NERDTreeFile Normal
-        hi def link NERDTreeClosable Title
-    endif
-
-    hi def link NERDTreeBookmarksHeader statement
-    hi def link NERDTreeBookmarksLeader ignore
-    hi def link NERDTreeBookmarkName Identifier
-    hi def link NERDTreeBookmark normal
-
-    hi def link NERDTreeHelp String
-    hi def link NERDTreeHelpKey Identifier
-    hi def link NERDTreeHelpCommand Identifier
-    hi def link NERDTreeHelpTitle Macro
-    hi def link NERDTreeToggleOn Question
-    hi def link NERDTreeToggleOff WarningMsg
-
-    hi def link NERDTreeDir Directory
-    hi def link NERDTreeUp Directory
-    hi def link NERDTreeCWD Statement
-    hi def link NERDTreeLink Macro
-    hi def link NERDTreeOpenable Title
-    hi def link NERDTreeFlag ignore
-    hi def link NERDTreeRO WarningMsg
-    hi def link NERDTreeBookmark Statement
-
-    hi def link NERDTreeCurrentNode Search
-endfunction
+"function! s:setupSyntaxHighlighting()
+    ""NERDTreeFlags are syntax items that should be invisible, but give clues as to
+    ""how things should be highlighted
+    "syn match NERDTreeFlag #\~#
+    "syn match NERDTreeFlag #\[RO\]#
+
+    ""highlighting for the .. (up dir) line at the top of the tree
+    "execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
+
+    ""highlighting for the ~/+ symbols for the directory nodes
+    "syn match NERDTreeClosable #\~\<#
+    "syn match NERDTreeClosable #\~\.#
+    "syn match NERDTreeOpenable #+\<#
+    "syn match NERDTreeOpenable #+\.#he=e-1
+
+    ""highlighting for the tree structural parts
+    "syn match NERDTreePart #|#
+    "syn match NERDTreePart #`#
+    "syn match NERDTreePartFile #[|`]-#hs=s+1 contains=NERDTreePart
+
+    ""quickhelp syntax elements
+    "syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#hs=s+2,he=e-1
+    "syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#hs=s+2,he=e-1
+    "syn match NERDTreeHelpTitle #" .*\~#hs=s+2,he=e-1 contains=NERDTreeFlag
+    "syn match NERDTreeToggleOn #".*(on)#hs=e-2,he=e-1 contains=NERDTreeHelpKey
+    "syn match NERDTreeToggleOff #".*(off)#hs=e-3,he=e-1 contains=NERDTreeHelpKey
+    "syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3
+    "syn match NERDTreeHelp  #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeFlag,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand
+
+    ""highlighting for readonly files
+    "syn match NERDTreeRO #.*\[RO\]#hs=s+2 contains=NERDTreeFlag,NERDTreeBookmark,NERDTreePart,NERDTreePartFile
+
+    ""highlighting for sym links
+    "syn match NERDTreeLink #[^-| `].* -> # contains=NERDTreeBookmark,NERDTreeOpenable,NERDTreeClosable,NERDTreeDirSlash
+
+    ""highlighing for directory nodes and file nodes
+    "syn match NERDTreeDirSlash #/#
+    "syn match NERDTreeDir #[^-| `].*/# contains=NERDTreeLink,NERDTreeDirSlash,NERDTreeOpenable,NERDTreeClosable
+    "syn match NERDTreeExecFile  #[|` ].*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark
+    "syn match NERDTreeFile  #|-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
+    "syn match NERDTreeFile  #`-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
+    "syn match NERDTreeCWD #^[</].*$#
+
+    ""highlighting for bookmarks
+    "syn match NERDTreeBookmark # {.*}#hs=s+1
+
+    ""highlighting for the bookmarks table
+    "syn match NERDTreeBookmarksLeader #^>#
+    "syn match NERDTreeBookmarksHeader #^>-\+Bookmarks-\+$# contains=NERDTreeBookmarksLeader
+    "syn match NERDTreeBookmarkName #^>.\{-} #he=e-1 contains=NERDTreeBookmarksLeader
+    "syn match NERDTreeBookmark #^>.*$# contains=NERDTreeBookmarksLeader,NERDTreeBookmarkName,NERDTreeBookmarksHeader
+
+    "if g:NERDChristmasTree
+        "hi def link NERDTreePart Special
+        "hi def link NERDTreePartFile Type
+        "hi def link NERDTreeFile Normal
+        "hi def link NERDTreeExecFile Title
+        "hi def link NERDTreeDirSlash Identifier
+        "hi def link NERDTreeClosable Type
+    "else
+        "hi def link NERDTreePart Normal
+        "hi def link NERDTreePartFile Normal
+        "hi def link NERDTreeFile Normal
+        "hi def link NERDTreeClosable Title
+    "endif
+
+    "hi def link NERDTreeBookmarksHeader statement
+    "hi def link NERDTreeBookmarksLeader ignore
+    "hi def link NERDTreeBookmarkName Identifier
+    "hi def link NERDTreeBookmark normal
+
+    "hi def link NERDTreeHelp String
+    "hi def link NERDTreeHelpKey Identifier
+    "hi def link NERDTreeHelpCommand Identifier
+    "hi def link NERDTreeHelpTitle Macro
+    "hi def link NERDTreeToggleOn Question
+    "hi def link NERDTreeToggleOff WarningMsg
+
+    "hi def link NERDTreeDir Directory
+    "hi def link NERDTreeUp Directory
+    "hi def link NERDTreeCWD Statement
+    "hi def link NERDTreeLink Macro
+    "hi def link NERDTreeOpenable Title
+    "hi def link NERDTreeFlag ignore
+    "hi def link NERDTreeRO WarningMsg
+    "hi def link NERDTreeBookmark Statement
+
+    "hi def link NERDTreeCurrentNode Search
+"endfunction
 
 "FUNCTION: s:stripMarkupFromLine(line, removeLeadingSpaces){{{2
 "returns the given line with all the tree parts stripped off
diff --git a/syntax/nerdtree.vim b/syntax/nerdtree.vim
@@ -0,0 +1,88 @@
+let s:tree_up_dir_line = '.. (up a dir)'
+"NERDTreeFlags are syntax items that should be invisible, but give clues as to
+"how things should be highlighted
+syn match NERDTreeFlag #\~#
+syn match NERDTreeFlag #\[RO\]#
+
+"highlighting for the .. (up dir) line at the top of the tree
+execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
+
+"highlighting for the ~/+ symbols for the directory nodes
+syn match NERDTreeClosable #\~\<#
+syn match NERDTreeClosable #\~\.#
+syn match NERDTreeOpenable #+\<#
+syn match NERDTreeOpenable #+\.#he=e-1
+
+"highlighting for the tree structural parts
+syn match NERDTreePart #|#
+syn match NERDTreePart #`#
+syn match NERDTreePartFile #[|`]-#hs=s+1 contains=NERDTreePart
+
+"quickhelp syntax elements
+syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#hs=s+2,he=e-1
+syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#hs=s+2,he=e-1
+syn match NERDTreeHelpTitle #" .*\~#hs=s+2,he=e-1 contains=NERDTreeFlag
+syn match NERDTreeToggleOn #".*(on)#hs=e-2,he=e-1 contains=NERDTreeHelpKey
+syn match NERDTreeToggleOff #".*(off)#hs=e-3,he=e-1 contains=NERDTreeHelpKey
+syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3
+syn match NERDTreeHelp  #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeFlag,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand
+
+"highlighting for readonly files
+syn match NERDTreeRO #.*\[RO\]#hs=s+2 contains=NERDTreeFlag,NERDTreeBookmark,NERDTreePart,NERDTreePartFile
+
+"highlighting for sym links
+syn match NERDTreeLink #[^-| `].* -> # contains=NERDTreeBookmark,NERDTreeOpenable,NERDTreeClosable,NERDTreeDirSlash
+
+"highlighing for directory nodes and file nodes
+syn match NERDTreeDirSlash #/#
+syn match NERDTreeDir #[^-| `].*/# contains=NERDTreeLink,NERDTreeDirSlash,NERDTreeOpenable,NERDTreeClosable
+syn match NERDTreeExecFile  #[|` ].*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark
+syn match NERDTreeFile  #|-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
+syn match NERDTreeFile  #`-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
+syn match NERDTreeCWD #^[</].*$#
+
+"highlighting for bookmarks
+syn match NERDTreeBookmark # {.*}#hs=s+1
+
+"highlighting for the bookmarks table
+syn match NERDTreeBookmarksLeader #^>#
+syn match NERDTreeBookmarksHeader #^>-\+Bookmarks-\+$# contains=NERDTreeBookmarksLeader
+syn match NERDTreeBookmarkName #^>.\{-} #he=e-1 contains=NERDTreeBookmarksLeader
+syn match NERDTreeBookmark #^>.*$# contains=NERDTreeBookmarksLeader,NERDTreeBookmarkName,NERDTreeBookmarksHeader
+
+if exists("g:NERDChristmasTree") && g:NERDChristmasTree
+    hi def link NERDTreePart Special
+    hi def link NERDTreePartFile Type
+    hi def link NERDTreeFile Normal
+    hi def link NERDTreeExecFile Title
+    hi def link NERDTreeDirSlash Identifier
+    hi def link NERDTreeClosable Type
+else
+    hi def link NERDTreePart Normal
+    hi def link NERDTreePartFile Normal
+    hi def link NERDTreeFile Normal
+    hi def link NERDTreeClosable Title
+endif
+
+hi def link NERDTreeBookmarksHeader statement
+hi def link NERDTreeBookmarksLeader ignore
+hi def link NERDTreeBookmarkName Identifier
+hi def link NERDTreeBookmark normal
+
+hi def link NERDTreeHelp String
+hi def link NERDTreeHelpKey Identifier
+hi def link NERDTreeHelpCommand Identifier
+hi def link NERDTreeHelpTitle Macro
+hi def link NERDTreeToggleOn Question
+hi def link NERDTreeToggleOff WarningMsg
+
+hi def link NERDTreeDir Directory
+hi def link NERDTreeUp Directory
+hi def link NERDTreeCWD Statement
+hi def link NERDTreeLink Macro
+hi def link NERDTreeOpenable Title
+hi def link NERDTreeFlag ignore
+hi def link NERDTreeRO WarningMsg
+hi def link NERDTreeBookmark Statement
+
+hi def link NERDTreeCurrentNode Search