summaryrefslogtreecommitdiff
path: root/.vim/pack/vendor/start/nerdtree
diff options
context:
space:
mode:
Diffstat (limited to '.vim/pack/vendor/start/nerdtree')
-rw-r--r--.vim/pack/vendor/start/nerdtree/autoload/nerdtree.vim249
-rw-r--r--.vim/pack/vendor/start/nerdtree/autoload/nerdtree/ui_glue.vim732
-rw-r--r--.vim/pack/vendor/start/nerdtree/doc/NERDTree.txt1534
-rw-r--r--.vim/pack/vendor/start/nerdtree/doc/tags143
-rw-r--r--.vim/pack/vendor/start/nerdtree/lib/nerdtree/bookmark.vim365
-rw-r--r--.vim/pack/vendor/start/nerdtree/lib/nerdtree/creator.vim402
-rw-r--r--.vim/pack/vendor/start/nerdtree/lib/nerdtree/event.vim13
-rw-r--r--.vim/pack/vendor/start/nerdtree/lib/nerdtree/flag_set.vim58
-rw-r--r--.vim/pack/vendor/start/nerdtree/lib/nerdtree/key_map.vim164
-rw-r--r--.vim/pack/vendor/start/nerdtree/lib/nerdtree/menu_controller.vim211
-rw-r--r--.vim/pack/vendor/start/nerdtree/lib/nerdtree/menu_item.vim118
-rw-r--r--.vim/pack/vendor/start/nerdtree/lib/nerdtree/nerdtree.vim209
-rw-r--r--.vim/pack/vendor/start/nerdtree/lib/nerdtree/notifier.vim35
-rw-r--r--.vim/pack/vendor/start/nerdtree/lib/nerdtree/opener.vim326
-rw-r--r--.vim/pack/vendor/start/nerdtree/lib/nerdtree/path.vim852
-rw-r--r--.vim/pack/vendor/start/nerdtree/lib/nerdtree/tree_dir_node.vim706
-rw-r--r--.vim/pack/vendor/start/nerdtree/lib/nerdtree/tree_file_node.vim349
-rw-r--r--.vim/pack/vendor/start/nerdtree/lib/nerdtree/ui.vim532
-rw-r--r--.vim/pack/vendor/start/nerdtree/nerdtree_plugin/exec_menuitem.vim40
-rw-r--r--.vim/pack/vendor/start/nerdtree/nerdtree_plugin/fs_menu.vim484
-rw-r--r--.vim/pack/vendor/start/nerdtree/nerdtree_plugin/vcs.vim47
-rw-r--r--.vim/pack/vendor/start/nerdtree/plugin/NERD_tree.vim234
-rw-r--r--.vim/pack/vendor/start/nerdtree/syntax/nerdtree.vim97
23 files changed, 7900 insertions, 0 deletions
diff --git a/.vim/pack/vendor/start/nerdtree/autoload/nerdtree.vim b/.vim/pack/vendor/start/nerdtree/autoload/nerdtree.vim
new file mode 100644
index 0000000..ba70871
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/autoload/nerdtree.vim
@@ -0,0 +1,249 @@
1if exists('g:loaded_nerdtree_autoload')
2 finish
3endif
4let g:loaded_nerdtree_autoload = 1
5
6let s:rootNERDTreePath = resolve(expand('<sfile>:p:h:h'))
7
8"FUNCTION: nerdtree#version(...) {{{1
9" If any value is given as an argument, the entire line of text from the
10" change log is shown for the current version; otherwise, only the version
11" number is shown.
12function! nerdtree#version(...) abort
13 let l:text = 'Unknown'
14 try
15 let l:changelog = readfile(join([s:rootNERDTreePath, 'CHANGELOG.md'], nerdtree#slash()))
16 let l:line = 0
17 while l:line <= len(l:changelog)
18 if l:changelog[l:line] =~# '\d\+\.\d\+'
19 let l:text = substitute(l:changelog[l:line], '.*\(\d\+.\d\+\).*', '\1', '')
20 let l:text .= substitute(l:changelog[l:line+1], '^.\{-}\(\.\d\+\).\{-}:\(.*\)', a:0>0 ? '\1:\2' : '\1', '')
21 break
22 endif
23 let l:line += 1
24 endwhile
25 catch
26 endtry
27 return l:text
28endfunction
29
30" SECTION: General Functions {{{1
31"============================================================
32
33" FUNCTION: nerdtree#closeTreeOnOpen() {{{2
34function! nerdtree#closeTreeOnOpen() abort
35 return g:NERDTreeQuitOnOpen == 1 || g:NERDTreeQuitOnOpen == 3
36endfunction
37
38" FUNCTION: nerdtree#closeBookmarksOnOpen() {{{2
39function! nerdtree#closeBookmarksOnOpen() abort
40 return g:NERDTreeQuitOnOpen == 2 || g:NERDTreeQuitOnOpen == 3
41endfunction
42
43" FUNCTION: nerdtree#slash() {{{2
44" Return the path separator used by the underlying file system. Special
45" consideration is taken for the use of the 'shellslash' option on Windows
46" systems.
47function! nerdtree#slash() abort
48 if nerdtree#runningWindows()
49 if exists('+shellslash') && &shellslash
50 return '/'
51 endif
52
53 return '\'
54 endif
55
56 return '/'
57endfunction
58
59"FUNCTION: nerdtree#checkForBrowse(dir) {{{2
60"inits a window tree in the current buffer if appropriate
61function! nerdtree#checkForBrowse(dir) abort
62 if !isdirectory(a:dir)
63 return
64 endif
65
66 if s:reuseWin(a:dir)
67 return
68 endif
69
70 call g:NERDTreeCreator.CreateWindowTree(a:dir)
71endfunction
72
73"FUNCTION: s:reuseWin(dir) {{{2
74"finds a NERDTree buffer with root of dir, and opens it.
75function! s:reuseWin(dir) abort
76 let path = g:NERDTreePath.New(fnamemodify(a:dir, ':p'))
77
78 for i in range(1, bufnr('$'))
79 unlet! nt
80 let nt = getbufvar(i, 'NERDTree')
81 if empty(nt)
82 continue
83 endif
84
85 if nt.isWinTree() && nt.root.path.equals(path)
86 call nt.setPreviousBuf(bufnr('#'))
87 exec 'buffer ' . i
88 return 1
89 endif
90 endfor
91
92 return 0
93endfunction
94
95" FUNCTION: nerdtree#completeBookmarks(A,L,P) {{{2
96" completion function for the bookmark commands
97function! nerdtree#completeBookmarks(A,L,P) abort
98 return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"')
99endfunction
100
101"FUNCTION: nerdtree#compareNodes(n1, n2) {{{2
102function! nerdtree#compareNodes(n1, n2) abort
103 return nerdtree#compareNodePaths(a:n1.path, a:n2.path)
104endfunction
105
106"FUNCTION: nerdtree#compareNodePaths(p1, p2) {{{2
107function! nerdtree#compareNodePaths(p1, p2) abort
108 let sortKey1 = a:p1.getSortKey()
109 let sortKey2 = a:p2.getSortKey()
110 let i = 0
111 while i < min([len(sortKey1), len(sortKey2)])
112 " Compare chunks upto common length.
113 " If chunks have different type, the one which has
114 " integer type is the lesser.
115 if type(sortKey1[i]) == type(sortKey2[i])
116 if sortKey1[i] <# sortKey2[i]
117 return - 1
118 elseif sortKey1[i] ># sortKey2[i]
119 return 1
120 endif
121 elseif type(sortKey1[i]) == type(0)
122 return -1
123 elseif type(sortKey2[i]) == type(0)
124 return 1
125 endif
126 let i += 1
127 endwhile
128
129 " Keys are identical upto common length.
130 " The key which has smaller chunks is the lesser one.
131 if len(sortKey1) < len(sortKey2)
132 return -1
133 elseif len(sortKey1) > len(sortKey2)
134 return 1
135 else
136 return 0
137 endif
138endfunction
139
140" FUNCTION: nerdtree#deprecated(func, [msg]) {{{2
141" Issue a deprecation warning for a:func. If a second arg is given, use this
142" as the deprecation message
143function! nerdtree#deprecated(func, ...) abort
144 let msg = a:0 ? a:func . ' ' . a:1 : a:func . ' is deprecated'
145
146 if !exists('s:deprecationWarnings')
147 let s:deprecationWarnings = {}
148 endif
149 if !has_key(s:deprecationWarnings, a:func)
150 let s:deprecationWarnings[a:func] = 1
151 echomsg msg
152 endif
153endfunction
154
155" FUNCTION: nerdtree#exec(cmd, ignoreAll) {{{2
156" Same as :exec cmd but, if ignoreAll is TRUE, set eventignore=all for the duration
157function! nerdtree#exec(cmd, ignoreAll) abort
158 let old_ei = &eventignore
159 if a:ignoreAll
160 set eventignore=all
161 endif
162 try
163 exec a:cmd
164 finally
165 let &eventignore = old_ei
166 endtry
167endfunction
168
169" FUNCTION: nerdtree#has_opt(options, name) {{{2
170function! nerdtree#has_opt(options, name) abort
171 return has_key(a:options, a:name) && a:options[a:name] ==# 1
172endfunction
173
174" FUNCTION: nerdtree#loadClassFiles() {{{2
175function! nerdtree#loadClassFiles() abort
176 runtime lib/nerdtree/path.vim
177 runtime lib/nerdtree/menu_controller.vim
178 runtime lib/nerdtree/menu_item.vim
179 runtime lib/nerdtree/key_map.vim
180 runtime lib/nerdtree/bookmark.vim
181 runtime lib/nerdtree/tree_file_node.vim
182 runtime lib/nerdtree/tree_dir_node.vim
183 runtime lib/nerdtree/opener.vim
184 runtime lib/nerdtree/creator.vim
185 runtime lib/nerdtree/flag_set.vim
186 runtime lib/nerdtree/nerdtree.vim
187 runtime lib/nerdtree/ui.vim
188 runtime lib/nerdtree/event.vim
189 runtime lib/nerdtree/notifier.vim
190endfunction
191
192" FUNCTION: nerdtree#postSourceActions() {{{2
193function! nerdtree#postSourceActions() abort
194 call g:NERDTreeBookmark.CacheBookmarks(1)
195 call nerdtree#ui_glue#createDefaultBindings()
196
197 "load all nerdtree plugins
198 runtime! nerdtree_plugin/**/*.vim
199endfunction
200
201"FUNCTION: nerdtree#runningWindows(dir) {{{2
202function! nerdtree#runningWindows() abort
203 return has('win16') || has('win32') || has('win64')
204endfunction
205
206"FUNCTION: nerdtree#runningCygwin(dir) {{{2
207function! nerdtree#runningCygwin() abort
208 return has('win32unix')
209endfunction
210
211" SECTION: View Functions {{{1
212"============================================================
213
214"FUNCTION: nerdtree#echo {{{2
215"A wrapper for :echo. Appends 'NERDTree:' on the front of all messages
216"
217"Args:
218"msg: the message to echo
219function! nerdtree#echo(msg) abort
220 redraw
221 echomsg empty(a:msg) ? '' : ('NERDTree: ' . a:msg)
222endfunction
223
224"FUNCTION: nerdtree#echoError {{{2
225"Wrapper for nerdtree#echo, sets the message type to errormsg for this message
226"Args:
227"msg: the message to echo
228function! nerdtree#echoError(msg) abort
229 echohl errormsg
230 call nerdtree#echo(a:msg)
231 echohl normal
232endfunction
233
234"FUNCTION: nerdtree#echoWarning {{{2
235"Wrapper for nerdtree#echo, sets the message type to warningmsg for this message
236"Args:
237"msg: the message to echo
238function! nerdtree#echoWarning(msg) abort
239 echohl warningmsg
240 call nerdtree#echo(a:msg)
241 echohl normal
242endfunction
243
244"FUNCTION: nerdtree#renderView {{{2
245function! nerdtree#renderView() abort
246 call b:NERDTree.render()
247endfunction
248
249" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/.vim/pack/vendor/start/nerdtree/autoload/nerdtree/ui_glue.vim b/.vim/pack/vendor/start/nerdtree/autoload/nerdtree/ui_glue.vim
new file mode 100644
index 0000000..fc22f21
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/autoload/nerdtree/ui_glue.vim
@@ -0,0 +1,732 @@
1if exists('g:loaded_nerdtree_ui_glue_autoload')
2 finish
3endif
4let g:loaded_nerdtree_ui_glue_autoload = 1
5
6" FUNCTION: nerdtree#ui_glue#createDefaultBindings() {{{1
7function! nerdtree#ui_glue#createDefaultBindings() abort
8 let s = '<SNR>' . s:SID() . '_'
9
10 call NERDTreeAddKeyMap({ 'key': '<MiddleMouse>', 'scope': 'all', 'callback': s . 'handleMiddleMouse' })
11 call NERDTreeAddKeyMap({ 'key': '<LeftRelease>', 'scope': 'all', 'callback': s.'handleLeftClick' })
12 call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': 'DirNode', 'callback': s.'activateDirNode' })
13 call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': 'FileNode', 'callback': s.'activateFileNode' })
14 call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': 'Bookmark', 'callback': s.'activateBookmark' })
15 call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': 'all', 'callback': s.'activateAll' })
16
17 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'FileNode', 'callback': s.'customOpenFile'})
18 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'DirNode', 'callback': s.'customOpenDir'})
19 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'Bookmark', 'callback': s.'customOpenBookmark'})
20 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'all', 'callback': s.'activateAll' })
21
22 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'DirNode', 'callback': s.'activateDirNode' })
23 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'FileNode', 'callback': s.'activateFileNode' })
24 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'Bookmark', 'callback': s.'activateBookmark' })
25 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Bookmark', 'callback': s.'previewBookmark' })
26 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'all', 'callback': s.'activateAll' })
27
28 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'FileNode', 'callback': s.'openHSplit' })
29 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'Bookmark', 'callback': s.'openHSplitBookmark' })
30 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'FileNode', 'callback': s.'openVSplit' })
31 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'Bookmark', 'callback': s.'openVSplitBookmark' })
32
33 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'FileNode', 'callback': s.'previewNodeCurrent' })
34 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'FileNode', 'callback': s.'previewNodeHSplit' })
35 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'Bookmark', 'callback': s.'previewNodeHSplitBookmark' })
36 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'FileNode', 'callback': s.'previewNodeVSplit' })
37 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'Bookmark', 'callback': s.'previewNodeVSplitBookmark' })
38
39 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': 'DirNode', 'callback': s.'openNodeRecursively' })
40
41 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdir, 'scope': 'all', 'callback': s . 'upDirCurrentRootClosed' })
42 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdirKeepOpen, 'scope': 'all', 'callback': s . 'upDirCurrentRootOpen' })
43 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChangeRoot, 'scope': 'Node', 'callback': s . 'chRoot' })
44
45 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChdir, 'scope': 'Node', 'callback': s.'chCwd' })
46
47 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapQuit, 'scope': 'all', 'callback': s.'closeTreeWindow' })
48
49 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCWD, 'scope': 'all', 'callback': 'nerdtree#ui_glue#chRootCwd' })
50
51 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefreshRoot, 'scope': 'all', 'callback': s.'refreshRoot' })
52 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefresh, 'scope': 'Node', 'callback': s.'refreshCurrent' })
53
54 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapHelp, 'scope': 'all', 'callback': s.'displayHelp' })
55 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleZoom, 'scope': 'all', 'callback': s.'toggleZoom' })
56 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleHidden, 'scope': 'all', 'callback': s.'toggleShowHidden' })
57 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFilters, 'scope': 'all', 'callback': s.'toggleIgnoreFilter' })
58 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFiles, 'scope': 'all', 'callback': s.'toggleShowFiles' })
59 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleBookmarks, 'scope': 'all', 'callback': s.'toggleShowBookmarks' })
60
61 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseDir, 'scope': 'Node', 'callback': s.'closeCurrentDir' })
62 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseChildren, 'scope': 'DirNode', 'callback': s.'closeChildren' })
63
64 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapMenu, 'scope': 'Node', 'callback': s.'showMenu' })
65
66 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpParent, 'scope': 'Node', 'callback': s.'jumpToParent' })
67 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpFirstChild, 'scope': 'Node', 'callback': s.'jumpToFirstChild' })
68 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpLastChild, 'scope': 'Node', 'callback': s.'jumpToLastChild' })
69 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpRoot, 'scope': 'all', 'callback': s.'jumpToRoot' })
70 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpNextSibling, 'scope': 'Node', 'callback': s.'jumpToNextSibling' })
71 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpPrevSibling, 'scope': 'Node', 'callback': s.'jumpToPrevSibling' })
72
73 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': 'Node', 'callback': s . 'openInNewTab' })
74 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': 'Node', 'callback': s . 'openInNewTabSilent' })
75 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': 'Bookmark', 'callback': s . 'openInNewTab' })
76 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': 'Bookmark', 'callback': s . 'openInNewTabSilent' })
77
78 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': 'DirNode', 'callback': s.'openExplorer' })
79 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': 'FileNode', 'callback': s.'openExplorer' })
80
81 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapDeleteBookmark, 'scope': 'Bookmark', 'callback': s.'deleteBookmark' })
82endfunction
83
84
85"SECTION: Interface bindings {{{1
86"============================================================
87
88"FUNCTION: s:customOpenFile() {{{1
89" Open file node with the 'custom' key, initially <CR>.
90function! s:customOpenFile(node) abort
91 call a:node.activate(s:initCustomOpenArgs().file)
92endfunction
93
94"FUNCTION: s:customOpenDir() {{{1
95" Open directory node with the 'custom' key, initially <CR>.
96function! s:customOpenDir(node) abort
97 call s:activateDirNode(a:node, s:initCustomOpenArgs().dir)
98endfunction
99
100"FUNCTION: s:customOpenBookmark() {{{1
101" Open bookmark node with the 'custom' key, initially <CR>.
102function! s:customOpenBookmark(node) abort
103 if a:node.path.isDirectory
104 call a:node.activate(b:NERDTree, s:initCustomOpenArgs().dir)
105 else
106 call a:node.activate(b:NERDTree, s:initCustomOpenArgs().file)
107 endif
108endfunction
109
110"FUNCTION: s:initCustomOpenArgs() {{{1
111function! s:initCustomOpenArgs() abort
112 let l:defaultOpenArgs = {'file': {'reuse': 'all', 'where': 'p', 'keepopen':!nerdtree#closeTreeOnOpen()}, 'dir': {}}
113 try
114 let g:NERDTreeCustomOpenArgs = get(g:, 'NERDTreeCustomOpenArgs', {})
115 call extend(g:NERDTreeCustomOpenArgs, l:defaultOpenArgs, 'keep')
116 catch /^Vim(\a\+):E712:/
117 call nerdtree#echoWarning('g:NERDTreeCustomOpenArgs is not set properly. Using default value.')
118 let g:NERDTreeCustomOpenArgs = l:defaultOpenArgs
119 finally
120 return g:NERDTreeCustomOpenArgs
121 endtry
122endfunction
123
124"FUNCTION: s:activateAll() {{{1
125"handle the user activating the updir line
126function! s:activateAll() abort
127 if getline('.') ==# g:NERDTreeUI.UpDirLine()
128 return nerdtree#ui_glue#upDir(0)
129 endif
130endfunction
131
132" FUNCTION: s:activateDirNode(directoryNode, options) {{{1
133" Open a directory with optional options
134function! s:activateDirNode(directoryNode, ...) abort
135
136 if a:directoryNode.isRoot() && a:directoryNode.isOpen
137 call nerdtree#echo('cannot close tree root')
138 return
139 endif
140
141 call a:directoryNode.activate((a:0 > 0) ? a:1 : {})
142endfunction
143
144"FUNCTION: s:activateFileNode() {{{1
145"handle the user activating a tree node
146function! s:activateFileNode(node) abort
147 call a:node.activate({'reuse': 'all', 'where': 'p', 'keepopen': !nerdtree#closeTreeOnOpen()})
148endfunction
149
150"FUNCTION: s:activateBookmark(bookmark) {{{1
151"handle the user activating a bookmark
152function! s:activateBookmark(bm) abort
153 call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p', 'keepopen': !nerdtree#closeTreeOnOpen()} : {})
154endfunction
155
156" FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1
157" Associate the current node with the given name
158function! nerdtree#ui_glue#bookmarkNode(...) abort
159 let currentNode = g:NERDTreeFileNode.GetSelected()
160 if currentNode !=# {}
161 let name = a:1
162 if empty(name)
163 let name = currentNode.path.getLastPathComponent(0)
164 endif
165 try
166 call currentNode.bookmark(name)
167 call b:NERDTree.render()
168 catch /^NERDTree.IllegalBookmarkNameError/
169 call nerdtree#echo('bookmark names must not contain spaces')
170 endtry
171 else
172 call nerdtree#echo('select a node first')
173 endif
174endfunction
175
176" FUNCTION: s:chCwd(node) {{{1
177function! s:chCwd(node) abort
178 try
179 call a:node.path.changeToDir()
180 catch /^NERDTree.PathChangeError/
181 call nerdtree#echoWarning('could not change cwd')
182 endtry
183endfunction
184
185" FUNCTION: s:chRoot(node) {{{1
186" changes the current root to the selected one
187function! s:chRoot(node) abort
188 call b:NERDTree.changeRoot(a:node)
189endfunction
190
191" FUNCTION: s:nerdtree#ui_glue#chRootCwd() {{{1
192" Change the NERDTree root to match the current working directory.
193function! nerdtree#ui_glue#chRootCwd() abort
194 NERDTreeCWD
195endfunction
196
197" FUNCTION: nnerdtree#ui_glue#clearBookmarks(bookmarks) {{{1
198function! nerdtree#ui_glue#clearBookmarks(bookmarks) abort
199 if a:bookmarks ==# ''
200 let currentNode = g:NERDTreeFileNode.GetSelected()
201 if currentNode !=# {}
202 call currentNode.clearBookmarks()
203 endif
204 else
205 for name in split(a:bookmarks, ' ')
206 let bookmark = g:NERDTreeBookmark.BookmarkFor(name)
207 call bookmark.delete()
208 endfor
209 endif
210 call b:NERDTree.root.refresh()
211 call b:NERDTree.render()
212endfunction
213
214" FUNCTION: s:closeChildren(node) {{{1
215" closes all childnodes of the current node
216function! s:closeChildren(node) abort
217 call a:node.closeChildren()
218 call b:NERDTree.render()
219 call a:node.putCursorHere(0, 0)
220endfunction
221
222" FUNCTION: s:closeCurrentDir(node) {{{1
223" Close the parent directory of the current node.
224function! s:closeCurrentDir(node) abort
225
226 if a:node.isRoot()
227 call nerdtree#echo('cannot close parent of tree root')
228 return
229 endif
230
231 let l:parent = a:node.parent
232
233 while l:parent.isCascadable()
234 let l:parent = l:parent.parent
235 endwhile
236
237 if l:parent.isRoot()
238 call nerdtree#echo('cannot close tree root')
239 return
240 endif
241
242 call l:parent.close()
243 call b:NERDTree.render()
244 call l:parent.putCursorHere(0, 0)
245endfunction
246
247" FUNCTION: s:closeTreeWindow() {{{1
248" close the tree window
249function! s:closeTreeWindow() abort
250 if b:NERDTree.isWinTree() && b:NERDTree.previousBuf() !=# -1
251 exec 'buffer ' . b:NERDTree.previousBuf()
252 else
253 if winnr('$') > 1
254 call g:NERDTree.Close()
255 else
256 call nerdtree#echo('Cannot close last window')
257 endif
258 endif
259endfunction
260
261" FUNCTION: s:deleteBookmark(bookmark) {{{1
262" Prompt the user to confirm the deletion of the selected bookmark.
263function! s:deleteBookmark(bookmark) abort
264 let l:message = 'Delete the bookmark "' . a:bookmark.name
265 \ . '" from the bookmark list?'
266
267 let l:choices = "&Yes\n&No"
268
269 echo | redraw
270 let l:selection = confirm(l:message, l:choices, 1, 'Warning')
271
272 if l:selection !=# 1
273 call nerdtree#echo('bookmark not deleted')
274 return
275 endif
276
277 try
278 call a:bookmark.delete()
279 silent call b:NERDTree.root.refresh()
280 call b:NERDTree.render()
281 echo | redraw
282 catch /^NERDTree/
283 call nerdtree#echoWarning('could not remove bookmark')
284 endtry
285endfunction
286
287" FUNCTION: s:displayHelp() {{{1
288" toggles the help display
289function! s:displayHelp() abort
290 call b:NERDTree.ui.toggleHelp()
291 call b:NERDTree.render()
292 call b:NERDTree.ui.centerView()
293endfunction
294
295" FUNCTION: s:findAndRevealPath(pathStr) {{{1
296function! s:findAndRevealPath(pathStr) abort
297 let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p')
298 let l:revealOpts = {}
299
300 if empty(l:pathStr)
301 call nerdtree#echoWarning('no file for the current buffer')
302 return
303 endif
304
305 if !filereadable(l:pathStr)
306 let l:pathStr = fnamemodify(l:pathStr, ':h')
307 let l:revealOpts['open'] = 1
308 endif
309
310 try
311 let l:pathStr = g:NERDTreePath.Resolve(l:pathStr)
312 let l:pathObj = g:NERDTreePath.New(l:pathStr)
313 catch /^NERDTree.InvalidArgumentsError/
314 call nerdtree#echoWarning('invalid path')
315 return
316 endtry
317
318 if !g:NERDTree.ExistsForTab()
319 try
320 let l:cwd = g:NERDTreePath.New(getcwd())
321 catch /^NERDTree.InvalidArgumentsError/
322 call nerdtree#echo('current directory does not exist.')
323 let l:cwd = l:pathObj.getParent()
324 endtry
325
326 if l:pathObj.isUnder(l:cwd)
327 call g:NERDTreeCreator.CreateTabTree(l:cwd.str())
328 else
329 call g:NERDTreeCreator.CreateTabTree(l:pathObj.getParent().str())
330 endif
331 else
332 NERDTreeFocus
333
334 if !l:pathObj.isUnder(b:NERDTree.root.path)
335 call s:chRoot(g:NERDTreeDirNode.New(l:pathObj.getParent(), b:NERDTree))
336 endif
337 endif
338
339 if l:pathObj.isHiddenUnder(b:NERDTree.root.path)
340 call b:NERDTree.ui.setShowHidden(1)
341 endif
342
343 let l:node = b:NERDTree.root.reveal(l:pathObj, l:revealOpts)
344 call b:NERDTree.render()
345 call l:node.putCursorHere(1, 0)
346endfunction
347
348"FUNCTION: s:handleLeftClick() {{{1
349"Checks if the click should open the current node
350function! s:handleLeftClick() abort
351 let currentNode = g:NERDTreeFileNode.GetSelected()
352 if currentNode !=# {}
353
354 "the dir arrows are multibyte chars, and vim's string functions only
355 "deal with single bytes - so split the line up with the hack below and
356 "take the line substring manually
357 let line = split(getline(line('.')), '\zs')
358 let startToCur = ''
359 for i in range(0,len(line)-1)
360 let startToCur .= line[i]
361 endfor
362
363 if currentNode.path.isDirectory
364 if startToCur =~# g:NERDTreeUI.MarkupReg() && startToCur =~# '[+~'.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'] \?$'
365 call currentNode.activate()
366 return
367 endif
368 endif
369
370 if (g:NERDTreeMouseMode ==# 2 && currentNode.path.isDirectory) || g:NERDTreeMouseMode ==# 3
371 let char = strpart(startToCur, strlen(startToCur)-1, 1)
372 if char !~# g:NERDTreeUI.MarkupReg()
373 if currentNode.path.isDirectory
374 call currentNode.activate()
375 else
376 call currentNode.activate({'reuse': 'all', 'where': 'p', 'keepopen':!nerdtree#closeTreeOnOpen()})
377 endif
378 return
379 endif
380 endif
381 endif
382endfunction
383
384" FUNCTION: s:handleMiddleMouse() {{{1
385function! s:handleMiddleMouse() abort
386
387 " A middle mouse click does not automatically position the cursor as one
388 " would expect. Forcing the execution of a regular left mouse click here
389 " fixes this problem.
390 execute "normal! \<LeftMouse>"
391
392 let l:currentNode = g:NERDTreeFileNode.GetSelected()
393 if empty(l:currentNode)
394 call nerdtree#echoError('use the pointer to select a node')
395 return
396 endif
397
398 if l:currentNode.path.isDirectory
399 call l:currentNode.openExplorer()
400 else
401 call l:currentNode.open({'where': 'h'})
402 endif
403endfunction
404
405" FUNCTION: nerdtree#ui_glue#invokeKeyMap(key) {{{1
406"this is needed since I cant figure out how to invoke dict functions from a
407"key map
408function! nerdtree#ui_glue#invokeKeyMap(key) abort
409 call g:NERDTreeKeyMap.Invoke(a:key)
410endfunction
411
412" FUNCTION: s:jumpToFirstChild(node) {{{1
413function! s:jumpToFirstChild(node) abort
414 call s:jumpToChild(a:node, 0)
415endfunction
416
417" FUNCTION: s:jumpToLastChild(node) {{{1
418function! s:jumpToLastChild(node) abort
419 call s:jumpToChild(a:node, 1)
420endfunction
421
422" FUNCTION: s:jumpToChild(node, last) {{{1
423" Jump to the first or last child node at the same file system level.
424"
425" Args:
426" node: the node on which the cursor currently sits
427" last: 1 (true) if jumping to last child, 0 (false) if jumping to first
428function! s:jumpToChild(node, last) abort
429 let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node
430
431 if l:node.isRoot()
432 return
433 endif
434
435 let l:parent = l:node.parent
436 let l:children = l:parent.getVisibleChildren()
437
438 let l:target = a:last ? l:children[len(l:children) - 1] : l:children[0]
439
440 call l:target.putCursorHere(1, 0)
441 call b:NERDTree.ui.centerView()
442endfunction
443
444" FUNCTION: s:jumpToParent(node) {{{1
445" Move the cursor to the parent of the specified node. For a cascade, move to
446" the parent of the cascade's first node. At the root node, do nothing.
447function! s:jumpToParent(node) abort
448 let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node
449
450 if l:node.isRoot()
451 return
452 endif
453
454 if empty(l:node.parent)
455 call nerdtree#echo('could not jump to parent node')
456 return
457 endif
458
459 call l:node.parent.putCursorHere(1, 0)
460 call b:NERDTree.ui.centerView()
461endfunction
462
463" FUNCTION: s:jumpToRoot() {{{1
464" moves the cursor to the root node
465function! s:jumpToRoot() abort
466 call b:NERDTree.root.putCursorHere(1, 0)
467 call b:NERDTree.ui.centerView()
468endfunction
469
470" FUNCTION: s:jumpToNextSibling(node) {{{1
471function! s:jumpToNextSibling(node) abort
472 call s:jumpToSibling(a:node, 1)
473endfunction
474
475" FUNCTION: s:jumpToPrevSibling(node) {{{1
476function! s:jumpToPrevSibling(node) abort
477 call s:jumpToSibling(a:node, 0)
478endfunction
479
480" FUNCTION: s:jumpToSibling(node, forward) {{{1
481" Move the cursor to the next or previous node at the same file system level.
482"
483" Args:
484" node: the node on which the cursor currently sits
485" forward: 0 to jump to previous sibling, 1 to jump to next sibling
486function! s:jumpToSibling(node, forward) abort
487 let l:node = a:node.path.isDirectory ? a:node.getCascadeRoot() : a:node
488 let l:sibling = l:node.findSibling(a:forward)
489
490 if empty(l:sibling)
491 return
492 endif
493
494 call l:sibling.putCursorHere(1, 0)
495 call b:NERDTree.ui.centerView()
496endfunction
497
498" FUNCTION: nerdtree#ui_glue#openBookmark(name) {{{1
499" Open the Bookmark that has the specified name. This function provides the
500" implementation for the :OpenBookmark command.
501function! nerdtree#ui_glue#openBookmark(name) abort
502 try
503 let l:bookmark = g:NERDTreeBookmark.BookmarkFor(a:name)
504 catch /^NERDTree.BookmarkNotFoundError/
505 call nerdtree#echoError('bookmark "' . a:name . '" not found')
506 return
507 endtry
508 if l:bookmark.path.isDirectory
509 call l:bookmark.open(b:NERDTree)
510 return
511 endif
512
513 call l:bookmark.open(b:NERDTree, s:initCustomOpenArgs().file)
514endfunction
515
516" FUNCTION: s:openHSplit(target) {{{1
517function! s:openHSplit(target) abort
518 call a:target.activate({'where': 'h', 'keepopen': !nerdtree#closeTreeOnOpen()})
519endfunction
520
521" FUNCTION: s:openVSplit(target) {{{1
522function! s:openVSplit(target) abort
523 call a:target.activate({'where': 'v', 'keepopen': !nerdtree#closeTreeOnOpen()})
524endfunction
525
526"FUNCTION: s:openHSplitBookmark(bookmark) {{{1
527"handle the user activating a bookmark
528function! s:openHSplitBookmark(bm) abort
529 call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'h', 'keepopen': !nerdtree#closeTreeOnOpen()} : {})
530endfunction
531
532"FUNCTION: s:openVSplitBookmark(bookmark) {{{1
533"handle the user activating a bookmark
534function! s:openVSplitBookmark(bm) abort
535 call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'v', 'keepopen': !nerdtree#closeTreeOnOpen()} : {})
536endfunction
537
538" FUNCTION: s:previewHSplitBookmark(bookmark) {{{1
539function! s:previewNodeHSplitBookmark(bookmark) abort
540 call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'h', 'keepopen': 1} : {})
541endfunction
542
543" FUNCTION: s:previewVSplitBookmark(bookmark) {{{1
544function! s:previewNodeVSplitBookmark(bookmark) abort
545 call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'v', 'keepopen': 1} : {})
546endfunction
547
548" FUNCTION: s:openExplorer(node) {{{1
549function! s:openExplorer(node) abort
550 call a:node.openExplorer()
551endfunction
552
553" FUNCTION: s:openInNewTab(target) {{{1
554function! s:openInNewTab(target) abort
555 let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'keepopen': !nerdtree#closeTreeOnOpen()})
556 call l:opener.open(a:target)
557endfunction
558
559" FUNCTION: s:openInNewTabSilent(target) {{{1
560function! s:openInNewTabSilent(target) abort
561 let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'keepopen': !nerdtree#closeTreeOnOpen(), 'stay': 1})
562 call l:opener.open(a:target)
563endfunction
564
565" FUNCTION: s:openNodeRecursively(node) {{{1
566function! s:openNodeRecursively(node) abort
567 call nerdtree#echo('Recursively opening node. Please wait...')
568 call a:node.openRecursively()
569 call b:NERDTree.render()
570 call nerdtree#echo('')
571endfunction
572
573" FUNCTION: s:previewBookmark(bookmark) {{{1
574function! s:previewBookmark(bookmark) abort
575 if a:bookmark.path.isDirectory
576 execute 'NERDTreeFind '.a:bookmark.path.str()
577 else
578 call a:bookmark.activate(b:NERDTree, {'stay': 1, 'where': 'p', 'keepopen': 1})
579 endif
580endfunction
581
582"FUNCTION: s:previewNodeCurrent(node) {{{1
583function! s:previewNodeCurrent(node) abort
584 call a:node.open({'stay': 1, 'where': 'p', 'keepopen': 1})
585endfunction
586
587"FUNCTION: s:previewNodeHSplit(node) {{{1
588function! s:previewNodeHSplit(node) abort
589 call a:node.open({'stay': 1, 'where': 'h', 'keepopen': 1})
590endfunction
591
592"FUNCTION: s:previewNodeVSplit(node) {{{1
593function! s:previewNodeVSplit(node) abort
594 call a:node.open({'stay': 1, 'where': 'v', 'keepopen': 1})
595endfunction
596
597" FUNCTION: nerdtree#ui_glue#revealBookmark(name) {{{1
598" put the cursor on the node associate with the given name
599function! nerdtree#ui_glue#revealBookmark(name) abort
600 try
601 let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree)
602 call targetNode.putCursorHere(0, 1)
603 catch /^NERDTree.BookmarkNotFoundError/
604 call nerdtree#echo('Bookmark isn''t cached under the current root')
605 endtry
606endfunction
607
608" FUNCTION: s:refreshRoot() {{{1
609" Reloads the current root. All nodes below this will be lost and the root dir
610" will be reloaded.
611function! s:refreshRoot() abort
612 if !g:NERDTree.IsOpen()
613 return
614 endif
615 call nerdtree#echo('Refreshing the root node. This could take a while...')
616
617 let l:curWin = winnr()
618 call nerdtree#exec(g:NERDTree.GetWinNum() . 'wincmd w', 1)
619 call b:NERDTree.root.refresh()
620 call b:NERDTree.render()
621 redraw
622 call nerdtree#exec(l:curWin . 'wincmd w', 1)
623 call nerdtree#echo('')
624endfunction
625
626" FUNCTION: s:refreshCurrent(node) {{{1
627" refreshes the root for the current node
628function! s:refreshCurrent(node) abort
629 let node = a:node
630 if !node.path.isDirectory
631 let node = node.parent
632 endif
633
634 call nerdtree#echo('Refreshing node. This could take a while...')
635 call node.refresh()
636 call b:NERDTree.render()
637 call nerdtree#echo('')
638endfunction
639
640" FUNCTION: nerdtree#ui_glue#setupCommands() {{{1
641function! nerdtree#ui_glue#setupCommands() abort
642 command! -n=? -complete=dir -bar NERDTree :call g:NERDTreeCreator.CreateTabTree('<args>')
643 command! -n=? -complete=dir -bar NERDTreeToggle :call g:NERDTreeCreator.ToggleTabTree('<args>')
644 command! -n=0 -bar NERDTreeClose :call g:NERDTree.Close()
645 command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.CreateTabTree('<args>')
646 command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.CreateMirror()
647 command! -n=? -complete=file -bar NERDTreeFind call s:findAndRevealPath('<args>')
648 command! -n=0 -bar NERDTreeRefreshRoot call s:refreshRoot()
649 command! -n=0 -bar NERDTreeFocus call NERDTreeFocus()
650 command! -n=0 -bar NERDTreeCWD call NERDTreeCWD()
651endfunction
652
653" Function: s:SID() {{{1
654function! s:SID() abort
655 if !exists('s:sid')
656 let s:sid = matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$')
657 endif
658 return s:sid
659endfun
660
661" FUNCTION: s:showMenu(node) {{{1
662function! s:showMenu(node) abort
663 let mc = g:NERDTreeMenuController.New(g:NERDTreeMenuItem.AllEnabled())
664 call mc.showMenu()
665endfunction
666
667" FUNCTION: s:toggleIgnoreFilter() {{{1
668function! s:toggleIgnoreFilter() abort
669 call b:NERDTree.ui.toggleIgnoreFilter()
670endfunction
671
672" FUNCTION: s:toggleShowBookmarks() {{{1
673function! s:toggleShowBookmarks() abort
674 call b:NERDTree.ui.toggleShowBookmarks()
675endfunction
676
677" FUNCTION: s:toggleShowFiles() {{{1
678function! s:toggleShowFiles() abort
679 call b:NERDTree.ui.toggleShowFiles()
680endfunction
681
682" FUNCTION: s:toggleShowHidden() {{{1
683" toggles the display of hidden files
684function! s:toggleShowHidden() abort
685 call b:NERDTree.ui.toggleShowHidden()
686endfunction
687
688" FUNCTION: s:toggleZoom() {{{1
689function! s:toggleZoom() abort
690 call b:NERDTree.ui.toggleZoom()
691endfunction
692
693" FUNCTION: nerdtree#ui_glue#upDir(preserveState) {{{1
694" Move the NERDTree up one level.
695"
696" Args:
697" preserveState: if 1, the current root is left open when the new tree is
698" rendered; if 0, the current root node is closed
699function! nerdtree#ui_glue#upDir(preserveState) abort
700
701 try
702 call b:NERDTree.root.cacheParent()
703 catch /^NERDTree.CannotCacheParentError/
704 call nerdtree#echo('already at root directory')
705 return
706 endtry
707
708 let l:oldRoot = b:NERDTree.root
709 let l:newRoot = b:NERDTree.root.parent
710
711 call l:newRoot.open()
712 call l:newRoot.transplantChild(l:oldRoot)
713
714 if !a:preserveState
715 call l:oldRoot.close()
716 endif
717
718 call b:NERDTree.changeRoot(l:newRoot)
719 call l:oldRoot.putCursorHere(0, 0)
720endfunction
721
722" FUNCTION: s:upDirCurrentRootOpen() {{{1
723function! s:upDirCurrentRootOpen() abort
724 call nerdtree#ui_glue#upDir(1)
725endfunction
726
727" FUNCTION: s:upDirCurrentRootClosed() {{{1
728function! s:upDirCurrentRootClosed() abort
729 call nerdtree#ui_glue#upDir(0)
730endfunction
731
732" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/.vim/pack/vendor/start/nerdtree/doc/NERDTree.txt b/.vim/pack/vendor/start/nerdtree/doc/NERDTree.txt
new file mode 100644
index 0000000..55c25cd
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/doc/NERDTree.txt
@@ -0,0 +1,1534 @@
1*NERDTree.txt* A tree explorer plugin to rule the Vim world. Bwahahaha!!
2
3 # #### #### ~
4 ### \/#|### |/#### ~
5 d8 888 ##\/#/ \||/##/_/##/_# ~
6 d88 888 ee ,e e, ### \/###|/ \/ # ### ~
7 d88888 888 88b d88 88b ##_\_#\_\## | #/###_/_#### ~
8 888 888 888 888 , ## #### # \ #| / #### ##/## ~
9 888 888 888 "YeeP" __#_--###`. |{,###---###-~ ~
10 \ % @% ~
11 Y88b Y88 888'Y88 888 88e 888 88e \%@% 88P'888'Y88 ~
12 Y88b Y8 888 ,'Y 888 888D 888 888b %o% P' 888 'Y 888,8, ,e e, ,e e, ~
13 b Y88b Y 888C8 888 88" 888 8888D %@% 888 888 " d88 88b d88 88b ~
14 8b Y88b 888 ",d 888 b, 888 888P %@% 888 888 888 , 888 , ~
15 88b Y88b 888,d88 888 88b, 888 88" %@% 888 888 "YeeP" "YeeP" ~
16 , -=-%{@%-^- _ ~
17 ejm `} Reference Manual ~
18 { ~
19==============================================================================
20CONTENTS *NERDTree-contents*
21
22 1.Intro...................................|NERDTree|
23 2.Functionality provided..................|NERDTreeFunctionality|
24 2.1.Global commands...................|NERDTreeGlobalCommands|
25 2.2.Bookmarks.........................|NERDTreeBookmarks|
26 2.2.1.The bookmark table..........|NERDTreeBookmarkTable|
27 2.2.2.Bookmark commands...........|NERDTreeBookmarkCommands|
28 2.2.3.Invalid bookmarks...........|NERDTreeInvalidBookmarks|
29 2.3.NERDTree mappings.................|NERDTreeMappings|
30 2.4.The NERDTree menu.................|NERDTreeMenu|
31 3.Settings................................|NERDTreeSettings|
32 3.1.Settings summary..................|NERDTreeSettingsSummary|
33 3.2.Settings details..................|NERDTreeSettingsDetails|
34 4.The NERDTree API........................|NERDTreeAPI|
35 4.1.Key map API.......................|NERDTreeKeymapAPI|
36 4.2.Menu API..........................|NERDTreeMenuAPI|
37 4.3.Menu API..........................|NERDTreeAddPathFilter()|
38 4.4.Path Listener API.................|NERDTreePathListenerAPI|
39 5.About...................................|NERDTreeAbout|
40 6.License.................................|NERDTreeLicense|
41
42==============================================================================
431. Intro *NERDTree*
44
45What is this "NERDTree"??
46
47The NERDTree allows you to explore your filesystem and to open files and
48directories. It presents the filesystem to you in the form of a tree which you
49manipulate with the keyboard and/or mouse. It also allows you to perform
50simple filesystem operations.
51
52The following features and functionality are provided by the NERDTree:
53 * Files and directories are displayed in a hierarchical tree structure
54 * Different highlighting is provided for the following types of nodes:
55 * files
56 * directories
57 * sym-links
58 * windows .lnk files
59 * read-only files
60 * executable files
61 * Many (customisable) mappings are provided to manipulate the tree:
62 * Mappings to open/close/explore directory nodes
63 * Mappings to open files in new/existing windows/tabs
64 * Mappings to change the current root of the tree
65 * Mappings to navigate around the tree
66 * ...
67 * Directories and files can be bookmarked.
68 * Most NERDTree navigation can also be done with the mouse
69 * Filtering of tree content (can be toggled at runtime)
70 * custom file filters to prevent e.g. vim backup files being displayed
71 * optional displaying of hidden files (. files)
72 * files can be "turned off" so that only directories are displayed
73 * The position and size of the NERDTree window can be customised
74 * The order in which the nodes in the tree are listed can be customised.
75 * A model of your filesystem is created/maintained as you explore it. This
76 has several advantages:
77 * All filesystem information is cached and is only re-read on demand
78 * If you revisit a part of the tree that you left earlier in your
79 session, the directory nodes will be opened/closed as you left them
80 * The script remembers the cursor position and window position in the NERD
81 tree so you can toggle it off (or just close the tree window) and then
82 reopen it (with NERDTreeToggle) the NERDTree window will appear exactly
83 as you left it
84 * You can have a separate NERDTree for each tab, share trees across tabs,
85 or a mix of both.
86 * By default the script overrides the default file browser (netrw), so if
87 you :edit a directory a (slightly modified) NERDTree will appear in the
88 current window
89 * A programmable menu system is provided (simulates right clicking on a
90 node)
91 * one default menu plugin is provided to perform basic filesystem
92 operations (create/delete/move/copy files/directories)
93 * There's an API for adding your own keymappings
94
95
96==============================================================================
972. Functionality provided *NERDTreeFunctionality*
98
99------------------------------------------------------------------------------
1002.1. Global Commands *NERDTreeGlobalCommands*
101
102:NERDTree [<start-directory> | <bookmark>] *:NERDTree*
103 Opens a fresh NERDTree. The root of the tree depends on the argument
104 given. There are 3 cases: If no argument is given, the current directory
105 will be used. If a directory is given, that will be used. If a bookmark
106 name is given, the corresponding directory will be used. For example: >
107 :NERDTree /home/marty/vim7/src
108 :NERDTree foo (foo is the name of a bookmark)
109<
110:NERDTreeVCS [<start-directory> | <bookmark>] *:NERDTreeVCS*
111 Like |:NERDTree|, but searches up the directory tree to find the top of
112 the version control system repository, and roots the NERDTree there. It
113 works with Git, Subversion, Mercurial, Bazaar, and Darcs repositories. A
114 couple of examples: >
115 :NERDTreeVCS /home/marty/nerdtree/doc (opens /home/marty/nerdtree)
116 :NERDTreeVCS (opens root of repository containing CWD)
117<
118:NERDTreeFromBookmark <bookmark> *:NERDTreeFromBookmark*
119 Opens a fresh NERDTree with the root initialized to the directory for
120 <bookmark>. The only reason to use this command over :NERDTree is for
121 the completion (which is for bookmarks rather than directories).
122
123:NERDTreeToggle [<start-directory> | <bookmark>] *:NERDTreeToggle*
124 If a NERDTree already exists for this tab, it is reopened and rendered
125 again. If <start-directory> or <bookmark> is given, the root of NERDTree
126 is set to that path. If no NERDTree exists for this tab then this command
127 acts the same as the |:NERDTree| command.
128
129:NERDTreeToggleVCS [<start-directory> | <bookmark>] *:NERDTreeToggleVCS*
130 Like |:NERDTreeToggle|, but searches up the directory tree to find the top of
131 the version control system repository, and roots the NERDTree there. It
132 works with Git, Subversion, Mercurial, Bazaar, and Darcs repositories. A
133 couple of examples: >
134 :NERDTreeToggleVCS /home/marty/nerdtree/doc (opens /home/marty/nerdtree)
135 :NERDTreeToggleVCS (opens root of repository containing CWD)
136
137:NERDTreeFocus *:NERDTreeFocus*
138 Opens (or reopens) the NERDTree if it is not currently visible;
139 otherwise, the cursor is moved to the already-open NERDTree.
140
141:NERDTreeMirror *:NERDTreeMirror*
142 Shares an existing NERDTree, from another tab, in the current tab.
143 Changes made to one tree are reflected in both as they are actually the
144 same buffer.
145
146 If only one other NERDTree exists, that tree is automatically mirrored.
147 If more than one exists, the script will ask which tree to mirror.
148
149:NERDTreeClose *:NERDTreeClose*
150 Close the NERDTree in this tab.
151
152:NERDTreeFind [<path>] *:NERDTreeFind*
153 Without the optional argument, find and reveal the file for the active
154 buffer in the NERDTree window. With the <path> argument, find and
155 reveal the specified path.
156
157 Focus will be shifted to the NERDTree window, and the cursor will be
158 placed on the tree node for the determined path. If a NERDTree for the
159 current tab does not exist, a new one will be initialized.
160
161:NERDTreeCWD *:NERDTreeCWD*
162 Change the NERDTree root to the current working directory. If no
163 NERDTree exists for this tab, a new one is opened.
164
165:NERDTreeRefreshRoot *:NERDTreeRefreshRoot*
166 Refreshes the NERDTree root node.
167
168------------------------------------------------------------------------------
1692.2. Bookmarks *NERDTreeBookmarks*
170
171Bookmarks in the NERDTree are a way to tag files or directories of interest.
172For example, you could use bookmarks to tag all of your project directories.
173
174------------------------------------------------------------------------------
1752.2.1. The Bookmark Table *NERDTreeBookmarkTable*
176
177If the bookmark table is active (see |NERDTree-B| and
178|NERDTreeShowBookmarks|), it will be rendered above the tree. You can double
179click bookmarks or use the |NERDTree-o| mapping to activate them. See also,
180|NERDTree-t| and |NERDTree-T|
181
182------------------------------------------------------------------------------
1832.2.2. Bookmark commands *NERDTreeBookmarkCommands*
184
185Note: The following commands are only available within the NERDTree buffer.
186
187:Bookmark [<name>]
188 Bookmark the current node as <name>. If there is already a <name>
189 bookmark, it is overwritten. <name> must not contain spaces.
190 If <name> is not provided, it defaults to the file or directory name.
191 For directories, a trailing slash is present.
192
193:BookmarkToRoot <bookmark>
194 Make the directory corresponding to <bookmark> the new root. If a treenode
195 corresponding to <bookmark> is already cached somewhere in the tree then
196 the current tree will be used, otherwise a fresh tree will be opened.
197 Note that if <bookmark> points to a file then its parent will be used
198 instead.
199
200:RevealBookmark <bookmark>
201 If the node is cached under the current root then it will be revealed
202 (i.e. directory nodes above it will be opened) and the cursor will be
203 placed on it.
204
205:OpenBookmark <name>
206 The Bookmark named <name> is opened as if |NERDTree-o| was applied to
207 its entry in the Bookmark table. If the Bookmark points to a directory,
208 it is made the new root of the current NERDTree. If the Bookmark points
209 to a file, that file is opened for editing in another window.
210
211:ClearBookmarks [<bookmarks>]
212 Remove all the given bookmarks. If no bookmarks are given then remove all
213 bookmarks on the current node.
214
215:ClearAllBookmarks
216 Remove all bookmarks.
217
218:EditBookmarks
219 Opens the bookmarks file for manual editing, e.g. for removing invalid
220 bookmarks.
221
222:ReadBookmarks
223 Re-read the bookmarks in the |NERDTreeBookmarksFile|.
224
225See also |:NERDTree| and |:NERDTreeFromBookmark|.
226
227------------------------------------------------------------------------------
2282.2.3. Invalid Bookmarks *NERDTreeInvalidBookmarks*
229
230If invalid bookmarks are detected, the script will issue an error message and
231the invalid bookmarks will become unavailable for use.
232
233These bookmarks will still be stored in the bookmarks file (see
234|NERDTreeBookmarksFile|), down at the bottom. There will always be a blank line
235after the valid bookmarks but before the invalid ones.
236
237Each line in the bookmarks file represents one bookmark. The proper format is:
238<bookmark name><space><full path to the bookmark location>
239
240You can use the :EditBookmarks command to open the bookmarks file for editing.
241After you have corrected any invalid bookmarks, either restart vim, or run
242:ReadBookmarks from the NERDTree window.
243
244------------------------------------------------------------------------------
2452.3. NERDTree Mappings *NERDTreeMappings*
246
247Default~
248Key Description help-tag~
249
250o........Open files, directories and bookmarks......................|NERDTree-o|
251go.......Open selected file, but leave cursor in the NERDTree......|NERDTree-go|
252 Find selected bookmark directory in current NERDTree
253t........Open selected node/bookmark in a new tab...................|NERDTree-t|
254T........Same as 't' but keep the focus on the current tab..........|NERDTree-T|
255i........Open selected file in a split window.......................|NERDTree-i|
256gi.......Same as i, but leave the cursor on the NERDTree...........|NERDTree-gi|
257s........Open selected file in a new vsplit.........................|NERDTree-s|
258gs.......Same as s, but leave the cursor on the NERDTree...........|NERDTree-gs|
259<CR>.....User-definable custom open action.......................|NERDTree-<CR>|
260O........Recursively open the selected directory....................|NERDTree-O|
261x........Close the current nodes parent.............................|NERDTree-x|
262X........Recursively close all children of the current node.........|NERDTree-X|
263e........Edit the current directory.................................|NERDTree-e|
264
265double-click....same as |NERDTree-o|.
266middle-click....same as |NERDTree-i| for files, and |NERDTree-e| for directories.
267
268D........Delete the current bookmark ...............................|NERDTree-D|
269
270P........Jump to the root node......................................|NERDTree-P|
271p........Jump to current nodes parent...............................|NERDTree-p|
272K........Jump up inside directories at the current tree depth.......|NERDTree-K|
273J........Jump down inside directories at the current tree depth.....|NERDTree-J|
274<C-J>....Jump down to next sibling of the current directory.......|NERDTree-C-J|
275<C-K>....Jump up to previous sibling of the current directory.....|NERDTree-C-K|
276
277C........Change the tree root to the selected directory.............|NERDTree-C|
278u........Move the tree root up one directory........................|NERDTree-u|
279U........Same as 'u' except the old root node is left open..........|NERDTree-U|
280r........Recursively refresh the current directory..................|NERDTree-r|
281R........Recursively refresh the current root.......................|NERDTree-R|
282m........Display the NERDTree menu..................................|NERDTree-m|
283cd.......Change the CWD to the directory of the selected node......|NERDTree-cd|
284CD.......Change tree root to the CWD...............................|NERDTree-CD|
285
286I........Toggle whether hidden files displayed......................|NERDTree-I|
287f........Toggle whether the file filters are used...................|NERDTree-f|
288F........Toggle whether files are displayed.........................|NERDTree-F|
289B........Toggle whether the bookmark table is displayed.............|NERDTree-B|
290
291q........Close the NERDTree window..................................|NERDTree-q|
292A........Zoom (maximize/minimize) the NERDTree window...............|NERDTree-A|
293?........Toggle the display of the quick help.......................|NERDTree-?|
294
295------------------------------------------------------------------------------
296 *NERDTree-o*
297Default key: o
298Map setting: NERDTreeMapActivateNode
299Applies to: files and directories.
300
301If a file node is selected, it is opened in the previous window.
302
303If a directory is selected it is opened or closed depending on its current
304state.
305
306If a bookmark that links to a directory is selected then that directory
307becomes the new root.
308
309If a bookmark that links to a file is selected then that file is opened in the
310previous window.
311
312------------------------------------------------------------------------------
313 *NERDTree-go*
314Default key: go
315Map setting: NERDTreeMapPreview
316Applies to: files.
317
318If a file node or a bookmark that links to a file is selected, it is opened in
319the previous window, but the cursor does not move.
320
321If a bookmark that links to a directory is selected then that directory
322becomes the new root.
323
324The default key combo for this mapping is "g" + NERDTreeMapActivateNode (see
325|NERDTree-o|).
326
327------------------------------------------------------------------------------
328 *NERDTree-t*
329Default key: t
330Map setting: *NERDTreeMapOpenInTab*
331Applies to: files and directories.
332
333Opens the selected file in a new tab. If a directory is selected, a fresh
334NERDTree for that directory is opened in a new tab.
335
336If a bookmark which points to a directory is selected, open a NERDTree for
337that directory in a new tab. If the bookmark points to a file, open that file
338in a new tab.
339
340------------------------------------------------------------------------------
341 *NERDTree-T*
342Default key: T
343Map setting: *NERDTreeMapOpenInTabSilent*
344Applies to: files and directories.
345
346The same as |NERDTree-t| except that the focus is kept in the current tab.
347
348------------------------------------------------------------------------------
349 *NERDTree-i*
350Default key: i
351Map setting: *NERDTreeMapOpenSplit*
352Applies to: files, and bookmarks pointing to files.
353
354Opens the selected file in a new split window and puts the cursor in the new
355window.
356
357------------------------------------------------------------------------------
358 *NERDTree-gi*
359Default key: gi
360Map setting: *NERDTreeMapPreviewSplit*
361Applies to: files, and bookmarks pointing to files.
362
363The same as |NERDTree-i| except that the cursor is not moved.
364
365The default key combo for this mapping is "g" + NERDTreeMapOpenSplit (see
366|NERDTree-i|).
367
368------------------------------------------------------------------------------
369 *NERDTree-s*
370Default key: s
371Map setting: *NERDTreeMapOpenVSplit*
372Applies to: files, and bookmarks pointing to files.
373
374Opens the selected file in a new vertically split window and puts the cursor
375in the new window.
376
377------------------------------------------------------------------------------
378 *NERDTree-gs*
379Default key: gs
380Map setting: *NERDTreeMapPreviewVSplit*
381Applies to: files, and bookmarks pointing to files.
382
383The same as |NERDTree-s| except that the cursor is not moved.
384
385The default key combo for this mapping is "g" + NERDTreeMapOpenVSplit (see
386|NERDTree-s|).
387
388------------------------------------------------------------------------------
389 *NERDTree-<CR>*
390Default key: <CR>
391Map setting: *NERDTreeMapCustomOpen*
392Applies to: files, directories, and bookmarks
393
394Performs a customized open action on the selected node. This allows the user
395to define an action that behaves differently from any of the standard
396keys. See |NERDTreeCustomOpenArgs| for more details.
397------------------------------------------------------------------------------
398 *NERDTree-O*
399Default key: O
400Map setting: *NERDTreeMapOpenRecursively*
401Applies to: directories.
402
403Recursively opens the selected directory.
404
405All files and directories are cached, but if a directory would not be
406displayed due to file filters (see |NERDTreeIgnore| |NERDTree-f|) or the
407hidden file filter (see |NERDTreeShowHidden|) then its contents are not
408cached. This is handy, especially if you have .svn directories.
409
410------------------------------------------------------------------------------
411 *NERDTree-x*
412Default key: x
413Map setting: *NERDTreeMapCloseDir*
414Applies to: files and directories.
415
416Closes the parent of the selected node.
417
418------------------------------------------------------------------------------
419 *NERDTree-X*
420Default key: X
421Map setting: *NERDTreeMapCloseChildren*
422Applies to: directories.
423
424Recursively closes all children of the selected directory.
425
426Tip: To quickly "reset" the tree, use |NERDTree-P| with this mapping.
427
428------------------------------------------------------------------------------
429 *NERDTree-e*
430Default key: e
431Map setting: *NERDTreeMapOpenExpl*
432Applies to: files and directories.
433
434|:edit|s the selected directory, or the selected file's directory. This could
435result in a NERDTree or a netrw being opened, depending on
436|NERDTreeHijackNetrw|.
437
438------------------------------------------------------------------------------
439 *NERDTree-D*
440Default key: D
441Map setting: *NERDTreeMapDeleteBookmark*
442Applies to: lines in the bookmarks table
443
444Deletes the currently selected bookmark.
445
446------------------------------------------------------------------------------
447 *NERDTree-P*
448Default key: P
449Map setting: *NERDTreeMapJumpRoot*
450Applies to: no restrictions.
451
452Jump to the tree root.
453
454------------------------------------------------------------------------------
455 *NERDTree-p*
456Default key: p
457Map setting: *NERDTreeMapJumpParent*
458Applies to: files and directories.
459
460Jump to the parent node of the selected node.
461
462------------------------------------------------------------------------------
463 *NERDTree-K*
464Default key: K
465Map setting: *NERDTreeMapJumpFirstChild*
466Applies to: files and directories.
467
468Jump to the first child of the current nodes parent.
469
470If the cursor is already on the first node then do the following:
471 * loop back thru the siblings of the current nodes parent until we find an
472 open directory with children
473 * go to the first child of that node
474
475------------------------------------------------------------------------------
476 *NERDTree-J*
477Default key: J
478Map setting: *NERDTreeMapJumpLastChild*
479Applies to: files and directories.
480
481Jump to the last child of the current nodes parent.
482
483If the cursor is already on the last node then do the following:
484 * loop forward thru the siblings of the current nodes parent until we find
485 an open directory with children
486 * go to the last child of that node
487
488------------------------------------------------------------------------------
489 *NERDTree-C-J*
490Default key: <C-J>
491Map setting: *NERDTreeMapJumpNextSibling*
492Applies to: files and directories.
493
494Jump to the next sibling of the selected node.
495
496------------------------------------------------------------------------------
497 *NERDTree-C-K*
498Default key: <C-K>
499Map setting: *NERDTreeMapJumpPrevSibling*
500Applies to: files and directories.
501
502Jump to the previous sibling of the selected node.
503
504------------------------------------------------------------------------------
505 *NERDTree-C*
506Default key: C
507Map setting: *NERDTreeMapChangeRoot*
508Applies to: files and directories.
509
510Make the selected directory node the new tree root. If a file is selected, its
511parent is used.
512
513------------------------------------------------------------------------------
514 *NERDTree-u*
515Default key: u
516Map setting: *NERDTreeMapUpdir*
517Applies to: no restrictions.
518
519Move the tree root up a directory (like doing a "cd ..").
520
521------------------------------------------------------------------------------
522 *NERDTree-U*
523Default key: U
524Map setting: *NERDTreeMapUpdirKeepOpen*
525Applies to: no restrictions.
526
527Like |NERDTree-u| except that the old tree root is kept open.
528
529------------------------------------------------------------------------------
530 *NERDTree-r*
531Default key: r
532Map setting: *NERDTreeMapRefresh*
533Applies to: files and directories.
534
535If a directory is selected, recursively refresh that directory, i.e. scan the
536filesystem for changes and represent them in the tree.
537
538If a file node is selected then the above is done on it's parent.
539
540------------------------------------------------------------------------------
541 *NERDTree-R*
542Default key: R
543Map setting: *NERDTreeMapRefreshRoot*
544Applies to: no restrictions.
545
546Recursively refresh the tree root.
547
548------------------------------------------------------------------------------
549 *NERDTree-m*
550Default key: m
551Map setting: *NERDTreeMapMenu*
552Applies to: files and directories.
553
554Display the NERDTree menu. See |NERDTreeMenu| for details.
555
556------------------------------------------------------------------------------
557 *NERDTree-cd*
558Default key: cd
559Map setting: *NERDTreeMapChdir*
560Applies to: files and directories.
561
562Change Vim's current working directory to that of the selected node.
563
564------------------------------------------------------------------------------
565 *NERDTree-CD*
566Default key: CD
567Map setting: *NERDTreeMapCWD*
568Applies to: no restrictions.
569
570Change the NERDTree root to Vim's current working directory.
571
572------------------------------------------------------------------------------
573 *NERDTree-I*
574Default key: I
575Map setting: *NERDTreeMapToggleHidden*
576Applies to: no restrictions.
577
578Toggles whether hidden files (i.e. "dot files") are displayed.
579
580------------------------------------------------------------------------------
581 *NERDTree-f*
582Default key: f
583Map setting: *NERDTreeMapToggleFilters*
584Applies to: no restrictions.
585
586Toggles whether file filters are used. See |NERDTreeIgnore| for details.
587
588------------------------------------------------------------------------------
589 *NERDTree-F*
590Default key: F
591Map setting: *NERDTreeMapToggleFiles*
592Applies to: no restrictions.
593
594Toggles whether file nodes are displayed.
595
596------------------------------------------------------------------------------
597 *NERDTree-B*
598Default key: B
599Map setting: *NERDTreeMapToggleBookmarks*
600Applies to: no restrictions.
601
602Toggles whether the bookmarks table is displayed.
603
604------------------------------------------------------------------------------
605 *NERDTree-q*
606Default key: q
607Map setting: *NERDTreeMapQuit*
608Applies to: no restrictions.
609
610Closes the NERDTree window.
611
612------------------------------------------------------------------------------
613 *NERDTree-A*
614Default key: A
615Map setting: *NERDTreeMapToggleZoom*
616Applies to: no restrictions.
617
618Maximize (zoom) and minimize the NERDTree window.
619
620------------------------------------------------------------------------------
621 *NERDTree-?*
622Default key: ?
623Map setting: *NERDTreeMapHelp*
624Applies to: no restrictions.
625
626Toggles whether the quickhelp is displayed.
627
628------------------------------------------------------------------------------
629 2.3. The NERDTree menu *NERDTreeMenu*
630
631The NERDTree has a menu that can be programmed via the an API (see
632|NERDTreeMenuAPI|). The idea is to simulate the "right click" menus that most
633file explorers have.
634
635The script comes with two default menu plugins: exec_menuitem.vim and
636fs_menu.vim. fs_menu.vim adds some basic filesystem operations to the menu for
637creating/deleting/moving/copying files and directories. exec_menuitem.vim
638provides a menu item to execute executable files.
639
640Related tags: |NERDTree-m| |NERDTreeApi|
641
642------------------------------------------------------------------------------
643 *NERDTreeMenu-j*
644Default key: j
645Map option: *NERDTreeMenuDown*
646Applies to: The NERDTree menu.
647
648Moves the cursor down.
649
650------------------------------------------------------------------------------
651 *NERDTreeMenu-k*
652Default key: k
653Map option: *NERDTreeMenuUp*
654Applies to: The NERDTree menu.
655
656Moves the cursor up.
657
658==============================================================================
6593. Customisation *NERDTreeSettings*
660
661
662------------------------------------------------------------------------------
6633.1. Customisation summary *NERDTreeSettingsSummary*
664
665The plugin provides the following settings that can customise the behaviour
666the NERDTree. These settings should be set in your vimrc, using `:let`.
667
668|loaded_nerd_tree| Turns off the script.
669
670|NERDTreeAutoCenter| Controls whether the NERDTree window centers
671 when the cursor moves within a specified
672 distance to the top/bottom of the window.
673
674|NERDTreeAutoCenterThreshold| Controls the sensitivity of autocentering.
675
676|NERDTreeCaseSensitiveSort| Tells the NERDTree whether to be case
677 sensitive or not when sorting nodes.
678
679|NERDTreeNaturalSort| Tells the NERDTree whether to use natural sort
680 order or not when sorting nodes.
681
682|NERDTreeSortHiddenFirst| Tells the NERDTree whether to take the dot at
683 the beginning of the hidden file names into
684 account when sorting nodes.
685
686|NERDTreeChDirMode| Tells the NERDTree if/when it should change
687 vim's current working directory.
688
689|NERDTreeHighlightCursorline| Tell the NERDTree whether to highlight the
690 current cursor line.
691
692|NERDTreeHijackNetrw| Tell the NERDTree whether to replace the netrw
693 autocommands for exploring local directories.
694
695|NERDTreeIgnore| Tells the NERDTree which files to ignore.
696
697|NERDTreeRespectWildIgnore| Tells the NERDTree to respect `'wildignore'`.
698
699|NERDTreeBookmarksFile| Where the bookmarks are stored.
700
701|NERDTreeBookmarksSort| Control how the Bookmark table is sorted.
702
703|NERDTreeMarkBookmarks| Render bookmarked nodes with markers.
704
705|NERDTreeMouseMode| Manage the interpretation of mouse clicks.
706
707|NERDTreeQuitOnOpen| Closes the tree window or bookmark table after
708 opening a file.
709
710|NERDTreeShowBookmarks| Tells the NERDTree whether to display the
711 bookmarks table on startup.
712
713|NERDTreeShowFiles| Tells the NERDTree whether to display files in
714 the tree on startup.
715
716|NERDTreeShowHidden| Tells the NERDTree whether to display hidden
717 files on startup.
718
719|NERDTreeShowLineNumbers| Tells the NERDTree whether to display line
720 numbers in the tree window.
721
722|NERDTreeSortOrder| Tell the NERDTree how to sort the nodes in the
723 tree.
724
725|NERDTreeStatusline| Set a statusline for NERDTree windows.
726
727|NERDTreeWinPos| Tells the script where to put the NERDTree
728 window.
729
730|NERDTreeWinSize| Sets the window size when the NERDTree is
731 opened.
732
733|NERDTreeWinSizeMax| Sets the maximum window size when the NERDTree
734 is zoomed.
735
736|NERDTreeMinimalUI| Disables display of the 'Bookmarks' label and
737 'Press ? for help' text.
738
739|NERDTreeMinimalMenu| Use a compact menu that fits on a single line
740 for adding, copying, deleting, etc
741
742|NERDTreeCascadeSingleChildDir|
743 Collapses on the same line directories that have
744 only one child directory.
745
746|NERDTreeCascadeOpenSingleChildDir|
747 Cascade open while selected directory has only
748 one child that also is a directory.
749
750|NERDTreeAutoDeleteBuffer| Tells the NERDTree to automatically remove a
751 buffer when a file is being deleted or renamed
752 via a context menu command.
753
754|NERDTreeCreatePrefix| Specify a prefix to be used when creating the
755 NERDTree window.
756
757|NERDTreeRemoveFileCmd| Specify a custom shell command to be used when
758 deleting files. Note that it should include one
759 space character at the end of the command and it
760 applies only to files.
761
762|NERDTreeRemoveDirCmd| Specify a custom shell command to be used when
763 deleting directories. Note that it should
764 include one space character at the end of the
765 command and it applies only to directories.
766
767|NERDTreeDirArrowCollapsible| These characters indicate when a directory is
768|NERDTreeDirArrowExpandable| either collapsible or expandable.
769
770|NERDTreeNodeDelimiter| A single character that is used to separate the
771 file or directory name from the rest of the
772 characters on the line of text.
773
774|NERDTreeCustomOpenArgs| A dictionary with values that control how a node
775 is opened with the |NERDTree-<CR>| key.
776
777------------------------------------------------------------------------------
7783.2. Customisation details *NERDTreeSettingsDetails*
779
780To enable any of the below settings you should put an appropriate >
781 let <setting>=<value>
782<line in your ~/.vimrc.
783
784 *loaded_nerd_tree*
785If this plugin is making you feel homicidal, it may be a good idea to turn it
786off with this line in your vimrc: >
787 let loaded_nerd_tree=1
788<
789------------------------------------------------------------------------------
790 *NERDTreeAutoCenter*
791Values: 0 or 1.
792Default: 1
793
794If set to 1, the NERDTree window will center around the cursor if it moves to
795within |NERDTreeAutoCenterThreshold| lines of the top/bottom of the window.
796
797This is ONLY done in response to tree navigation mappings,
798i.e. |NERDTree-J| |NERDTree-K| |NERDTree-C-J| |NERDTree-C-K| |NERDTree-p|
799|NERDTree-P|
800
801The centering is done with a |zz| operation.
802
803------------------------------------------------------------------------------
804 *NERDTreeAutoCenterThreshold*
805Values: Any natural number.
806Default: 3
807
808This setting controls the "sensitivity" of the NERDTree auto centering. See
809|NERDTreeAutoCenter| for details.
810
811------------------------------------------------------------------------------
812 *NERDTreeCaseSensitiveSort*
813Values: 0 or 1.
814Default: 0.
815
816By default the NERDTree does not sort nodes case sensitively, i.e. nodes
817could appear like this: >
818 bar.c
819 Baz.c
820 blarg.c
821 boner.c
822 Foo.c
823<
824But, if you set this setting to 1 then the case of the nodes will be taken
825into account. The above nodes would then be sorted like this: >
826 Baz.c
827 Foo.c
828 bar.c
829 blarg.c
830 boner.c
831<
832------------------------------------------------------------------------------
833 *NERDTreeNaturalSort*
834Values: 0 or 1.
835Default: 0.
836
837By default the NERDTree does not sort nodes in natural sort order, i.e. nodes
838could appear like this: >
839 z1.txt
840 z10.txt
841 z100.txt
842 z11.txt
843 z110.txt
844 z2.txt
845 z20.txt
846 z3.txt
847<
848But if you set this setting to 1 then the natural sort order will be used. The
849above nodes would then be sorted like this: >
850 z1.txt
851 z2.txt
852 z3.txt
853 z10.txt
854 z11.txt
855 z20.txt
856 z100.txt
857 z110.txt
858<
859------------------------------------------------------------------------------
860 *NERDTreeUseTCD*
861Values: 0 or 1.
862Default: 0.
863
864By default, NERDTree will use the `:cd` command to change the current working
865directory. If this setting is turned on, and the `:tcd` command is available, it
866will be used instead.
867
868------------------------------------------------------------------------------
869 *NERDTreeChDirMode*
870Values: 0, 1, 2, or 3.
871Default: 0.
872
873Use this setting to tell the script when (if at all) to change the current
874working directory (CWD) for vim.
875
876If it is set to 0 then the CWD is never changed by the NERDTree.
877
878If set to 1 then the CWD is changed when the NERDTree is first loaded to the
879directory it is initialized in. For example, if you start the NERDTree with >
880 :NERDTree /home/marty/foobar
881<
882then the CWD will be changed to /home/marty/foobar and will not be changed
883again unless you init another NERDTree with a similar command.
884
885If the setting is set to 2 then it behaves the same as if set to 1 except that
886the CWD is changed whenever the tree root is changed. For example, if the CWD
887is /home/marty/foobar and you make the node for /home/marty/foobar/baz the new
888root then the CWD will become /home/marty/foobar/baz.
889
890If the set to 3, then it behaves the same as if set to 2, and the CWD is
891changed whenever changing tabs to whatever the tree root is on that tab.
892
893------------------------------------------------------------------------------
894 *NERDTreeHighlightCursorline*
895Values: 0 or 1.
896Default: 1.
897
898If set to 1, the current cursor line in the NERDTree buffer will be
899highlighted. This is done using the `'cursorline'` Vim option.
900
901------------------------------------------------------------------------------
902 *NERDTreeHijackNetrw*
903Values: 0 or 1.
904Default: 1.
905
906If set to 1, doing a >
907 :edit <some directory>
908<
909will open up a window level NERDTree instead of a netrw in the target window.
910
911Window level trees behaves slightly different from a regular trees in the
912following respects:
913 1. 'o' will open the selected file in the same window as the tree,
914 replacing it.
915 2. you can have one tree per window - instead of per tab.
916
917------------------------------------------------------------------------------
918 *NERDTreeIgnore*
919Values: a list of regular expressions.
920Default: ['\~$'].
921
922This setting is used to specify which files the NERDTree should ignore. It
923must be a list of regular expressions. When the NERDTree is rendered, any
924files/directories that match any of the regex's in NERDTreeIgnore won't be
925displayed.
926
927For example if you put the following line in your vimrc: >
928 let NERDTreeIgnore=['\.vim$', '\~$']
929<
930then all files ending in .vim or ~ will be ignored.
931
932There are 3 magic flags that can be appended to the end of each regular
933expression to specify that the regex should match only filenames, only lowest
934level directories, or a full path. These flags are "[[dir]]", "[[file]]", and
935"[[path]]". Example: >
936 let NERDTreeIgnore=['\.d$[[dir]]', '\.o$[[file]]', 'tmp/cache$[[path]]']
937<
938This will cause all directories ending in ".d" to be ignored, all files ending
939in ".o" to be ignored, and the "cache" subdirectory of any "tmp" directory to
940be ignored. All other "cache" directories will be displayed.
941
942When using the "[[path]]" tag on Windows, make sure you use escaped
943backslashes for the separators in the regex, eg. 'Temp\\cache$[[path]]'
944
945Note: to tell the NERDTree not to ignore any files you must use the following
946line: >
947 let NERDTreeIgnore=[]
948<
949The file filters can be turned on and off dynamically with the |NERDTree-f|
950mapping.
951
952------------------------------------------------------------------------------
953 *NERDTreeRespectWildIgnore*
954Values: 0 or 1.
955Default: 0.
956
957If set to 1, the `'wildignore'` setting is respected.
958
959------------------------------------------------------------------------------
960 *NERDTreeBookmarksFile*
961Values: a path
962Default: $HOME/.NERDTreeBookmarks
963
964This is where bookmarks are saved. See |NERDTreeBookmarkCommands|.
965
966------------------------------------------------------------------------------
967 *NERDTreeBookmarksSort*
968Values: 0, 1, or 2
969Default: 1
970
971This setting controls the method by which the list of user bookmarks is
972sorted. When sorted, bookmarks will render in alphabetical order by name.
973
974If set to 0, the bookmarks list is not sorted.
975If set to 1, the bookmarks list is sorted in a case-insensitive manner.
976If set to 2, the bookmarks list is sorted in a case-sensitive manner.
977
978------------------------------------------------------------------------------
979 *NERDTreeMarkBookmarks*
980Values: 0 or 1
981Default: 1
982
983If set to 1, Bookmarks will be specially marked whenever the NERDTree is
984rendered. Users of the |NERDTreeMinimalUI| setting may prefer to disable
985this setting for even less visual clutter.
986
987------------------------------------------------------------------------------
988 *NERDTreeMouseMode*
989Values: 1, 2 or 3.
990Default: 1.
991
992If set to 1 then a double click on a node is required to open it.
993If set to 2 then a single click will open directory nodes, while a double
994click will still be required for file nodes.
995If set to 3 then a single click will open any node.
996
997Note: a double click anywhere on a line that a tree node is on will
998activate it, but all single-click activations must be done on name of the node
999itself. For example, if you have the following node: >
1000 | | |-application.rb
1001<
1002then (to single click activate it) you must click somewhere in
1003'application.rb'.
1004
1005------------------------------------------------------------------------------
1006 *NERDTreeQuitOnOpen*
1007Values: 0,1,2 or 3.
1008Default: 0
1009
1010This setting governs whether the NERDTree window or the bookmarks table closes
1011after opening a file with the |NERDTree-o|, |NERDTree-i|, |NERDTree-t| and
1012|NERDTree-T| mappings.
1013
1014 Value | NERDTree Window Behavior
1015 -------+-------------------------------------------------------
1016 0 | No change
1017 1 | Closes after opening a file
1018 2 | Closes the bookmark table after opening a bookmark
1019 3(1+2) | Same as both 1 and 2
1020
1021------------------------------------------------------------------------------
1022 *NERDTreeShowBookmarks*
1023Values: 0 or 1.
1024Default: 0.
1025
1026If this setting is set to 1 then the bookmarks table will be displayed.
1027
1028This setting can be toggled dynamically, per tree, with the |NERDTree-B|
1029mapping.
1030
1031------------------------------------------------------------------------------
1032 *NERDTreeShowFiles*
1033Values: 0 or 1.
1034Default: 1.
1035
1036If this setting is set to 1 then files are displayed in the NERDTree. If it
1037is set to 0 then only directories are displayed.
1038
1039This setting can be toggled dynamically, per tree, with the |NERDTree-F|
1040mapping and is useful for drastically shrinking the tree when you are
1041navigating to a different part of the tree.
1042
1043------------------------------------------------------------------------------
1044 *NERDTreeShowHidden*
1045Values: 0 or 1.
1046Default: 0.
1047
1048This setting tells vim whether to display hidden files by default. This
1049setting can be dynamically toggled, per tree, with the |NERDTree-I| mapping.
1050Use one of the follow lines for this setting: >
1051 let NERDTreeShowHidden=0
1052 let NERDTreeShowHidden=1
1053<
1054------------------------------------------------------------------------------
1055 *NERDTreeShowLineNumbers*
1056Values: 0 or 1.
1057Default: 0.
1058
1059This setting tells vim whether to display line numbers for the NERDTree
1060window. Use one of the follow lines for this setting: >
1061 let NERDTreeShowLineNumbers=0
1062 let NERDTreeShowLineNumbers=1
1063<
1064------------------------------------------------------------------------------
1065 *NERDTreeSortOrder*
1066Values: a list of regular expressions.
1067Default: ['\/$', '*', '\.swp$', '\.bak$', '\~$']
1068
1069This setting is a list of regular expressions which are used to group or sort
1070the nodes under their parent.
1071
1072For example, if the setting is: >
1073 ['\.vim$', '\.c$', '\.h$', '*', 'foobar']
1074<
1075then all .vim files will be grouped at the top, followed by all .c files then
1076all .h files. All files containing the string 'foobar' will be placed at the
1077end. The star is a special flag: it tells the script that every node that
1078doesn't match any of the other regexps should be placed here.
1079
1080If no star is present in NERDTreeSortOrder, then one is automatically
1081appended to the end of the list.
1082
1083The regex '\/$' should be used to match directory nodes.
1084
1085Files can also be sorted by 1) the modification timestamp, 2) the size, or 3)
1086the extension. Directories are always sorted by name. To accomplish this, the
1087following special flags are used:
1088 [[timestamp]] [[-timestamp]] [[size]] [[-size]] [[extension]]
1089The hyphen specifies a descending sort; extensions are sorted in ascending
1090order only. If placed at the beginning of the list, files are sorted according
1091to these flags first, and then grouped by the remaining items in the list. If
1092the flags are in any other position of the list, this special sorting is done
1093secondarily. See examples 4, 5, and 6 below.
1094
1095After this sorting is done, the files in each group are sorted alphabetically.
1096
1097Examples: >
1098 (1) ['*', '\/$']
1099 (2) []
1100 (3) ['\/$', '\.rb$', '\.php$', '*', '\.swp$', '\.bak$', '\~$']
1101 (4) ['[[-size]]']
1102 (5) ['\/$', '*', '[[timestamp]]']
1103 (6) ['foo','\/$','[[extension]]']
1104<
11051. Directories will appear last, everything else will appear above.
11062. Everything will simply appear in alphabetical order.
11073. Directories will appear first, then ruby and php. Swap files, bak files
1108 and vim backup files will appear last with everything else preceding them.
11094. Everything is sorted by size, largest to smallest, with directories
1110 considered to have size 0 bytes.
11115. Directories will appear first alphabetically, followed by files, sorted by
1112 timestamp, oldest first.
11136. Files and directories matching 'foo' first, followed by other directories,
1114 then all other files. Each section of files is sorted by file extension.
1115
1116------------------------------------------------------------------------------
1117 *NERDTreeStatusline*
1118Values: Any valid `'statusline'` setting.
1119Default: %{exists('b:NERDTree')?b:NERDTree.root.path.str():''}
1120
1121Defines the value for the `'statusline'` setting in NERDTree windows.
1122
1123Note: The setting is actually applied using |:let-&|, not |:set|, so
1124escaping spaces is not necessary.
1125
1126Setting this to -1 will deactivate it so that your global `'statusline'`
1127setting is used.
1128
1129------------------------------------------------------------------------------
1130 *NERDTreeWinPos*
1131Values: "left" or "right"
1132Default: "left".
1133
1134This setting is used to determine where NERDTree window is placed on the
1135screen.
1136
1137This setting makes it possible to use two different explorer plugins
1138simultaneously. For example, you could have the taglist plugin on the left of
1139the window and the NERDTree on the right.
1140
1141------------------------------------------------------------------------------
1142 *NERDTreeWinSize*
1143Values: a positive integer.
1144Default: 31.
1145
1146This setting is used to change the size of the NERDTree when it is loaded.
1147
1148------------------------------------------------------------------------------
1149 *NERDTreeMinimalUI*
1150Values: 0 or 1
1151Default: 0
1152
1153This setting disables the 'Bookmarks' label 'Press ? for help' text. Use one
1154of the following lines for this setting: >
1155 let NERDTreeMinimalUI=0
1156 let NERDTreeMinimalUI=1
1157<
1158------------------------------------------------------------------------------
1159 *NERDTreeMinimalMenu*
1160Values: 0 or 1
1161Default: 0
1162
1163This setting makes NERDTree use a smaller, more compact menu for adding,
1164copying, deleting nodes. This menu fits on a single line so Vim doesn't need to
1165scroll down to present it. This setting is recommended for users already
1166familiar with the menu items. It will look similar to this:
1167
1168 Menu: [ (a)dd ,m,d,r,o,q,c,l] (Use j/k/enter or shortcut):
1169
1170An action can be selected with its shortcut key or with the NERDTreeMenuUp and
1171NERDTreeMenuDown keys, then pressing enter.
1172
1173Use one of the following lines for this setting: >
1174 let NERDTreeMinimalMenu=0
1175 let NERDTreeMinimalMenu=1
1176<
1177------------------------------------------------------------------------------
1178 *NERDTreeCascadeSingleChildDir*
1179Values: 0 or 1
1180Default: 1.
1181
1182When displaying directory nodes, this setting tells NERDTree to collapse
1183directories that have only one child. Use one of the following lines for this
1184setting: >
1185 let NERDTreeCascadeSingleChildDir=0
1186 let NERDTreeCascadeSingleChildDir=1
1187<
1188------------------------------------------------------------------------------
1189 *NERDTreeCascadeOpenSingleChildDir*
1190Values: 0 or 1
1191Default: 1.
1192
1193When opening directory nodes, this setting tells NERDTree to recursively open
1194directories that have only one child which is also a directory. NERDTree will
1195stop when it finds a directory that contains anything but another single
1196directory. This setting also causes the |NERDTree-x| mapping to close
1197directories in the same manner. This setting may be useful for Java projects.
1198Use one of the following lines for this setting: >
1199 let NERDTreeCascadeOpenSingleChildDir=0
1200 let NERDTreeCascadeOpenSingleChildDir=1
1201<
1202------------------------------------------------------------------------------
1203 *NERDTreeAutoDeleteBuffer*
1204Values: 0 or 1
1205Default: 0.
1206
1207When using a context menu to delete or rename a file you may also want to
1208delete the buffer which is no more valid. If the setting is not set you will
1209see a confirmation if you really want to delete an old buffer. If you always
1210press 'y' then it's worth it to set this setting to 1. Use one of the
1211following lines for this setting: >
1212 let NERDTreeAutoDeleteBuffer=0
1213 let NERDTreeAutoDeleteBuffer=1
1214<
1215------------------------------------------------------------------------------
1216 *NERDTreeCreatePrefix*
1217Values: Any valid command prefix.
1218Default: "silent".
1219
1220Internally, NERDTree uses the |:edit| command to create a buffer in which to
1221display its tree view. You can augment this behavior by specifying a prefix
1222string such as "keepalt" or similar. For example, to have NERDTree create its
1223tree window using `silent keepalt keepjumps edit`: >
1224 let NERDTreeCreatePrefix='silent keepalt keepjumps'
1225<
1226------------------------------------------------------------------------------
1227 *NERDTreeDirArrowCollapsible* *NERDTreeDirArrowExpandable*
1228Values: Any single character.
1229Defaults: Windows: ~ and + Others: â–¾ and â–¸
1230
1231These characters indicate whether a directory is collapsible or expandable.
1232Example: >
1233 let NERDTreeDirArrowExpandable=">"
1234 let NERDTreeDirArrowCollapsible="v"
1235<
1236They can be set to "\u00a0" to replace the arrows with a non-breaking space.
1237If you do this you may need to change the node delimiter. See
1238|NERDTreeNodeDelimiter|. You cannot use the same character for both the arrows
1239and the delimiter.
1240
1241Alternatively, they can be set to '' (an empty string). This removes the
1242arrows and the single space that follows them, shifting the entire tree two
1243character positions to the left.
1244
1245------------------------------------------------------------------------------
1246 *NERDTreeNodeDelimiter*
1247Values: Any single character.
1248Default: varies (see below)
1249
1250This character is used to separate the file or directory name from the rest of
1251the characters in the line of text. It allows filenames to contain special
1252characters that are otherwise used in the NERDTree, such as square brackets,
1253braces, trailing asterisk, and leading space. For more details, see the
1254responsible pull request: https://github.com/preservim/nerdtree/pull/868.
1255
1256The default value of this variable depends on the features compiled into your
1257vim and the values of |NERDTreeDirArrowCollapsible| and
1258|NERDTreeDirArrowExpandable|.
1259 * If your vim is compiled with the +conceal feature, it is the "\x07"
1260 (BEL) character, and it is hidden by setting 'conceallevel' to 2. If you
1261 use autocommands, make sure none of them change that setting in the
1262 NERD_Tree_* buffers.
1263 * If your vim does NOT have the +conceal feature and you're using "\u00a0"
1264 (non-breaking space) to hide the directory arrows, "\u00b7" (middle dot)
1265 is used as the default delimiter.
1266 * If neither condition above applies, NERDTree uses "\u00a0" (non-breaking
1267 space) as the default delimiter.
1268
1269In the 2nd and 3rd cases, NERDTree will use the Ignore highlight group to
1270"hide" the delimiter. It should appear as an empty space.
1271
1272Other plugins can interfere with these defaults, so if you need to change the
1273delimiter, be sure to choose a character that won't appear in your filenames
1274or any of the flags set by your installed NERDTree plugins. The suggestions
1275below are but a few of the many possibilities. Remember to use double quotes
1276when specifying by hex or Unicode. >
1277 let NERDTreeNodeDelimiter="\x07" "bell
1278 let NERDTreeNodeDelimiter="\u00b7" "middle dot
1279 let NERDTreeNodeDelimiter="\u00a0" "non-breaking space
1280 let NERDTreeNodeDelimiter="😀" "smiley face
1281<
1282------------------------------------------------------------------------------
1283 *NERDTreeCustomOpenArgs*
1284Values: A nested dictionary, as described below
1285Default: {'file': {'reuse': 'all', 'where': 'p'}, 'dir': {}}
1286
1287This dictionary contains two keys, 'file' and 'dir', whose values each are
1288another dictionary. The inner dictionary is a set of parameters used by
1289|NERDTree-<CR>| to open a file or directory. Setting these parameters allows you
1290to customize the way the node is opened. The default value matches what
1291|NERDTree-o| does. To change that behavior, use these keys and
1292values in the inner dictionaries:
1293
1294'where': specifies whether the node should be opened in a new split ("h" or
1295 "v"), in a new tab ("t") or, in the last window ("p").
1296'reuse': if file is already shown in a window, jump there; takes values
1297 "all", "currenttab", or empty
1298'keepopen': boolean (0 or 1); if true, the tree window will not be closed
1299'stay': boolean (0 or 1); if true, remain in tree window after opening
1300
1301For example:
1302To open files and directories (creating a new NERDTree) in a new tab, >
1303 {'file':{'where': 't'}, 'dir':{'where':'t'}}
1304<
1305To open a file always in the current tab, and expand directories in place, >
1306 {'file': {'reuse':'currenttab', 'where':'p', 'keepopen':1, 'stay':1}}
1307<
1308==============================================================================
13094. The NERDTree API *NERDTreeAPI*
1310
1311The NERDTree script allows you to add custom key mappings and menu items via
1312a set of API calls. Any scripts that use this API should be placed in
1313~/.vim/nerdtree_plugin/ (*nix) or ~/vimfiles/nerdtree_plugin (windows).
1314
1315The script exposes some prototype objects that can be used to manipulate the
1316tree and/or get information from it: >
1317 g:NERDTreePath
1318 g:NERDTreeDirNode
1319 g:NERDTreeFileNode
1320 g:NERDTreeBookmark
1321<
1322See the code/comments in NERD_tree.vim to find how to use these objects. The
1323following code conventions are used:
1324 * class members start with a capital letter
1325 * instance members start with a lower case letter
1326 * private members start with an underscore
1327
1328See this blog post for more details:
1329 http://got-ravings.blogspot.com/2008/09/vim-pr0n-prototype-based-objects.html
1330
1331A number of API functions take a callback argument to call. The callback can
1332be either a string with the name of a function to call, or a |Funcref| object
1333which will be called directly.
1334
1335------------------------------------------------------------------------------
13364.1. Key map API *NERDTreeKeymapAPI*
1337
1338NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()*
1339 Adds a new keymapping for all NERDTree buffers.
1340 {options} must be a dictionary, and must contain the following keys:
1341 "key" - the trigger key for the new mapping
1342 "callback" - the function the new mapping will be bound to
1343 "quickhelpText" - the text that will appear in the quickhelp (see
1344 |NERDTree-?|)
1345 "override" - if 1 then this new mapping will override whatever previous
1346 mapping was defined for the key/scope combo. Useful for overriding the
1347 default mappings.
1348
1349 Additionally, a "scope" argument may be supplied. This constrains the
1350 mapping so that it is only activated if the cursor is on a certain object.
1351 That object is then passed into the handling method. Possible values are:
1352
1353 "FileNode" .... a file node
1354 "DirNode" ..... a directory node
1355 "Node" ........ a file node OR a directory node
1356 "Bookmark" .... a bookmark
1357 "all" ......... global scope; handler receives no arguments (default)
1358
1359 Example: >
1360 call NERDTreeAddKeyMap({
1361 \ 'key': 'foo',
1362 \ 'callback': 'NERDTreeEchoPathHandler',
1363 \ 'quickhelpText': 'echo full path of current node',
1364 \ 'scope': 'DirNode' })
1365
1366 function! NERDTreeEchoPathHandler(dirnode)
1367 echo a:dirnode.path.str()
1368 endfunction
1369<
1370 This code should sit in a file like ~/.vim/nerdtree_plugin/mymapping.vim.
1371 It adds a (redundant) mapping on 'foo' which changes vim's CWD to that of
1372 the current directory node. Note this mapping will only fire when the
1373 cursor is on a directory node.
1374
1375------------------------------------------------------------------------------
13764.2. Menu API *NERDTreeMenuAPI*
1377
1378NERDTreeAddSubmenu({options}) *NERDTreeAddSubmenu()*
1379 Creates and returns a new submenu.
1380
1381 {options} must be a dictionary and must contain the following keys:
1382 "text" - the text of the submenu that the user will see
1383 "shortcut" - a shortcut key for the submenu (need not be unique)
1384
1385 The following keys are optional:
1386 "isActiveCallback" - a function that will be called to determine whether
1387 this submenu item will be displayed or not. The callback function must
1388 return 0 or 1.
1389 "parent" - the parent submenu of the new submenu (returned from a previous
1390 invocation of NERDTreeAddSubmenu()). If this key is left out then the new
1391 submenu will sit under the top level menu.
1392
1393 See below for an example.
1394
1395NERDTreeAddMenuItem({options}) *NERDTreeAddMenuItem()*
1396 Adds a new menu item to the NERDTree menu (see |NERDTreeMenu|).
1397
1398 {options} must be a dictionary and must contain the
1399 following keys:
1400 "text" - the text of the menu item which the user will see
1401 "shortcut" - a shortcut key for the menu item (need not be unique)
1402 "callback" - the function that will be called when the user activates the
1403 menu item.
1404
1405 The following keys are optional:
1406 "isActiveCallback" - a function that will be called to determine whether
1407 this menu item will be displayed or not. The callback function must return
1408 0 or 1.
1409 "parent" - if the menu item belongs under a submenu then this key must be
1410 specified. This value for this key will be the object that
1411 was returned when the submenu was created with |NERDTreeAddSubmenu()|.
1412
1413 See below for an example.
1414
1415NERDTreeAddMenuSeparator([{options}]) *NERDTreeAddMenuSeparator()*
1416 Adds a menu separator (a row of dashes).
1417
1418 {options} is an optional dictionary that may contain the following keys:
1419 "isActiveCallback" - see description in |NERDTreeAddMenuItem()|.
1420
1421Below is an example of the menu API in action. >
1422 call NERDTreeAddMenuSeparator()
1423
1424 call NERDTreeAddMenuItem({
1425 \ 'text': 'a (t)op level menu item',
1426 \ 'shortcut': 't',
1427 \ 'callback': 'SomeFunction' })
1428
1429 let submenu = NERDTreeAddSubmenu({
1430 \ 'text': 'a (s)ub menu',
1431 \ 'shortcut': 's' })
1432
1433 call NERDTreeAddMenuItem({
1434 \ 'text': '(n)ested item 1',
1435 \ 'shortcut': 'n',
1436 \ 'callback': 'SomeFunction',
1437 \ 'parent': submenu })
1438
1439 call NERDTreeAddMenuItem({
1440 \ 'text': '(n)ested item 2',
1441 \ 'shortcut': 'n',
1442 \ 'callback': 'SomeFunction',
1443 \ 'parent': submenu })
1444<
1445This will create the following menu: >
1446 --------------------
1447 a (t)op level menu item
1448 a (s)ub menu
1449<
1450Where selecting "a (s)ub menu" will lead to a second menu: >
1451 (n)ested item 1
1452 (n)ested item 2
1453<
1454When any of the 3 concrete menu items are selected the function "SomeFunction"
1455will be called.
1456
1457------------------------------------------------------------------------------
14584.3 NERDTreeAddPathFilter(callback) *NERDTreeAddPathFilter()*
1459
1460Path filters are essentially a more powerful version of |NERDTreeIgnore|.
1461If the simple regex matching in |NERDTreeIgnore| is not enough then use
1462|NERDTreeAddPathFilter()| to add a callback function that paths will be
1463checked against when the decision to ignore them is made. Example >
1464
1465 call NERDTreeAddPathFilter('MyFilter')
1466
1467 function! MyFilter(params)
1468 "params is a dict containing keys: 'nerdtree' and 'path' which are
1469 "g:NERDTree and g:NERDTreePath objects
1470
1471 "return 1 to ignore params['path'] or 0 otherwise
1472 endfunction
1473<
1474------------------------------------------------------------------------------
14754.4 Path Listener API *NERDTreePathListenerAPI*
1476
1477Use this API if you want to run a callback for events on Path objects. E.G >
1478
1479 call g:NERDTreePathNotifier.AddListener("init", "MyListener")
1480
1481 "....
1482
1483 function! MyListener(event)
1484 "This function will be called whenever a Path object is created.
1485
1486 "a:event is an object that contains a bunch of relevant info -
1487 "including the affected path. See lib/nerdtree/event.vim for details.
1488 endfunction
1489<
1490Current events supported:
1491 init ~
1492 refresh ~
1493 refreshFlags ~
1494
1495------------------------------------------------------------------------------
1496NERDTreeRender() *NERDTreeRender()*
1497 Re-renders the NERDTree buffer. Useful if you change the state of the
1498 tree and you want to it to be reflected in the UI.
1499
1500==============================================================================
15015. About *NERDTreeAbout*
1502
1503The author of the NERDTree is a terrible terrible monster called Martyzilla
1504who gobbles up small children with milk and sugar for breakfast.
1505
1506He can be reached at martin.grenfell at gmail dot com. He would love to hear
1507from you, so feel free to send him suggestions and/or comments about this
1508plugin. Don't be shy --- the worst he can do is slaughter you and stuff you
1509in the fridge for later ;)
1510
1511Martyzilla recruited two other unwitting accomplices to become his minions in
1512his quest to conquer the Vim plugin world. While he may still love to receive
1513your emails, the best way to send suggestions, bug reports, and questions is
1514to submit an issue at http://github.com/preservim/nerdtree/issues.
1515
1516The latest stable and development versions are on Github.
1517 Stable: http://github.com/preservim/nerdtree (master branch)
1518 Development: http://github.com/preservim/nerdtree/branches
1519
1520Title Credit:
1521 * http://ascii.co.uk/art/tree
1522
1523 * Patrick Gillespie's Text ASCII Art Generator
1524 http://patorjk.com/software/taag
1525 http://patorjk.com/software/taag/#p=display&f=Rozzo&t=the%20NERD%20Tree
1526
1527==============================================================================
15286. License *NERDTreeLicense*
1529
1530The NERDTree is released under the wtfpl.
1531See http://sam.zoy.org/wtfpl/COPYING.
1532
1533------------------------------------------------------------------------------
1534 vim:tw=78:ts=8:ft=help:noet:nospell
diff --git a/.vim/pack/vendor/start/nerdtree/doc/tags b/.vim/pack/vendor/start/nerdtree/doc/tags
new file mode 100644
index 0000000..c1135b2
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/doc/tags
@@ -0,0 +1,143 @@
1:NERDTree NERDTree.txt /*:NERDTree*
2:NERDTreeCWD NERDTree.txt /*:NERDTreeCWD*
3:NERDTreeClose NERDTree.txt /*:NERDTreeClose*
4:NERDTreeFind NERDTree.txt /*:NERDTreeFind*
5:NERDTreeFocus NERDTree.txt /*:NERDTreeFocus*
6:NERDTreeFromBookmark NERDTree.txt /*:NERDTreeFromBookmark*
7:NERDTreeMirror NERDTree.txt /*:NERDTreeMirror*
8:NERDTreeRefreshRoot NERDTree.txt /*:NERDTreeRefreshRoot*
9:NERDTreeToggle NERDTree.txt /*:NERDTreeToggle*
10:NERDTreeToggleVCS NERDTree.txt /*:NERDTreeToggleVCS*
11:NERDTreeVCS NERDTree.txt /*:NERDTreeVCS*
12NERDTree NERDTree.txt /*NERDTree*
13NERDTree-<CR> NERDTree.txt /*NERDTree-<CR>*
14NERDTree-? NERDTree.txt /*NERDTree-?*
15NERDTree-A NERDTree.txt /*NERDTree-A*
16NERDTree-B NERDTree.txt /*NERDTree-B*
17NERDTree-C NERDTree.txt /*NERDTree-C*
18NERDTree-C-J NERDTree.txt /*NERDTree-C-J*
19NERDTree-C-K NERDTree.txt /*NERDTree-C-K*
20NERDTree-CD NERDTree.txt /*NERDTree-CD*
21NERDTree-D NERDTree.txt /*NERDTree-D*
22NERDTree-F NERDTree.txt /*NERDTree-F*
23NERDTree-I NERDTree.txt /*NERDTree-I*
24NERDTree-J NERDTree.txt /*NERDTree-J*
25NERDTree-K NERDTree.txt /*NERDTree-K*
26NERDTree-O NERDTree.txt /*NERDTree-O*
27NERDTree-P NERDTree.txt /*NERDTree-P*
28NERDTree-R NERDTree.txt /*NERDTree-R*
29NERDTree-T NERDTree.txt /*NERDTree-T*
30NERDTree-U NERDTree.txt /*NERDTree-U*
31NERDTree-X NERDTree.txt /*NERDTree-X*
32NERDTree-cd NERDTree.txt /*NERDTree-cd*
33NERDTree-contents NERDTree.txt /*NERDTree-contents*
34NERDTree-e NERDTree.txt /*NERDTree-e*
35NERDTree-f NERDTree.txt /*NERDTree-f*
36NERDTree-gi NERDTree.txt /*NERDTree-gi*
37NERDTree-go NERDTree.txt /*NERDTree-go*
38NERDTree-gs NERDTree.txt /*NERDTree-gs*
39NERDTree-i NERDTree.txt /*NERDTree-i*
40NERDTree-m NERDTree.txt /*NERDTree-m*
41NERDTree-o NERDTree.txt /*NERDTree-o*
42NERDTree-p NERDTree.txt /*NERDTree-p*
43NERDTree-q NERDTree.txt /*NERDTree-q*
44NERDTree-r NERDTree.txt /*NERDTree-r*
45NERDTree-s NERDTree.txt /*NERDTree-s*
46NERDTree-t NERDTree.txt /*NERDTree-t*
47NERDTree-u NERDTree.txt /*NERDTree-u*
48NERDTree-x NERDTree.txt /*NERDTree-x*
49NERDTree.txt NERDTree.txt /*NERDTree.txt*
50NERDTreeAPI NERDTree.txt /*NERDTreeAPI*
51NERDTreeAbout NERDTree.txt /*NERDTreeAbout*
52NERDTreeAddKeyMap() NERDTree.txt /*NERDTreeAddKeyMap()*
53NERDTreeAddMenuItem() NERDTree.txt /*NERDTreeAddMenuItem()*
54NERDTreeAddMenuSeparator() NERDTree.txt /*NERDTreeAddMenuSeparator()*
55NERDTreeAddPathFilter() NERDTree.txt /*NERDTreeAddPathFilter()*
56NERDTreeAddSubmenu() NERDTree.txt /*NERDTreeAddSubmenu()*
57NERDTreeAutoCenter NERDTree.txt /*NERDTreeAutoCenter*
58NERDTreeAutoCenterThreshold NERDTree.txt /*NERDTreeAutoCenterThreshold*
59NERDTreeAutoDeleteBuffer NERDTree.txt /*NERDTreeAutoDeleteBuffer*
60NERDTreeBookmarkCommands NERDTree.txt /*NERDTreeBookmarkCommands*
61NERDTreeBookmarkTable NERDTree.txt /*NERDTreeBookmarkTable*
62NERDTreeBookmarks NERDTree.txt /*NERDTreeBookmarks*
63NERDTreeBookmarksFile NERDTree.txt /*NERDTreeBookmarksFile*
64NERDTreeBookmarksSort NERDTree.txt /*NERDTreeBookmarksSort*
65NERDTreeCascadeOpenSingleChildDir NERDTree.txt /*NERDTreeCascadeOpenSingleChildDir*
66NERDTreeCascadeSingleChildDir NERDTree.txt /*NERDTreeCascadeSingleChildDir*
67NERDTreeCaseSensitiveSort NERDTree.txt /*NERDTreeCaseSensitiveSort*
68NERDTreeChDirMode NERDTree.txt /*NERDTreeChDirMode*
69NERDTreeCreatePrefix NERDTree.txt /*NERDTreeCreatePrefix*
70NERDTreeCustomOpenArgs NERDTree.txt /*NERDTreeCustomOpenArgs*
71NERDTreeDirArrowCollapsible NERDTree.txt /*NERDTreeDirArrowCollapsible*
72NERDTreeDirArrowExpandable NERDTree.txt /*NERDTreeDirArrowExpandable*
73NERDTreeFunctionality NERDTree.txt /*NERDTreeFunctionality*
74NERDTreeGlobalCommands NERDTree.txt /*NERDTreeGlobalCommands*
75NERDTreeHighlightCursorline NERDTree.txt /*NERDTreeHighlightCursorline*
76NERDTreeHijackNetrw NERDTree.txt /*NERDTreeHijackNetrw*
77NERDTreeIgnore NERDTree.txt /*NERDTreeIgnore*
78NERDTreeInvalidBookmarks NERDTree.txt /*NERDTreeInvalidBookmarks*
79NERDTreeKeymapAPI NERDTree.txt /*NERDTreeKeymapAPI*
80NERDTreeLicense NERDTree.txt /*NERDTreeLicense*
81NERDTreeMapCWD NERDTree.txt /*NERDTreeMapCWD*
82NERDTreeMapChangeRoot NERDTree.txt /*NERDTreeMapChangeRoot*
83NERDTreeMapChdir NERDTree.txt /*NERDTreeMapChdir*
84NERDTreeMapCloseChildren NERDTree.txt /*NERDTreeMapCloseChildren*
85NERDTreeMapCloseDir NERDTree.txt /*NERDTreeMapCloseDir*
86NERDTreeMapCustomOpen NERDTree.txt /*NERDTreeMapCustomOpen*
87NERDTreeMapDeleteBookmark NERDTree.txt /*NERDTreeMapDeleteBookmark*
88NERDTreeMapHelp NERDTree.txt /*NERDTreeMapHelp*
89NERDTreeMapJumpFirstChild NERDTree.txt /*NERDTreeMapJumpFirstChild*
90NERDTreeMapJumpLastChild NERDTree.txt /*NERDTreeMapJumpLastChild*
91NERDTreeMapJumpNextSibling NERDTree.txt /*NERDTreeMapJumpNextSibling*
92NERDTreeMapJumpParent NERDTree.txt /*NERDTreeMapJumpParent*
93NERDTreeMapJumpPrevSibling NERDTree.txt /*NERDTreeMapJumpPrevSibling*
94NERDTreeMapJumpRoot NERDTree.txt /*NERDTreeMapJumpRoot*
95NERDTreeMapMenu NERDTree.txt /*NERDTreeMapMenu*
96NERDTreeMapOpenExpl NERDTree.txt /*NERDTreeMapOpenExpl*
97NERDTreeMapOpenInTab NERDTree.txt /*NERDTreeMapOpenInTab*
98NERDTreeMapOpenInTabSilent NERDTree.txt /*NERDTreeMapOpenInTabSilent*
99NERDTreeMapOpenRecursively NERDTree.txt /*NERDTreeMapOpenRecursively*
100NERDTreeMapOpenSplit NERDTree.txt /*NERDTreeMapOpenSplit*
101NERDTreeMapOpenVSplit NERDTree.txt /*NERDTreeMapOpenVSplit*
102NERDTreeMapPreviewSplit NERDTree.txt /*NERDTreeMapPreviewSplit*
103NERDTreeMapPreviewVSplit NERDTree.txt /*NERDTreeMapPreviewVSplit*
104NERDTreeMapQuit NERDTree.txt /*NERDTreeMapQuit*
105NERDTreeMapRefresh NERDTree.txt /*NERDTreeMapRefresh*
106NERDTreeMapRefreshRoot NERDTree.txt /*NERDTreeMapRefreshRoot*
107NERDTreeMapToggleBookmarks NERDTree.txt /*NERDTreeMapToggleBookmarks*
108NERDTreeMapToggleFiles NERDTree.txt /*NERDTreeMapToggleFiles*
109NERDTreeMapToggleFilters NERDTree.txt /*NERDTreeMapToggleFilters*
110NERDTreeMapToggleHidden NERDTree.txt /*NERDTreeMapToggleHidden*
111NERDTreeMapToggleZoom NERDTree.txt /*NERDTreeMapToggleZoom*
112NERDTreeMapUpdir NERDTree.txt /*NERDTreeMapUpdir*
113NERDTreeMapUpdirKeepOpen NERDTree.txt /*NERDTreeMapUpdirKeepOpen*
114NERDTreeMappings NERDTree.txt /*NERDTreeMappings*
115NERDTreeMarkBookmarks NERDTree.txt /*NERDTreeMarkBookmarks*
116NERDTreeMenu NERDTree.txt /*NERDTreeMenu*
117NERDTreeMenu-j NERDTree.txt /*NERDTreeMenu-j*
118NERDTreeMenu-k NERDTree.txt /*NERDTreeMenu-k*
119NERDTreeMenuAPI NERDTree.txt /*NERDTreeMenuAPI*
120NERDTreeMenuDown NERDTree.txt /*NERDTreeMenuDown*
121NERDTreeMenuUp NERDTree.txt /*NERDTreeMenuUp*
122NERDTreeMinimalMenu NERDTree.txt /*NERDTreeMinimalMenu*
123NERDTreeMinimalUI NERDTree.txt /*NERDTreeMinimalUI*
124NERDTreeMouseMode NERDTree.txt /*NERDTreeMouseMode*
125NERDTreeNaturalSort NERDTree.txt /*NERDTreeNaturalSort*
126NERDTreeNodeDelimiter NERDTree.txt /*NERDTreeNodeDelimiter*
127NERDTreePathListenerAPI NERDTree.txt /*NERDTreePathListenerAPI*
128NERDTreeQuitOnOpen NERDTree.txt /*NERDTreeQuitOnOpen*
129NERDTreeRender() NERDTree.txt /*NERDTreeRender()*
130NERDTreeRespectWildIgnore NERDTree.txt /*NERDTreeRespectWildIgnore*
131NERDTreeSettings NERDTree.txt /*NERDTreeSettings*
132NERDTreeSettingsDetails NERDTree.txt /*NERDTreeSettingsDetails*
133NERDTreeSettingsSummary NERDTree.txt /*NERDTreeSettingsSummary*
134NERDTreeShowBookmarks NERDTree.txt /*NERDTreeShowBookmarks*
135NERDTreeShowFiles NERDTree.txt /*NERDTreeShowFiles*
136NERDTreeShowHidden NERDTree.txt /*NERDTreeShowHidden*
137NERDTreeShowLineNumbers NERDTree.txt /*NERDTreeShowLineNumbers*
138NERDTreeSortOrder NERDTree.txt /*NERDTreeSortOrder*
139NERDTreeStatusline NERDTree.txt /*NERDTreeStatusline*
140NERDTreeUseTCD NERDTree.txt /*NERDTreeUseTCD*
141NERDTreeWinPos NERDTree.txt /*NERDTreeWinPos*
142NERDTreeWinSize NERDTree.txt /*NERDTreeWinSize*
143loaded_nerd_tree NERDTree.txt /*loaded_nerd_tree*
diff --git a/.vim/pack/vendor/start/nerdtree/lib/nerdtree/bookmark.vim b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/bookmark.vim
new file mode 100644
index 0000000..37be451
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/bookmark.vim
@@ -0,0 +1,365 @@
1" ============================================================================
2" CLASS: Bookmark
3"
4" The Bookmark class serves two purposes:
5" (1) It is the top-level prototype for new, concrete Bookmark objects.
6" (2) It provides an interface for client code to query and manipulate the
7" global list of Bookmark objects within the current Vim session.
8" ============================================================================
9
10
11let s:Bookmark = {}
12let g:NERDTreeBookmark = s:Bookmark
13
14" FUNCTION: Bookmark.activate(nerdtree) {{{1
15function! s:Bookmark.activate(nerdtree, ...)
16 call self.open(a:nerdtree, a:0 ? a:1 : {})
17endfunction
18
19" FUNCTION: Bookmark.AddBookmark(name, path) {{{1
20" Class method to add a new bookmark to the list, if a previous bookmark exists
21" with the same name, just update the path for that bookmark
22function! s:Bookmark.AddBookmark(name, path)
23 for i in s:Bookmark.Bookmarks()
24 if i.name ==# a:name
25 let i.path = a:path
26 return
27 endif
28 endfor
29 call add(s:Bookmark.Bookmarks(), s:Bookmark.New(a:name, a:path))
30endfunction
31
32" FUNCTION: Bookmark.Bookmarks() {{{1
33" Class method to get all bookmarks. Lazily initializes the bookmarks global
34" variable
35function! s:Bookmark.Bookmarks()
36 if !exists('g:NERDTreeBookmarks')
37 let g:NERDTreeBookmarks = []
38 endif
39 return g:NERDTreeBookmarks
40endfunction
41
42" FUNCTION: Bookmark.BookmarkExistsFor(name) {{{1
43" class method that returns 1 if a bookmark with the given name is found, 0
44" otherwise
45function! s:Bookmark.BookmarkExistsFor(name)
46 try
47 call s:Bookmark.BookmarkFor(a:name)
48 return 1
49 catch /^NERDTree.BookmarkNotFoundError/
50 return 0
51 endtry
52endfunction
53
54" FUNCTION: Bookmark.BookmarkFor(name) {{{1
55" Class method that returns the Bookmark object having the specified name.
56" Throws NERDTree.BookmarkNotFoundError if no Bookmark is found.
57function! s:Bookmark.BookmarkFor(name)
58 let l:result = {}
59 for l:bookmark in s:Bookmark.Bookmarks()
60 if l:bookmark.name ==# a:name
61 let l:result = l:bookmark
62 break
63 endif
64 endfor
65 if empty(l:result)
66 throw 'NERDTree.BookmarkNotFoundError: "' . a:name . '" not found'
67 endif
68 return l:result
69endfunction
70
71" FUNCTION: Bookmark.BookmarkNames() {{{1
72" Class method to return an array of all bookmark names
73function! s:Bookmark.BookmarkNames()
74 let names = []
75 for i in s:Bookmark.Bookmarks()
76 call add(names, i.name)
77 endfor
78 return names
79endfunction
80
81" FUNCTION: Bookmark.CacheBookmarks(silent) {{{1
82" Class method to read all bookmarks from the bookmarks file initialize
83" bookmark objects for each one.
84"
85" Args:
86" silent - dont echo an error msg if invalid bookmarks are found
87function! s:Bookmark.CacheBookmarks(silent)
88 if filereadable(g:NERDTreeBookmarksFile)
89 let g:NERDTreeBookmarks = []
90 let g:NERDTreeInvalidBookmarks = []
91 let bookmarkStrings = readfile(g:NERDTreeBookmarksFile)
92 let invalidBookmarksFound = 0
93 for i in bookmarkStrings
94
95 "ignore blank lines
96 if i !=# ''
97
98 let name = substitute(i, '^\(.\{-}\) .*$', '\1', '')
99 let path = substitute(i, '^.\{-} \(.*\)$', '\1', '')
100 let path = fnamemodify(path, ':p')
101
102 try
103 let bookmark = s:Bookmark.New(name, g:NERDTreePath.New(path))
104 call add(g:NERDTreeBookmarks, bookmark)
105 catch /^NERDTree.InvalidArgumentsError/
106 call add(g:NERDTreeInvalidBookmarks, i)
107 let invalidBookmarksFound += 1
108 endtry
109 endif
110 endfor
111 if invalidBookmarksFound
112 call s:Bookmark.Write()
113 if !a:silent
114 call nerdtree#echo(invalidBookmarksFound . ' invalid bookmarks were read. See :help NERDTreeInvalidBookmarks for info.')
115 endif
116 endif
117 endif
118endfunction
119
120" FUNCTION: Bookmark.CompareBookmarksByName(firstBookmark, secondBookmark) {{{1
121" Class method that indicates the relative position of two bookmarks when
122" placed in alphabetical order by name. Case-sensitivity is determined by an
123" option. Supports the s:Bookmark.SortBookmarksList() method.
124function! s:Bookmark.CompareBookmarksByName(firstBookmark, secondBookmark)
125 let l:result = 0
126 if g:NERDTreeBookmarksSort ==# 1
127 if a:firstBookmark.name <? a:secondBookmark.name
128 let l:result = -1
129 elseif a:firstBookmark.name >? a:secondBookmark.name
130 let l:result = 1
131 endif
132 elseif g:NERDTreeBookmarksSort ==# 2
133 if a:firstBookmark.name <# a:secondBookmark.name
134 let l:result = -1
135 elseif a:firstBookmark.name ># a:secondBookmark.name
136 let l:result = 1
137 endif
138 endif
139 return l:result
140endfunction
141
142" FUNCTION: Bookmark.ClearAll() {{{1
143" Class method to delete all bookmarks.
144function! s:Bookmark.ClearAll()
145 for i in s:Bookmark.Bookmarks()
146 call i.delete()
147 endfor
148 call s:Bookmark.Write()
149endfunction
150
151" FUNCTION: Bookmark.delete() {{{1
152" Delete this bookmark. If the node for this bookmark is under the current
153" root, then recache bookmarks for its Path object
154function! s:Bookmark.delete()
155 call remove(s:Bookmark.Bookmarks(), index(s:Bookmark.Bookmarks(), self))
156 call s:Bookmark.Write()
157endfunction
158
159" FUNCTION: s:Edit() {{{1
160" opens the NERDTreeBookmarks file for manual editing
161function! s:Bookmark.Edit()
162 call nerdtree#exec('wincmd w', 1)
163 call nerdtree#exec('edit '.g:NERDTreeBookmarksFile, 1)
164endfunction
165
166" FUNCTION: Bookmark.getNode(nerdtree, searchFromAbsoluteRoot) {{{1
167" Returns the tree node object associated with this Bookmark.
168" Throws NERDTree.BookmarkedNodeNotFoundError if the node is not found.
169"
170" Args:
171" searchFromAbsoluteRoot: boolean flag, search from the highest cached node
172" if true and from the current tree root if false
173function! s:Bookmark.getNode(nerdtree, searchFromAbsoluteRoot)
174 if a:searchFromAbsoluteRoot
175 let l:searchRoot = a:nerdtree.root.AbsoluteTreeRoot()
176 else
177 let l:searchRoot = a:nerdtree.root
178 endif
179 let l:targetNode = l:searchRoot.findNode(self.path)
180 if empty(l:targetNode)
181 throw 'NERDTree.BookmarkedNodeNotFoundError: node for bookmark "' . self.name . '" not found'
182 endif
183 return l:targetNode
184endfunction
185
186" FUNCTION: Bookmark.GetNodeForName(name, searchFromAbsoluteRoot, nerdtree) {{{1
187" Class method that returns the tree node object for the Bookmark with the
188" given name. Throws NERDTree.BookmarkNotFoundError if a Bookmark with the
189" name does not exist. Throws NERDTree.BookmarkedNodeNotFoundError if a
190" tree node for the named Bookmark could not be found.
191function! s:Bookmark.GetNodeForName(name, searchFromAbsoluteRoot, nerdtree)
192 let l:bookmark = s:Bookmark.BookmarkFor(a:name)
193 return l:bookmark.getNode(a:nerdtree, a:searchFromAbsoluteRoot)
194endfunction
195
196" FUNCTION: Bookmark.GetSelected() {{{1
197" returns the Bookmark the cursor is over, or {}
198function! s:Bookmark.GetSelected()
199 let line = getline('.')
200 let name = substitute(line, '^>\(.\{-}\) .\+$', '\1', '')
201 if name !=# line
202 try
203 return s:Bookmark.BookmarkFor(name)
204 catch /^NERDTree.BookmarkNotFoundError/
205 return {}
206 endtry
207 endif
208 return {}
209endfunction
210
211" FUNCTION: Bookmark.InvalidBookmarks() {{{1
212" Class method to get all invalid bookmark strings read from the bookmarks
213" file
214function! s:Bookmark.InvalidBookmarks()
215 if !exists('g:NERDTreeInvalidBookmarks')
216 let g:NERDTreeInvalidBookmarks = []
217 endif
218 return g:NERDTreeInvalidBookmarks
219endfunction
220
221" FUNCTION: Bookmark.mustExist() {{{1
222function! s:Bookmark.mustExist()
223 if !self.path.exists()
224 call s:Bookmark.CacheBookmarks(1)
225 throw 'NERDTree.BookmarkPointsToInvalidLocationError: the bookmark "'.
226 \ self.name .'" points to a non existing location: "'. self.path.str()
227 endif
228endfunction
229
230" FUNCTION: Bookmark.New(name, path) {{{1
231" Create a new bookmark object with the given name and path object
232function! s:Bookmark.New(name, path)
233 if a:name =~# ' '
234 throw 'NERDTree.IllegalBookmarkNameError: illegal name:' . a:name
235 endif
236
237 let newBookmark = copy(self)
238 let newBookmark.name = a:name
239 let newBookmark.path = a:path
240 return newBookmark
241endfunction
242
243" FUNCTION: Bookmark.open(nerdtree, [options]) {{{1
244"Args:
245"
246"nerdtree: the tree to load open the bookmark in
247"
248"A dictionary containing the following keys (all optional):
249" 'where': Specifies whether the node should be opened in new split/tab or in
250" the previous window. Can be either 'v' (vertical split), 'h'
251" (horizontal split), 't' (new tab) or 'p' (previous window).
252" 'reuse': if a window is displaying the file then jump the cursor there
253" 'keepopen': dont close the tree window
254" 'stay': open the file, but keep the cursor in the tree win
255"
256function! s:Bookmark.open(nerdtree, ...)
257 let opts = a:0 ? a:1 : {}
258
259 if nerdtree#closeBookmarksOnOpen()
260 call a:nerdtree.ui.toggleShowBookmarks()
261 endif
262
263 if self.path.isDirectory && !has_key(opts, 'where')
264 call self.toRoot(a:nerdtree)
265 else
266 let opener = g:NERDTreeOpener.New(self.path, opts)
267 call opener.open(self)
268 endif
269endfunction
270
271" FUNCTION: Bookmark.openInNewTab(options) {{{1
272" Create a new bookmark object with the given name and path object
273function! s:Bookmark.openInNewTab(options)
274 call nerdtree#deprecated('Bookmark.openInNewTab', 'is deprecated, use open() instead')
275 call self.open(a:options)
276endfunction
277
278" FUNCTION: Bookmark.setPath(path) {{{1
279" makes this bookmark point to the given path
280function! s:Bookmark.setPath(path)
281 let self.path = a:path
282endfunction
283
284" FUNCTION: Bookmark.SortBookmarksList() {{{1
285" Class method that sorts the global list of bookmarks alphabetically by name.
286" Note that case-sensitivity is determined by a user option.
287function! s:Bookmark.SortBookmarksList()
288 call sort(s:Bookmark.Bookmarks(), s:Bookmark.CompareBookmarksByName, s:Bookmark)
289endfunction
290
291" FUNCTION: Bookmark.str() {{{1
292" Get the string that should be rendered in the view for this bookmark
293function! s:Bookmark.str()
294 let pathStrMaxLen = winwidth(g:NERDTree.GetWinNum()) - 4 - strdisplaywidth(self.name)
295 if &number
296 let pathStrMaxLen = pathStrMaxLen - &numberwidth
297 endif
298
299 let pathStr = self.path.str({'format': 'UI'})
300 if strdisplaywidth(pathStr) > pathStrMaxLen
301 while strdisplaywidth(pathStr) > pathStrMaxLen && strchars(pathStr) > 0
302 let pathStr = substitute(pathStr, '^.', '', '')
303 endwhile
304 let pathStr = '<' . pathStr
305 endif
306 return '>' . self.name . ' ' . pathStr
307endfunction
308
309" FUNCTION: Bookmark.toRoot(nerdtree) {{{1
310" Set the root of the given NERDTree to the node for this Bookmark. If a node
311" for this Bookmark does not exist, a new one is initialized.
312function! s:Bookmark.toRoot(nerdtree)
313 if self.validate()
314 try
315 let l:targetNode = self.getNode(a:nerdtree, 1)
316 call l:targetNode.closeChildren()
317 catch /^NERDTree.BookmarkedNodeNotFoundError/
318 let l:targetNode = g:NERDTreeFileNode.New(s:Bookmark.BookmarkFor(self.name).path, a:nerdtree)
319 endtry
320 call a:nerdtree.changeRoot(l:targetNode)
321 endif
322endfunction
323
324" FUNCTION: Bookmark.ToRoot(name, nerdtree) {{{1
325" Class method that makes the Bookmark with the given name the root of
326" specified NERDTree.
327function! s:Bookmark.ToRoot(name, nerdtree)
328 let l:bookmark = s:Bookmark.BookmarkFor(a:name)
329 call l:bookmark.toRoot(a:nerdtree)
330endfunction
331
332" FUNCTION: Bookmark.validate() {{{1
333function! s:Bookmark.validate()
334 if self.path.exists()
335 return 1
336 else
337 call s:Bookmark.CacheBookmarks(1)
338 call nerdtree#echo(self.name . 'now points to an invalid location. See :help NERDTreeInvalidBookmarks for info.')
339 return 0
340 endif
341endfunction
342
343" FUNCTION: Bookmark.Write() {{{1
344" Class method to write all bookmarks to the bookmarks file
345function! s:Bookmark.Write()
346 let bookmarkStrings = []
347 for i in s:Bookmark.Bookmarks()
348 call add(bookmarkStrings, i.name . ' ' . fnamemodify(i.path.str(), ':~'))
349 endfor
350
351 "add a blank line before the invalid ones
352 call add(bookmarkStrings, '')
353
354 for j in s:Bookmark.InvalidBookmarks()
355 call add(bookmarkStrings, j)
356 endfor
357
358 try
359 call writefile(bookmarkStrings, g:NERDTreeBookmarksFile)
360 catch
361 call nerdtree#echoError('Failed to write bookmarks file. Make sure g:NERDTreeBookmarksFile points to a valid location.')
362 endtry
363endfunction
364
365" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/.vim/pack/vendor/start/nerdtree/lib/nerdtree/creator.vim b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/creator.vim
new file mode 100644
index 0000000..b9d45dc
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/creator.vim
@@ -0,0 +1,402 @@
1" ============================================================================
2" CLASS: Creator
3"
4" This class is responsible for creating NERDTree instances. The new NERDTree
5" may be a tab tree, a window tree, or a mirrored tree. In the process of
6" creating a NERDTree, it sets up all of the window and buffer options and key
7" mappings etc.
8" ============================================================================
9
10
11let s:Creator = {}
12let g:NERDTreeCreator = s:Creator
13
14" FUNCTION: s:Creator._bindMappings() {{{1
15function! s:Creator._bindMappings()
16 call g:NERDTreeKeyMap.BindAll()
17
18 command! -buffer -nargs=? Bookmark :call nerdtree#ui_glue#bookmarkNode('<args>')
19 command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 RevealBookmark :call nerdtree#ui_glue#revealBookmark('<args>')
20 command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 OpenBookmark call nerdtree#ui_glue#openBookmark('<args>')
21 command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=* ClearBookmarks call nerdtree#ui_glue#clearBookmarks('<args>')
22 command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=+ BookmarkToRoot call g:NERDTreeBookmark.ToRoot('<args>', b:NERDTree)
23 command! -buffer -nargs=0 ClearAllBookmarks call g:NERDTreeBookmark.ClearAll() <bar> call b:NERDTree.render()
24 command! -buffer -nargs=0 ReadBookmarks call g:NERDTreeBookmark.CacheBookmarks(0) <bar> call b:NERDTree.render()
25 command! -buffer -nargs=0 WriteBookmarks call g:NERDTreeBookmark.Write()
26 command! -buffer -nargs=0 EditBookmarks call g:NERDTreeBookmark.Edit()
27endfunction
28
29" FUNCTION: s:Creator._broadcastInitEvent() {{{1
30function! s:Creator._broadcastInitEvent()
31 if exists('#User#NERDTreeInit')
32 doautocmd User NERDTreeInit
33 endif
34endfunction
35
36" FUNCTION: s:Creator.BufNamePrefix() {{{1
37function! s:Creator.BufNamePrefix()
38 return 'NERD_tree_'
39endfunction
40
41" FUNCTION: s:Creator.CreateTabTree(a:name) {{{1
42function! s:Creator.CreateTabTree(name)
43 let creator = s:Creator.New()
44 call creator.createTabTree(a:name)
45endfunction
46
47" FUNCTION: s:Creator.createTabTree(a:name) {{{1
48" name: the name of a bookmark or a directory
49function! s:Creator.createTabTree(name)
50 let l:path = self._pathForString(a:name)
51
52 " Abort if an exception was thrown (i.e., if the bookmark or directory
53 " does not exist).
54 if empty(l:path)
55 return
56 endif
57
58 " Obey the user's preferences for changing the working directory.
59 if g:NERDTreeChDirMode != 0
60 call l:path.changeToDir()
61 endif
62
63 if g:NERDTree.ExistsForTab()
64 call g:NERDTree.Close()
65 call self._removeTreeBufForTab()
66 endif
67
68 call self._createTreeWin()
69 call self._createNERDTree(l:path, 'tab')
70 call b:NERDTree.render()
71 call b:NERDTree.root.putCursorHere(0, 0)
72
73 call self._broadcastInitEvent()
74endfunction
75
76" FUNCTION: s:Creator.CreateWindowTree(dir) {{{1
77function! s:Creator.CreateWindowTree(dir)
78 let creator = s:Creator.New()
79 call creator.createWindowTree(a:dir)
80endfunction
81
82" FUNCTION: s:Creator.createWindowTree(dir) {{{1
83function! s:Creator.createWindowTree(dir)
84 try
85 let path = g:NERDTreePath.New(a:dir)
86 catch /^NERDTree.InvalidArgumentsError/
87 call nerdtree#echo('Invalid directory name:' . a:dir)
88 return
89 endtry
90
91 "we want the directory buffer to disappear when we do the :edit below
92 setlocal bufhidden=wipe
93
94 let previousBuf = expand('#')
95
96 "we need a unique name for each window tree buffer to ensure they are
97 "all independent
98 exec g:NERDTreeCreatePrefix . ' edit ' . self._nextBufferName()
99
100 call self._createNERDTree(path, 'window')
101 let b:NERDTree._previousBuf = bufnr(previousBuf)
102 call self._setCommonBufOptions()
103
104 call b:NERDTree.render()
105
106 call self._broadcastInitEvent()
107endfunction
108
109" FUNCTION: s:Creator._createNERDTree(path) {{{1
110function! s:Creator._createNERDTree(path, type)
111 let b:NERDTree = g:NERDTree.New(a:path, a:type)
112
113 " TODO: This assignment is kept for compatibility reasons. Many other
114 " plugins use b:NERDTreeRoot instead of b:NERDTree.root. Remove this
115 " assignment in the future.
116 let b:NERDTreeRoot = b:NERDTree.root
117
118 call b:NERDTree.root.open()
119endfunction
120
121" FUNCTION: s:Creator.CreateMirror() {{{1
122function! s:Creator.CreateMirror()
123 let creator = s:Creator.New()
124 call creator.createMirror()
125endfunction
126
127" FUNCTION: s:Creator.createMirror() {{{1
128function! s:Creator.createMirror()
129 "get the names off all the nerd tree buffers
130 let treeBufNames = []
131 for i in range(1, tabpagenr('$'))
132 let nextName = self._tabpagevar(i, 'NERDTreeBufName')
133 if nextName != -1 && (!exists('t:NERDTreeBufName') || nextName != t:NERDTreeBufName)
134 call add(treeBufNames, nextName)
135 endif
136 endfor
137 let treeBufNames = self._uniq(treeBufNames)
138
139 "map the option names (that the user will be prompted with) to the nerd
140 "tree buffer names
141 let options = {}
142 let i = 0
143 while i < len(treeBufNames)
144 let bufName = treeBufNames[i]
145 let treeRoot = getbufvar(bufName, 'NERDTree').root
146 let options[i+1 . '. ' . treeRoot.path.str() . ' (buf name: ' . bufName . ')'] = bufName
147 let i = i + 1
148 endwhile
149
150 "work out which tree to mirror, if there is more than 1 then ask the user
151 let bufferName = ''
152 if len(keys(options)) > 1
153 let choices = ['Choose a tree to mirror']
154 let choices = extend(choices, sort(keys(options)))
155 let choice = inputlist(choices)
156 if choice < 1 || choice > len(options) || choice ==# ''
157 return
158 endif
159
160 let bufferName = options[sort(keys(options))[choice-1]]
161 elseif len(keys(options)) ==# 1
162 let bufferName = values(options)[0]
163 else
164 call nerdtree#echo('No trees to mirror')
165 return
166 endif
167
168 if g:NERDTree.ExistsForTab() && g:NERDTree.IsOpen()
169 call g:NERDTree.Close()
170 endif
171
172 let t:NERDTreeBufName = bufferName
173 call self._createTreeWin()
174 exec 'buffer ' . bufferName
175 call b:NERDTree.ui.restoreScreenState()
176 if !&hidden
177 call b:NERDTree.render()
178 endif
179endfunction
180
181" FUNCTION: s:Creator._createTreeWin() {{{1
182" Initialize the NERDTree window. Open the window, size it properly, set all
183" local options, etc.
184function! s:Creator._createTreeWin()
185 let l:splitLocation = g:NERDTreeWinPos ==# 'left' ? 'topleft ' : 'botright '
186 let l:splitSize = g:NERDTreeWinSize
187
188 if !g:NERDTree.ExistsForTab()
189 let t:NERDTreeBufName = self._nextBufferName()
190 silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' new'
191 silent! execute 'edit ' . t:NERDTreeBufName
192 silent! execute 'vertical resize '. l:splitSize
193 else
194 silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' split'
195 silent! execute 'buffer ' . t:NERDTreeBufName
196 endif
197
198 setlocal winfixwidth
199
200 call self._setCommonBufOptions()
201
202 if has('patch-7.4.1925')
203 clearjumps
204 endif
205
206endfunction
207
208" FUNCTION: s:Creator._isBufHidden(nr) {{{1
209function! s:Creator._isBufHidden(nr)
210 redir => bufs
211 silent ls!
212 redir END
213
214 return bufs =~ a:nr . '..h'
215endfunction
216
217" FUNCTION: s:Creator.New() {{{1
218function! s:Creator.New()
219 let newCreator = copy(self)
220 return newCreator
221endfunction
222
223" FUNCTION: s:Creator._nextBufferName() {{{1
224" returns the buffer name for the next nerd tree
225function! s:Creator._nextBufferName()
226 let name = s:Creator.BufNamePrefix() . self._nextBufferNumber()
227 return name
228endfunction
229
230" FUNCTION: s:Creator._nextBufferNumber() {{{1
231" the number to add to the nerd tree buffer name to make the buf name unique
232function! s:Creator._nextBufferNumber()
233 if !exists('s:Creator._NextBufNum')
234 let s:Creator._NextBufNum = 1
235 else
236 let s:Creator._NextBufNum += 1
237 endif
238
239 return s:Creator._NextBufNum
240endfunction
241
242" FUNCTION: s:Creator._pathForString(str) {{{1
243" find a bookmark or adirectory for the given string
244function! s:Creator._pathForString(str)
245 let path = {}
246 if g:NERDTreeBookmark.BookmarkExistsFor(a:str)
247 let path = g:NERDTreeBookmark.BookmarkFor(a:str).path
248 else
249 let dir = a:str ==# '' ? getcwd() : a:str
250
251 "hack to get an absolute path if a relative path is given
252 if dir =~# '^\.'
253 let dir = getcwd() . nerdtree#slash() . dir
254 endif
255
256 "hack to prevent removing slash if dir is the root of the file system.
257 if dir !=# '/'
258 let dir = g:NERDTreePath.Resolve(dir)
259 endif
260
261 try
262 let path = g:NERDTreePath.New(dir)
263 catch /^NERDTree.InvalidArgumentsError/
264 call nerdtree#echo('No bookmark or directory found for: ' . a:str)
265 return {}
266 endtry
267 endif
268 if !path.isDirectory
269 let path = path.getParent()
270 endif
271
272 return path
273endfunction
274
275" Function: s:Creator._removeTreeBufForTab() {{{1
276function! s:Creator._removeTreeBufForTab()
277 let buf = bufnr(t:NERDTreeBufName)
278
279 "if &hidden is not set then it will already be gone
280 if buf != -1
281
282 "nerdtree buf may be mirrored/displayed elsewhere
283 if self._isBufHidden(buf)
284 exec 'bwipeout ' . buf
285 endif
286
287 endif
288
289 unlet t:NERDTreeBufName
290endfunction
291
292" FUNCTION: s:Creator._setCommonBufOptions() {{{1
293function! s:Creator._setCommonBufOptions()
294
295 " Options for a non-file/control buffer.
296 setlocal bufhidden=hide
297 setlocal buftype=nofile
298 setlocal noswapfile
299
300 " Options for controlling buffer/window appearance.
301 setlocal foldcolumn=0
302 setlocal foldmethod=manual
303 setlocal nobuflisted
304 setlocal nofoldenable
305 setlocal nolist
306 setlocal nospell
307 setlocal nowrap
308
309 if g:NERDTreeShowLineNumbers
310 setlocal number
311 else
312 setlocal nonumber
313 if v:version >= 703
314 setlocal norelativenumber
315 endif
316 endif
317
318 iabc <buffer>
319
320 if g:NERDTreeHighlightCursorline
321 setlocal cursorline
322 endif
323
324 call self._setupStatusline()
325 call self._bindMappings()
326
327 setlocal filetype=nerdtree
328endfunction
329
330" FUNCTION: s:Creator._setupStatusline() {{{1
331function! s:Creator._setupStatusline()
332 if g:NERDTreeStatusline != -1
333 let &l:statusline = g:NERDTreeStatusline
334 endif
335endfunction
336
337" FUNCTION: s:Creator._tabpagevar(tabnr, var) {{{1
338function! s:Creator._tabpagevar(tabnr, var)
339 let currentTab = tabpagenr()
340 let old_ei = &eventignore
341 set eventignore=all
342
343 try
344 exec 'tabnext ' . a:tabnr
345 let v = -1
346 if exists('t:' . a:var)
347 exec 'let v = t:' . a:var
348 endif
349 exec 'tabnext ' . currentTab
350
351 finally
352 let &eventignore = old_ei
353 endtry
354
355 return v
356endfunction
357
358" FUNCTION: s:Creator.ToggleTabTree(dir) {{{1
359function! s:Creator.ToggleTabTree(dir)
360 let creator = s:Creator.New()
361 call creator.toggleTabTree(a:dir)
362endfunction
363
364" FUNCTION: s:Creator.toggleTabTree(dir) {{{1
365" Toggles the NERD tree. I.e if the NERD tree is open, it is closed. If it is
366" closed, it is restored or initialized. If dir is not empty, it will be set
367" as the new root.
368"
369" Args:
370" dir: the full path for the root node (is used if the NERD tree is being
371" initialized, or to change the root to a new dir.)
372function! s:Creator.toggleTabTree(dir)
373 if g:NERDTree.ExistsForTab()
374 if !g:NERDTree.IsOpen()
375 call self._createTreeWin()
376 if !empty(a:dir) && a:dir !=# b:NERDTree.root.path.str()
377 call self.createTabTree(a:dir)
378 elseif !&hidden
379 call b:NERDTree.render()
380 endif
381 call b:NERDTree.ui.restoreScreenState()
382 else
383 call g:NERDTree.Close()
384 endif
385 else
386 call self.createTabTree(a:dir)
387 endif
388endfunction
389
390" Function: s:Creator._uniq(list) {{{1
391" returns a:list without duplicates
392function! s:Creator._uniq(list)
393 let uniqlist = []
394 for elem in a:list
395 if index(uniqlist, elem) ==# -1
396 let uniqlist += [elem]
397 endif
398 endfor
399 return uniqlist
400endfunction
401
402" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/.vim/pack/vendor/start/nerdtree/lib/nerdtree/event.vim b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/event.vim
new file mode 100644
index 0000000..964e8ff
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/event.vim
@@ -0,0 +1,13 @@
1"CLASS: Event
2"============================================================
3let s:Event = {}
4let g:NERDTreeEvent = s:Event
5
6function! s:Event.New(nerdtree, subject, action, params) abort
7 let newObj = copy(self)
8 let newObj.nerdtree = a:nerdtree
9 let newObj.subject = a:subject
10 let newObj.action = a:action
11 let newObj.params = a:params
12 return newObj
13endfunction
diff --git a/.vim/pack/vendor/start/nerdtree/lib/nerdtree/flag_set.vim b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/flag_set.vim
new file mode 100644
index 0000000..7552867
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/flag_set.vim
@@ -0,0 +1,58 @@
1"CLASS: FlagSet
2"============================================================
3let s:FlagSet = {}
4let g:NERDTreeFlagSet = s:FlagSet
5
6"FUNCTION: FlagSet.addFlag(scope, flag) {{{1
7function! s:FlagSet.addFlag(scope, flag)
8 let flags = self._flagsForScope(a:scope)
9 if index(flags, a:flag) == -1
10 call add(flags, a:flag)
11 end
12endfunction
13
14"FUNCTION: FlagSet.clearFlags(scope) {{{1
15function! s:FlagSet.clearFlags(scope)
16 let self._flags[a:scope] = []
17endfunction
18
19"FUNCTION: FlagSet._flagsForScope(scope) {{{1
20function! s:FlagSet._flagsForScope(scope)
21 if !has_key(self._flags, a:scope)
22 let self._flags[a:scope] = []
23 endif
24 return self._flags[a:scope]
25endfunction
26
27"FUNCTION: FlagSet.New() {{{1
28function! s:FlagSet.New()
29 let newObj = copy(self)
30 let newObj._flags = {}
31 return newObj
32endfunction
33
34"FUNCTION: FlagSet.removeFlag(scope, flag) {{{1
35function! s:FlagSet.removeFlag(scope, flag)
36 let flags = self._flagsForScope(a:scope)
37
38 let i = index(flags, a:flag)
39 if i >= 0
40 call remove(flags, i)
41 endif
42endfunction
43
44"FUNCTION: FlagSet.renderToString() {{{1
45function! s:FlagSet.renderToString()
46 let flagstring = ''
47 for i in values(self._flags)
48 let flagstring .= join(i)
49 endfor
50
51 if len(flagstring) == 0
52 return ''
53 endif
54
55 return '[' . flagstring . ']'
56endfunction
57
58" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/.vim/pack/vendor/start/nerdtree/lib/nerdtree/key_map.vim b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/key_map.vim
new file mode 100644
index 0000000..ed79167
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/key_map.vim
@@ -0,0 +1,164 @@
1"CLASS: KeyMap
2"============================================================
3let s:KeyMap = {}
4let g:NERDTreeKeyMap = s:KeyMap
5let s:keyMaps = {}
6
7"FUNCTION: KeyMap.All() {{{1
8function! s:KeyMap.All()
9 let sortedKeyMaps = values(s:keyMaps)
10 call sort(sortedKeyMaps, s:KeyMap.Compare, s:KeyMap)
11
12 return sortedKeyMaps
13endfunction
14
15"FUNCTION: KeyMap.Compare(keyMap1, keyMap2) {{{1
16function! s:KeyMap.Compare(keyMap1, keyMap2)
17
18 if a:keyMap1.key >? a:keyMap2.key
19 return 1
20 endif
21
22 if a:keyMap1.key <? a:keyMap2.key
23 return -1
24 endif
25
26 return 0
27endfunction
28
29"FUNCTION: KeyMap.FindFor(key, scope) {{{1
30function! s:KeyMap.FindFor(key, scope)
31 return get(s:keyMaps, a:key . a:scope, {})
32endfunction
33
34"FUNCTION: KeyMap.BindAll() {{{1
35function! s:KeyMap.BindAll()
36 for i in values(s:keyMaps)
37 call i.bind()
38 endfor
39endfunction
40
41"FUNCTION: KeyMap.bind() {{{1
42function! s:KeyMap.bind()
43 " If the key sequence we're trying to map contains any '<>' notation, we
44 " must replace each of the '<' characters with '<lt>' to ensure the string
45 " is not translated into its corresponding keycode during the later part
46 " of the map command below
47 " :he <>
48 let specialNotationRegex = '\m<\([[:alnum:]_-]\+>\)'
49 if self.key =~# specialNotationRegex
50 let keymapInvokeString = substitute(self.key, specialNotationRegex, '<lt>\1', 'g')
51 else
52 let keymapInvokeString = self.key
53 endif
54 let keymapInvokeString = escape(keymapInvokeString, '\"')
55
56 let premap = self.key ==# '<LeftRelease>' ? ' <LeftRelease>' : ' '
57
58 exec 'nnoremap <buffer> <silent> '. self.key . premap . ':call nerdtree#ui_glue#invokeKeyMap("'. keymapInvokeString .'")<cr>'
59endfunction
60
61"FUNCTION: KeyMap.Remove(key, scope) {{{1
62function! s:KeyMap.Remove(key, scope)
63 return remove(s:keyMaps, a:key . a:scope)
64endfunction
65
66"FUNCTION: KeyMap.invoke() {{{1
67"Call the KeyMaps callback function
68function! s:KeyMap.invoke(...)
69 let l:Callback = type(self.callback) ==# type(function('tr')) ? self.callback : function(self.callback)
70 if a:0
71 call l:Callback(a:1)
72 else
73 call l:Callback()
74 endif
75endfunction
76
77"FUNCTION: KeyMap.Invoke() {{{1
78"Find a keymapping for a:key and the current scope invoke it.
79"
80"Scope is determined as follows:
81" * if the cursor is on a dir node then DirNode
82" * if the cursor is on a file node then FileNode
83" * if the cursor is on a bookmark then Bookmark
84"
85"If a keymap has the scope of 'all' then it will be called if no other keymap
86"is found for a:key and the scope.
87function! s:KeyMap.Invoke(key)
88
89 "required because clicking the command window below another window still
90 "invokes the <LeftRelease> mapping - but changes the window cursor
91 "is in first
92 "
93 "TODO: remove this check when the vim bug is fixed
94 if !g:NERDTree.ExistsForBuf()
95 return {}
96 endif
97
98 let node = g:NERDTreeFileNode.GetSelected()
99 if !empty(node)
100
101 "try file node
102 if !node.path.isDirectory
103 let km = s:KeyMap.FindFor(a:key, 'FileNode')
104 if !empty(km)
105 return km.invoke(node)
106 endif
107 endif
108
109 "try dir node
110 if node.path.isDirectory
111 let km = s:KeyMap.FindFor(a:key, 'DirNode')
112 if !empty(km)
113 return km.invoke(node)
114 endif
115 endif
116
117 "try generic node
118 let km = s:KeyMap.FindFor(a:key, 'Node')
119 if !empty(km)
120 return km.invoke(node)
121 endif
122
123 endif
124
125 "try bookmark
126 let bm = g:NERDTreeBookmark.GetSelected()
127 if !empty(bm)
128 let km = s:KeyMap.FindFor(a:key, 'Bookmark')
129 if !empty(km)
130 return km.invoke(bm)
131 endif
132 endif
133
134 "try all
135 let km = s:KeyMap.FindFor(a:key, 'all')
136 if !empty(km)
137 return km.invoke()
138 endif
139endfunction
140
141"FUNCTION: KeyMap.Create(options) {{{1
142function! s:KeyMap.Create(options)
143 let opts = extend({'scope': 'all', 'quickhelpText': ''}, copy(a:options))
144
145 "dont override other mappings unless the 'override' option is given
146 if get(opts, 'override', 0) ==# 0 && !empty(s:KeyMap.FindFor(opts['key'], opts['scope']))
147 return
148 end
149
150 let newKeyMap = copy(self)
151 let newKeyMap.key = opts['key']
152 let newKeyMap.quickhelpText = opts['quickhelpText']
153 let newKeyMap.callback = opts['callback']
154 let newKeyMap.scope = opts['scope']
155
156 call s:KeyMap.Add(newKeyMap)
157endfunction
158
159"FUNCTION: KeyMap.Add(keymap) {{{1
160function! s:KeyMap.Add(keymap)
161 let s:keyMaps[a:keymap.key . a:keymap.scope] = a:keymap
162endfunction
163
164" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/.vim/pack/vendor/start/nerdtree/lib/nerdtree/menu_controller.vim b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/menu_controller.vim
new file mode 100644
index 0000000..952c67b
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/menu_controller.vim
@@ -0,0 +1,211 @@
1"CLASS: MenuController
2"============================================================
3let s:MenuController = {}
4let g:NERDTreeMenuController = s:MenuController
5
6"FUNCTION: MenuController.New(menuItems) {{{1
7"create a new menu controller that operates on the given menu items
8function! s:MenuController.New(menuItems)
9 let newMenuController = copy(self)
10 if a:menuItems[0].isSeparator()
11 let newMenuController.menuItems = a:menuItems[1:-1]
12 else
13 let newMenuController.menuItems = a:menuItems
14 endif
15 return newMenuController
16endfunction
17
18" FUNCTION: s:MenuController.isMinimal() {{{1
19function! s:MenuController.isMinimal()
20 return g:NERDTreeMinimalMenu
21endfunction
22
23" FUNCTION: MenuController.showMenu() {{{1
24" Enter the main loop of the NERDTree menu, prompting the user to select
25" a menu item.
26function! s:MenuController.showMenu()
27 call self._saveOptions()
28
29 try
30 let self.selection = 0
31 let l:done = 0
32
33 while !l:done
34 if has('nvim')
35 mode
36 else
37 redraw!
38 endif
39 call self._echoPrompt()
40
41 let l:key = nr2char(getchar())
42 let l:done = self._handleKeypress(l:key)
43 endwhile
44 finally
45 call self._restoreOptions()
46
47 " Redraw when Ctrl-C or Esc is received.
48 if !l:done || self.selection ==# -1
49 redraw!
50 endif
51 endtry
52
53 if self.selection !=# -1
54 let l:m = self._current()
55 call l:m.execute()
56 endif
57endfunction
58
59"FUNCTION: MenuController._echoPrompt() {{{1
60function! s:MenuController._echoPrompt()
61 let navHelp = 'Use ' . g:NERDTreeMenuDown . '/' . g:NERDTreeMenuUp . '/enter'
62
63 if self.isMinimal()
64 let selection = self.menuItems[self.selection].text
65 let keyword = matchstr(selection, '[^ ]*([^ ]*')
66
67 let shortcuts = map(copy(self.menuItems), "v:val['shortcut']")
68 let shortcuts[self.selection] = ' ' . keyword . ' '
69
70 echo 'Menu: [' . join(shortcuts, ',') . '] (' . navHelp . ' or shortcut): '
71 else
72 echo 'NERDTree Menu. ' . navHelp . ', or the shortcuts indicated'
73 echo '========================================================='
74
75 for i in range(0, len(self.menuItems)-1)
76 if self.selection ==# i
77 echo '> ' . self.menuItems[i].text
78 else
79 echo ' ' . self.menuItems[i].text
80 endif
81 endfor
82 endif
83endfunction
84
85"FUNCTION: MenuController._current(key) {{{1
86"get the MenuItem that is currently selected
87function! s:MenuController._current()
88 return self.menuItems[self.selection]
89endfunction
90
91"FUNCTION: MenuController._handleKeypress(key) {{{1
92"change the selection (if appropriate) and return 1 if the user has made
93"their choice, 0 otherwise
94function! s:MenuController._handleKeypress(key)
95 if a:key ==# g:NERDTreeMenuDown
96 call self._cursorDown()
97 elseif a:key ==# g:NERDTreeMenuUp
98 call self._cursorUp()
99 elseif a:key ==# nr2char(27) "escape
100 let self.selection = -1
101 return 1
102 elseif a:key ==# "\r" || a:key ==# "\n" "enter and ctrl-j
103 return 1
104 else
105 let index = self._nextIndexFor(a:key)
106 if index !=# -1
107 let self.selection = index
108 if len(self._allIndexesFor(a:key)) ==# 1
109 return 1
110 endif
111 endif
112 endif
113
114 return 0
115endfunction
116
117"FUNCTION: MenuController._allIndexesFor(shortcut) {{{1
118"get indexes to all menu items with the given shortcut
119function! s:MenuController._allIndexesFor(shortcut)
120 let toReturn = []
121
122 for i in range(0, len(self.menuItems)-1)
123 if self.menuItems[i].shortcut ==# a:shortcut
124 call add(toReturn, i)
125 endif
126 endfor
127
128 return toReturn
129endfunction
130
131"FUNCTION: MenuController._nextIndexFor(shortcut) {{{1
132"get the index to the next menu item with the given shortcut, starts from the
133"current cursor location and wraps around to the top again if need be
134function! s:MenuController._nextIndexFor(shortcut)
135 for i in range(self.selection+1, len(self.menuItems)-1)
136 if self.menuItems[i].shortcut ==# a:shortcut
137 return i
138 endif
139 endfor
140
141 for i in range(0, self.selection)
142 if self.menuItems[i].shortcut ==# a:shortcut
143 return i
144 endif
145 endfor
146
147 return -1
148endfunction
149
150"FUNCTION: MenuController._setCmdheight() {{{1
151"sets &cmdheight to whatever is needed to display the menu
152function! s:MenuController._setCmdheight()
153 if self.isMinimal()
154 let &cmdheight = 1
155 else
156 let &cmdheight = len(self.menuItems) + 3
157 endif
158endfunction
159
160"FUNCTION: MenuController._saveOptions() {{{1
161"set any vim options that are required to make the menu work (saving their old
162"values)
163function! s:MenuController._saveOptions()
164 let self._oldLazyredraw = &lazyredraw
165 let self._oldCmdheight = &cmdheight
166 set nolazyredraw
167 call self._setCmdheight()
168endfunction
169
170"FUNCTION: MenuController._restoreOptions() {{{1
171"restore the options we saved in _saveOptions()
172function! s:MenuController._restoreOptions()
173 let &cmdheight = self._oldCmdheight
174 let &lazyredraw = self._oldLazyredraw
175endfunction
176
177"FUNCTION: MenuController._cursorDown() {{{1
178"move the cursor to the next menu item, skipping separators
179function! s:MenuController._cursorDown()
180 let done = 0
181 while !done
182 if self.selection < len(self.menuItems)-1
183 let self.selection += 1
184 else
185 let self.selection = 0
186 endif
187
188 if !self._current().isSeparator()
189 let done = 1
190 endif
191 endwhile
192endfunction
193
194"FUNCTION: MenuController._cursorUp() {{{1
195"move the cursor to the previous menu item, skipping separators
196function! s:MenuController._cursorUp()
197 let done = 0
198 while !done
199 if self.selection > 0
200 let self.selection -= 1
201 else
202 let self.selection = len(self.menuItems)-1
203 endif
204
205 if !self._current().isSeparator()
206 let done = 1
207 endif
208 endwhile
209endfunction
210
211" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/.vim/pack/vendor/start/nerdtree/lib/nerdtree/menu_item.vim b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/menu_item.vim
new file mode 100644
index 0000000..7f25917
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/menu_item.vim
@@ -0,0 +1,118 @@
1"CLASS: MenuItem
2"============================================================
3let s:MenuItem = {}
4let g:NERDTreeMenuItem = s:MenuItem
5
6"FUNCTION: MenuItem.All() {{{1
7"get all top level menu items
8function! s:MenuItem.All()
9 if !exists('s:menuItems')
10 let s:menuItems = []
11 endif
12 return s:menuItems
13endfunction
14
15"FUNCTION: MenuItem.AllEnabled() {{{1
16"get all top level menu items that are currently enabled
17function! s:MenuItem.AllEnabled()
18 let toReturn = []
19 for i in s:MenuItem.All()
20 if i.enabled()
21 call add(toReturn, i)
22 endif
23 endfor
24 return toReturn
25endfunction
26
27"FUNCTION: MenuItem.Create(options) {{{1
28"make a new menu item and add it to the global list
29function! s:MenuItem.Create(options)
30 let newMenuItem = copy(self)
31
32 let newMenuItem.text = a:options['text']
33 let newMenuItem.shortcut = a:options['shortcut']
34 let newMenuItem.children = []
35
36 let newMenuItem.isActiveCallback = -1
37 if has_key(a:options, 'isActiveCallback')
38 let newMenuItem.isActiveCallback = a:options['isActiveCallback']
39 endif
40
41 let newMenuItem.callback = -1
42 if has_key(a:options, 'callback')
43 let newMenuItem.callback = a:options['callback']
44 endif
45
46 if has_key(a:options, 'parent')
47 call add(a:options['parent'].children, newMenuItem)
48 else
49 call add(s:MenuItem.All(), newMenuItem)
50 endif
51
52 return newMenuItem
53endfunction
54
55"FUNCTION: MenuItem.CreateSeparator(options) {{{1
56"make a new separator menu item and add it to the global list
57function! s:MenuItem.CreateSeparator(options)
58 let standard_options = { 'text': '--------------------',
59 \ 'shortcut': -1,
60 \ 'callback': -1 }
61 let options = extend(a:options, standard_options, 'force')
62
63 return s:MenuItem.Create(options)
64endfunction
65
66"FUNCTION: MenuItem.CreateSubmenu(options) {{{1
67"make a new submenu and add it to global list
68function! s:MenuItem.CreateSubmenu(options)
69 let standard_options = { 'callback': -1 }
70 let options = extend(a:options, standard_options, 'force')
71
72 return s:MenuItem.Create(options)
73endfunction
74
75"FUNCTION: MenuItem.enabled() {{{1
76"return 1 if this menu item should be displayed
77"
78"delegates off to the isActiveCallback, and defaults to 1 if no callback was
79"specified
80function! s:MenuItem.enabled()
81 if self.isActiveCallback != -1
82 return type(self.isActiveCallback) == type(function('tr')) ? self.isActiveCallback() : {self.isActiveCallback}()
83 endif
84 return 1
85endfunction
86
87"FUNCTION: MenuItem.execute() {{{1
88"perform the action behind this menu item, if this menuitem has children then
89"display a new menu for them, otherwise deletegate off to the menuitem's
90"callback
91function! s:MenuItem.execute()
92 if len(self.children)
93 let mc = g:NERDTreeMenuController.New(self.children)
94 call mc.showMenu()
95 else
96 if self.callback != -1
97 if type(self.callback) == type(function('tr'))
98 call self.callback()
99 else
100 call {self.callback}()
101 endif
102 endif
103 endif
104endfunction
105
106"FUNCTION: MenuItem.isSeparator() {{{1
107"return 1 if this menuitem is a separator
108function! s:MenuItem.isSeparator()
109 return self.callback == -1 && self.children == []
110endfunction
111
112"FUNCTION: MenuItem.isSubmenu() {{{1
113"return 1 if this menuitem is a submenu
114function! s:MenuItem.isSubmenu()
115 return self.callback == -1 && !empty(self.children)
116endfunction
117
118" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/.vim/pack/vendor/start/nerdtree/lib/nerdtree/nerdtree.vim b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/nerdtree.vim
new file mode 100644
index 0000000..61a11a9
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/nerdtree.vim
@@ -0,0 +1,209 @@
1"CLASS: NERDTree
2"============================================================
3let s:NERDTree = {}
4let g:NERDTree = s:NERDTree
5
6"FUNCTION: s:NERDTree.AddPathFilter() {{{1
7function! s:NERDTree.AddPathFilter(callback)
8 call add(s:NERDTree.PathFilters(), a:callback)
9endfunction
10
11"FUNCTION: s:NERDTree.changeRoot(node) {{{1
12function! s:NERDTree.changeRoot(node)
13 if a:node.path.isDirectory
14 let self.root = a:node
15 else
16 call a:node.cacheParent()
17 let self.root = a:node.parent
18 endif
19
20 call self.root.open()
21
22 "change dir to the dir of the new root if instructed to
23 if g:NERDTreeChDirMode >= 2
24 call self.root.path.changeToDir()
25 endif
26
27 call self.render()
28 call self.root.putCursorHere(0, 0)
29
30 if exists('#User#NERDTreeNewRoot')
31 doautocmd User NERDTreeNewRoot
32 endif
33endfunction
34
35"FUNCTION: s:NERDTree.Close() {{{1
36"Closes the tab tree window for this tab
37function! s:NERDTree.Close()
38 if !s:NERDTree.IsOpen()
39 return
40 endif
41
42 if winnr('$') !=# 1
43 " Use the window ID to identify the currently active window or fall
44 " back on the buffer ID if win_getid/win_gotoid are not available, in
45 " which case we'll focus an arbitrary window showing the buffer.
46 let l:useWinId = exists('*win_getid') && exists('*win_gotoid')
47
48 if winnr() ==# s:NERDTree.GetWinNum()
49 call nerdtree#exec('wincmd p', 1)
50 let l:activeBufOrWin = l:useWinId ? win_getid() : bufnr('')
51 call nerdtree#exec('wincmd p', 1)
52 else
53 let l:activeBufOrWin = l:useWinId ? win_getid() : bufnr('')
54 endif
55
56 call nerdtree#exec(s:NERDTree.GetWinNum() . ' wincmd w', 1)
57 call nerdtree#exec('close', 0)
58 if l:useWinId
59 call nerdtree#exec('call win_gotoid(' . l:activeBufOrWin . ')', 0)
60 else
61 call nerdtree#exec(bufwinnr(l:activeBufOrWin) . ' wincmd w', 0)
62 endif
63 else
64 close
65 endif
66endfunction
67
68"FUNCTION: s:NERDTree.CursorToBookmarkTable(){{{1
69"Places the cursor at the top of the bookmarks table
70function! s:NERDTree.CursorToBookmarkTable()
71 if !b:NERDTree.ui.getShowBookmarks()
72 throw 'NERDTree.IllegalOperationError: cant find bookmark table, bookmarks arent active'
73 endif
74
75 if g:NERDTreeMinimalUI
76 return cursor(1, 2)
77 endif
78
79 let rootNodeLine = b:NERDTree.ui.getRootLineNum()
80
81 let line = 1
82 while getline(line) !~# '^>-\+Bookmarks-\+$'
83 let line = line + 1
84 if line >= rootNodeLine
85 throw 'NERDTree.BookmarkTableNotFoundError: didnt find the bookmarks table'
86 endif
87 endwhile
88 call cursor(line, 2)
89endfunction
90
91"FUNCTION: s:NERDTree.CursorToTreeWin(){{{1
92"Places the cursor in the nerd tree window
93function! s:NERDTree.CursorToTreeWin(...)
94 call g:NERDTree.MustBeOpen()
95 call nerdtree#exec(g:NERDTree.GetWinNum() . 'wincmd w', a:0 >0 ? a:1 : 1)
96endfunction
97
98" Function: s:NERDTree.ExistsForBuffer() {{{1
99" Returns 1 if a nerd tree root exists in the current buffer
100function! s:NERDTree.ExistsForBuf()
101 return exists('b:NERDTree')
102endfunction
103
104" Function: s:NERDTree.ExistsForTab() {{{1
105" Returns 1 if a nerd tree root exists in the current tab
106function! s:NERDTree.ExistsForTab()
107 if !exists('t:NERDTreeBufName')
108 return
109 end
110
111 "check b:NERDTree is still there and hasn't been e.g. :bdeleted
112 return !empty(getbufvar(bufnr(t:NERDTreeBufName), 'NERDTree'))
113endfunction
114
115function! s:NERDTree.ForCurrentBuf()
116 if s:NERDTree.ExistsForBuf()
117 return b:NERDTree
118 else
119 return {}
120 endif
121endfunction
122
123"FUNCTION: s:NERDTree.ForCurrentTab() {{{1
124function! s:NERDTree.ForCurrentTab()
125 if !s:NERDTree.ExistsForTab()
126 return
127 endif
128
129 let bufnr = bufnr(t:NERDTreeBufName)
130 return getbufvar(bufnr, 'NERDTree')
131endfunction
132
133"FUNCTION: s:NERDTree.getRoot() {{{1
134function! s:NERDTree.getRoot()
135 return self.root
136endfunction
137
138"FUNCTION: s:NERDTree.GetWinNum() {{{1
139"gets the nerd tree window number for this tab
140function! s:NERDTree.GetWinNum()
141 if exists('t:NERDTreeBufName')
142 return bufwinnr(t:NERDTreeBufName)
143 endif
144
145 " If WindowTree, there is no t:NERDTreeBufName variable. Search all windows.
146 for w in range(1,winnr('$'))
147 if bufname(winbufnr(w)) =~# '^' . g:NERDTreeCreator.BufNamePrefix() . '\d\+$'
148 return w
149 endif
150 endfor
151
152 return -1
153endfunction
154
155"FUNCTION: s:NERDTree.IsOpen() {{{1
156function! s:NERDTree.IsOpen()
157 return s:NERDTree.GetWinNum() !=# -1
158endfunction
159
160"FUNCTION: s:NERDTree.isTabTree() {{{1
161function! s:NERDTree.isTabTree()
162 return self._type ==# 'tab'
163endfunction
164
165"FUNCTION: s:NERDTree.isWinTree() {{{1
166function! s:NERDTree.isWinTree()
167 return self._type ==# 'window'
168endfunction
169
170"FUNCTION: s:NERDTree.MustBeOpen() {{{1
171function! s:NERDTree.MustBeOpen()
172 if !s:NERDTree.IsOpen()
173 throw 'NERDTree.TreeNotOpen'
174 endif
175endfunction
176
177"FUNCTION: s:NERDTree.New() {{{1
178function! s:NERDTree.New(path, type)
179 let newObj = copy(self)
180 let newObj.ui = g:NERDTreeUI.New(newObj)
181 let newObj.root = g:NERDTreeDirNode.New(a:path, newObj)
182 let newObj._type = a:type
183 return newObj
184endfunction
185
186"FUNCTION: s:NERDTree.PathFilters() {{{1
187function! s:NERDTree.PathFilters()
188 if !exists('s:NERDTree._PathFilters')
189 let s:NERDTree._PathFilters = []
190 endif
191 return s:NERDTree._PathFilters
192endfunction
193
194"FUNCTION: s:NERDTree.previousBuf() {{{1
195function! s:NERDTree.previousBuf()
196 return self._previousBuf
197endfunction
198
199function! s:NERDTree.setPreviousBuf(bnum)
200 let self._previousBuf = a:bnum
201endfunction
202
203"FUNCTION: s:NERDTree.render() {{{1
204"A convenience function - since this is called often
205function! s:NERDTree.render()
206 call self.ui.render()
207endfunction
208
209" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/.vim/pack/vendor/start/nerdtree/lib/nerdtree/notifier.vim b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/notifier.vim
new file mode 100644
index 0000000..ffa2853
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/notifier.vim
@@ -0,0 +1,35 @@
1"CLASS: Notifier
2"============================================================
3let s:Notifier = {}
4
5function! s:Notifier.AddListener(event, funcname)
6 let listeners = s:Notifier.GetListenersForEvent(a:event)
7 if listeners == []
8 let listenersMap = s:Notifier.GetListenersMap()
9 let listenersMap[a:event] = listeners
10 endif
11 call add(listeners, a:funcname)
12endfunction
13
14function! s:Notifier.NotifyListeners(event, path, nerdtree, params)
15 let event = g:NERDTreeEvent.New(a:nerdtree, a:path, a:event, a:params)
16
17 for Listener in s:Notifier.GetListenersForEvent(a:event)
18 let l:Callback = type(Listener) == type(function('tr')) ? Listener : function(Listener)
19 call l:Callback(event)
20 endfor
21endfunction
22
23function! s:Notifier.GetListenersMap()
24 if !exists('s:refreshListenersMap')
25 let s:refreshListenersMap = {}
26 endif
27 return s:refreshListenersMap
28endfunction
29
30function! s:Notifier.GetListenersForEvent(name)
31 let listenersMap = s:Notifier.GetListenersMap()
32 return get(listenersMap, a:name, [])
33endfunction
34
35let g:NERDTreePathNotifier = deepcopy(s:Notifier)
diff --git a/.vim/pack/vendor/start/nerdtree/lib/nerdtree/opener.vim b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/opener.vim
new file mode 100644
index 0000000..27993ac
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/opener.vim
@@ -0,0 +1,326 @@
1" ============================================================================
2" CLASS: Opener
3"
4" The Opener class defines an API for 'opening' operations.
5" ============================================================================
6
7
8let s:Opener = {}
9let g:NERDTreeOpener = s:Opener
10
11" FUNCTION: s:Opener._bufInWindows(bnum) {{{1
12" [[STOLEN FROM VTREEEXPLORER.VIM]]
13" Determine the number of windows open to this buffer number.
14" Care of Yegappan Lakshman. Thanks!
15"
16" Args:
17" bnum: the subject buffers buffer number
18function! s:Opener._bufInWindows(bnum)
19 let cnt = 0
20 let winnum = 1
21 while 1
22 let bufnum = winbufnr(winnum)
23 if bufnum < 0
24 break
25 endif
26 if bufnum ==# a:bnum
27 let cnt = cnt + 1
28 endif
29 let winnum = winnum + 1
30 endwhile
31
32 return cnt
33endfunction
34
35" FUNCTION: Opener._checkToCloseTree(newtab) {{{1
36" Check the class options to see if the tree should be closed now.
37"
38" Args:
39" a:newtab - boolean. If set, only close the tree now if we are opening the
40" target in a new tab. This is needed because we have to close tree before we
41" leave the tab
42function! s:Opener._checkToCloseTree(newtab)
43 if self._keepopen
44 return
45 endif
46
47 if (a:newtab && self._where ==# 't') || !a:newtab
48 call g:NERDTree.Close()
49 endif
50endfunction
51
52" FUNCTION: s:Opener._firstUsableWindow() {{{1
53" find the window number of the first normal window
54function! s:Opener._firstUsableWindow()
55 let i = 1
56 while i <= winnr('$')
57 let bnum = winbufnr(i)
58 if bnum !=# -1 && getbufvar(bnum, '&buftype') ==# ''
59 \ && !getwinvar(i, '&previewwindow')
60 \ && (!getbufvar(bnum, '&modified') || &hidden)
61 return i
62 endif
63
64 let i += 1
65 endwhile
66 return -1
67endfunction
68
69" FUNCTION: Opener._gotoTargetWin() {{{1
70function! s:Opener._gotoTargetWin()
71 if b:NERDTree.isWinTree()
72 if self._where ==# 'v'
73 call self._newVSplit()
74 elseif self._where ==# 'h'
75 call self._newSplit()
76 elseif self._where ==# 't'
77 tabnew
78 endif
79 else
80 call self._checkToCloseTree(1)
81
82 if self._where ==# 'v'
83 call self._newVSplit()
84 elseif self._where ==# 'h'
85 call self._newSplit()
86 elseif self._where ==# 't'
87 tabnew
88 elseif self._where ==# 'p'
89 call self._previousWindow()
90 endif
91
92 call self._checkToCloseTree(0)
93 endif
94endfunction
95
96" FUNCTION: s:Opener._isWindowUsable(winnumber) {{{1
97" Returns 0 if opening a file from the tree in the given window requires it to
98" be split, 1 otherwise
99"
100" Args:
101" winnumber: the number of the window in question
102function! s:Opener._isWindowUsable(winnumber)
103 "gotta split if theres only one window (i.e. the NERD tree)
104 if winnr('$') ==# 1
105 return 0
106 endif
107
108 let oldwinnr = winnr()
109 call nerdtree#exec(a:winnumber . 'wincmd p', 1)
110 let specialWindow = getbufvar('%', '&buftype') !=# '' || getwinvar('%', '&previewwindow')
111 let modified = &modified
112 call nerdtree#exec(oldwinnr . 'wincmd p', 1)
113
114 "if its a special window e.g. quickfix or another explorer plugin then we
115 "have to split
116 if specialWindow
117 return 0
118 endif
119
120 if &hidden
121 return 1
122 endif
123
124 return !modified || self._bufInWindows(winbufnr(a:winnumber)) >= 2
125endfunction
126
127" FUNCTION: Opener.New(path, opts) {{{1
128" Instantiate a new NERDTreeOpener object.
129" Args:
130" a:path: the path object that is to be opened
131" a:opts: a dictionary containing the following optional keys...
132" 'where': specifies whether the node should be opened in new split, in
133" a new tab or, in the last window; takes values 'v', 'h', or 't'
134" 'reuse': if file is already shown in a window, jump there; takes values
135" 'all', 'currenttab', or empty
136" 'keepopen': boolean (0 or 1); if true, the tree window will not be closed
137" 'stay': boolean (0 or 1); if true, remain in tree window after opening
138function! s:Opener.New(path, opts)
139 let l:newOpener = copy(self)
140
141 let l:newOpener._keepopen = nerdtree#has_opt(a:opts, 'keepopen')
142 let l:newOpener._nerdtree = b:NERDTree
143 let l:newOpener._path = a:path
144 let l:newOpener._reuse = has_key(a:opts, 'reuse') ? a:opts['reuse'] : ''
145 let l:newOpener._stay = nerdtree#has_opt(a:opts, 'stay')
146 let l:newOpener._where = has_key(a:opts, 'where') ? a:opts['where'] : ''
147
148 call l:newOpener._saveCursorPos()
149
150 return l:newOpener
151endfunction
152
153" FUNCTION: Opener._newSplit() {{{1
154function! s:Opener._newSplit()
155 let onlyOneWin = (winnr('$') ==# 1)
156 let savesplitright = &splitright
157 if onlyOneWin
158 let &splitright = (g:NERDTreeWinPos ==# 'left')
159 endif
160 " If only one window (ie. NERDTree), split vertically instead.
161 let splitMode = onlyOneWin ? 'vertical' : ''
162
163 " Open the new window
164 try
165 call nerdtree#exec('wincmd p', 1)
166 call nerdtree#exec(splitMode . ' split',1)
167 catch /^Vim\%((\a\+)\)\=:E37/
168 call g:NERDTree.CursorToTreeWin()
169 throw 'NERDTree.FileAlreadyOpenAndModifiedError: '. self._path.str() .' is already open and modified.'
170 catch /^Vim\%((\a\+)\)\=:/
171 "do nothing
172 endtry
173
174 "resize the tree window if no other window was open before
175 if onlyOneWin
176 call nerdtree#exec('wincmd p', 1)
177 call nerdtree#exec('silent '. splitMode .' resize '. g:NERDTreeWinSize, 1)
178 call nerdtree#exec('wincmd p', 0)
179 endif
180
181 let &splitright=savesplitright
182endfunction
183
184" FUNCTION: Opener._newVSplit() {{{1
185function! s:Opener._newVSplit()
186 let l:winwidth = winwidth('.')
187
188 let onlyOneWin = (winnr('$') ==# 1)
189 let savesplitright = &splitright
190 if onlyOneWin
191 let &splitright = (g:NERDTreeWinPos ==# 'left')
192 let l:winwidth = g:NERDTreeWinSize
193 endif
194
195 call nerdtree#exec('wincmd p', 1)
196 call nerdtree#exec('vsplit', 1)
197
198 let l:currentWindowNumber = winnr()
199
200 " Restore the NERDTree to its original width.
201 call g:NERDTree.CursorToTreeWin()
202 execute 'silent vertical resize ' . l:winwidth
203
204 call nerdtree#exec(l:currentWindowNumber . 'wincmd w', 0)
205 let &splitright=savesplitright
206endfunction
207
208" FUNCTION: Opener.open(target) {{{1
209function! s:Opener.open(target)
210 if self._path.isDirectory
211 call self._openDirectory(a:target)
212 return
213 endif
214
215 call self._openFile()
216endfunction
217
218" FUNCTION: Opener._openFile() {{{1
219function! s:Opener._openFile()
220 if !self._stay && self._keepopen && get(b:, 'NERDTreeZoomed', 0)
221 call b:NERDTree.ui.toggleZoom()
222 endif
223
224 if self._reuseWindow()
225 return
226 endif
227
228 call self._gotoTargetWin()
229
230 if self._stay
231 silent call self._path.edit()
232 call self._restoreCursorPos()
233 return
234 endif
235
236 call self._path.edit()
237endfunction
238
239" FUNCTION: Opener._openDirectory(node) {{{1
240function! s:Opener._openDirectory(node)
241 call self._gotoTargetWin()
242
243 if self._nerdtree.isWinTree()
244 call g:NERDTreeCreator.CreateWindowTree(a:node.path.str())
245 else
246 if empty(self._where)
247 call b:NERDTree.changeRoot(a:node)
248 elseif self._where ==# 't'
249 call g:NERDTreeCreator.CreateTabTree(a:node.path.str())
250 else
251 call g:NERDTreeCreator.CreateWindowTree(a:node.path.str())
252 endif
253 endif
254
255 if self._stay
256 call self._restoreCursorPos()
257 endif
258endfunction
259
260" FUNCTION: Opener._previousWindow() {{{1
261function! s:Opener._previousWindow()
262 if !self._isWindowUsable(winnr('#')) && self._firstUsableWindow() ==# -1
263 call self._newSplit()
264 else
265 try
266 if !self._isWindowUsable(winnr('#'))
267 call nerdtree#exec(self._firstUsableWindow() . 'wincmd w', 1)
268 else
269 call nerdtree#exec('wincmd p', 1)
270 endif
271 catch /^Vim\%((\a\+)\)\=:E37/
272 call g:NERDTree.CursorToTreeWin()
273 throw 'NERDTree.FileAlreadyOpenAndModifiedError: '. self._path.str() .' is already open and modified.'
274 catch /^Vim\%((\a\+)\)\=:/
275 echo v:exception
276 endtry
277 endif
278endfunction
279
280" FUNCTION: Opener._restoreCursorPos() {{{1
281function! s:Opener._restoreCursorPos()
282 call nerdtree#exec(self._tabnr . 'tabnext', 1)
283 call nerdtree#exec(bufwinnr(self._bufnr) . 'wincmd w', 1)
284endfunction
285
286" FUNCTION: Opener._reuseWindow() {{{1
287" put the cursor in the first window we find for this file
288"
289" return 1 if we were successful
290function! s:Opener._reuseWindow()
291 if empty(self._reuse)
292 return 0
293 endif
294
295 "check the current tab for the window
296 let winnr = bufwinnr('^' . self._path.str() . '$')
297 if winnr !=# -1
298 call nerdtree#exec(winnr . 'wincmd w', 0)
299 call self._checkToCloseTree(0)
300 return 1
301 endif
302
303 if self._reuse ==# 'currenttab'
304 return 0
305 endif
306
307 "check other tabs
308 let tabnr = self._path.tabnr()
309 if tabnr
310 call self._checkToCloseTree(1)
311 call nerdtree#exec(tabnr . 'tabnext', 1)
312 let winnr = bufwinnr('^' . self._path.str() . '$')
313 call nerdtree#exec(winnr . 'wincmd w', 0)
314 return 1
315 endif
316
317 return 0
318endfunction
319
320" FUNCTION: Opener._saveCursorPos() {{{1
321function! s:Opener._saveCursorPos()
322 let self._bufnr = bufnr('')
323 let self._tabnr = tabpagenr()
324endfunction
325
326" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/.vim/pack/vendor/start/nerdtree/lib/nerdtree/path.vim b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/path.vim
new file mode 100644
index 0000000..997abf3
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/path.vim
@@ -0,0 +1,852 @@
1" ============================================================================
2" CLASS: Path
3"
4" The Path class provides an abstracted representation of a file system
5" pathname. Various operations on pathnames are provided and a number of
6" representations of a given path name can be accessed here.
7" ============================================================================
8
9
10let s:Path = {}
11let g:NERDTreePath = s:Path
12
13" FUNCTION: Path.AbsolutePathFor(pathStr) {{{1
14function! s:Path.AbsolutePathFor(pathStr)
15 let l:prependWorkingDir = 0
16
17 if nerdtree#runningWindows()
18 let l:prependWorkingDir = a:pathStr !~# '^.:\(\\\|\/\)\?' && a:pathStr !~# '^\(\\\\\|\/\/\)'
19 else
20 let l:prependWorkingDir = a:pathStr !~# '^/'
21 endif
22
23 let l:result = a:pathStr
24
25 if l:prependWorkingDir
26 let l:result = getcwd()
27
28 if l:result[-1:] == nerdtree#slash()
29 let l:result = l:result . a:pathStr
30 else
31 let l:result = l:result . nerdtree#slash() . a:pathStr
32 endif
33 endif
34
35 return l:result
36endfunction
37
38" FUNCTION: Path.bookmarkNames() {{{1
39function! s:Path.bookmarkNames()
40 if !exists('self._bookmarkNames')
41 call self.cacheDisplayString()
42 endif
43 return self._bookmarkNames
44endfunction
45
46" FUNCTION: Path.cacheDisplayString() {{{1
47function! s:Path.cacheDisplayString() abort
48 let self.cachedDisplayString = g:NERDTreeNodeDelimiter . self.getLastPathComponent(1)
49
50 if self.isExecutable
51 let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . '*'
52 endif
53
54 let self._bookmarkNames = []
55 for i in g:NERDTreeBookmark.Bookmarks()
56 if i.path.equals(self)
57 call add(self._bookmarkNames, i.name)
58 endif
59 endfor
60 if !empty(self._bookmarkNames) && g:NERDTreeMarkBookmarks ==# 1
61 let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' {' . join(self._bookmarkNames) . '}'
62 endif
63
64 if self.isSymLink
65 let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' -> ' . self.symLinkDest
66 endif
67
68 if self.isReadOnly
69 let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' ['.g:NERDTreeGlyphReadOnly.']'
70 endif
71endfunction
72
73" FUNCTION: Path.addDelimiter() {{{1
74function! s:Path.addDelimiter(line)
75 if a:line =~# '\(.*' . g:NERDTreeNodeDelimiter . '\)\{2}'
76 return a:line
77 else
78 return a:line . g:NERDTreeNodeDelimiter
79 endif
80endfunction
81
82" FUNCTION: Path.changeToDir() {{{1
83function! s:Path.changeToDir()
84 let dir = self.str({'format': 'Cd'})
85 if self.isDirectory ==# 0
86 let dir = self.getParent().str({'format': 'Cd'})
87 endif
88
89 try
90 if g:NERDTreeUseTCD && exists(':tcd') ==# 2
91 execute 'tcd ' . dir
92 call nerdtree#echo("Tab's CWD is now: " . getcwd())
93 else
94 execute 'cd ' . dir
95 call nerdtree#echo('CWD is now: ' . getcwd())
96 endif
97 catch
98 throw 'NERDTree.PathChangeError: cannot change CWD to ' . dir
99 endtry
100endfunction
101
102" FUNCTION: Path.Create(fullpath) {{{1
103"
104" Factory method.
105"
106" Creates a path object with the given path. The path is also created on the
107" filesystem. If the path already exists, a NERDTree.Path.Exists exception is
108" thrown. If any other errors occur, a NERDTree.Path exception is thrown.
109"
110" Args:
111" fullpath: the full filesystem path to the file/dir to create
112function! s:Path.Create(fullpath)
113 "bail if the a:fullpath already exists
114 if isdirectory(a:fullpath) || filereadable(a:fullpath)
115 throw "NERDTree.CreatePathError: Directory Exists: '" . a:fullpath . "'"
116 endif
117
118 try
119
120 "if it ends with a slash, assume its a dir create it
121 if a:fullpath =~# '\(\\\|\/\)$'
122 "whack the trailing slash off the end if it exists
123 let fullpath = substitute(a:fullpath, '\(\\\|\/\)$', '', '')
124
125 call mkdir(fullpath, 'p')
126
127 "assume its a file and create
128 else
129 call s:Path.createParentDirectories(a:fullpath)
130 call writefile([], a:fullpath)
131 endif
132 catch
133 throw "NERDTree.CreatePathError: Could not create path: '" . a:fullpath . "'"
134 endtry
135
136 return s:Path.New(a:fullpath)
137endfunction
138
139" FUNCTION: Path.copy(dest) {{{1
140"
141" Copies the file/dir represented by this Path to the given location
142"
143" Args:
144" dest: the location to copy this dir/file to
145function! s:Path.copy(dest)
146 if !s:Path.CopyingSupported()
147 throw 'NERDTree.CopyingNotSupportedError: Copying is not supported on this OS'
148 endif
149
150 call s:Path.createParentDirectories(a:dest)
151
152 if exists('g:NERDTreeCopyCmd')
153 let cmd_prefix = g:NERDTreeCopyCmd
154 else
155 let cmd_prefix = (self.isDirectory ? g:NERDTreeCopyDirCmd : g:NERDTreeCopyFileCmd)
156 endif
157
158 let cmd = cmd_prefix . ' ' . shellescape(self.str()) . ' ' . shellescape(a:dest)
159 let success = system(cmd)
160 if v:shell_error !=# 0
161 throw "NERDTree.CopyError: Could not copy '". self.str() ."' to: '" . a:dest . "'"
162 endif
163endfunction
164
165" FUNCTION: Path.CopyingSupported() {{{1
166"
167" returns 1 if copying is supported for this OS
168function! s:Path.CopyingSupported()
169 return exists('g:NERDTreeCopyCmd') || (exists('g:NERDTreeCopyDirCmd') && exists('g:NERDTreeCopyFileCmd'))
170endfunction
171
172" FUNCTION: Path.copyingWillOverwrite(dest) {{{1
173"
174" returns 1 if copy this path to the given location will cause files to
175" overwritten
176"
177" Args:
178" dest: the location this path will be copied to
179function! s:Path.copyingWillOverwrite(dest)
180 if filereadable(a:dest)
181 return 1
182 endif
183
184 if isdirectory(a:dest)
185 let path = s:Path.JoinPathStrings(a:dest, self.getLastPathComponent(0))
186 if filereadable(path)
187 return 1
188 endif
189 endif
190endfunction
191
192" FUNCTION: Path.createParentDirectories(path) {{{1
193"
194" create parent directories for this path if needed
195" without throwing any errors if those directories already exist
196"
197" Args:
198" path: full path of the node whose parent directories may need to be created
199function! s:Path.createParentDirectories(path)
200 let dir_path = fnamemodify(a:path, ':h')
201 if !isdirectory(dir_path)
202 call mkdir(dir_path, 'p')
203 endif
204endfunction
205
206" FUNCTION: Path.delete() {{{1
207"
208" Deletes the file or directory represented by this path.
209"
210" Throws NERDTree.Path.Deletion exceptions
211function! s:Path.delete()
212 if self.isDirectory
213
214 let cmd = g:NERDTreeRemoveDirCmd . self.str({'escape': 1})
215 let success = system(cmd)
216
217 if v:shell_error !=# 0
218 throw "NERDTree.PathDeletionError: Could not delete directory: '" . self.str() . "'"
219 endif
220 else
221 if exists('g:NERDTreeRemoveFileCmd')
222 let cmd = g:NERDTreeRemoveFileCmd . self.str({'escape': 1})
223 let success = system(cmd)
224 else
225 let success = delete(self.str())
226 endif
227
228 if success !=# 0
229 throw "NERDTree.PathDeletionError: Could not delete file: '" . self.str() . "'"
230 endif
231 endif
232
233 "delete all bookmarks for this path
234 for i in self.bookmarkNames()
235 let bookmark = g:NERDTreeBookmark.BookmarkFor(i)
236 call bookmark.delete()
237 endfor
238endfunction
239
240" FUNCTION: Path.displayString() {{{1
241"
242" Returns a string that specifies how the path should be represented as a
243" string
244function! s:Path.displayString()
245 if self.cachedDisplayString ==# ''
246 call self.cacheDisplayString()
247 endif
248
249 return self.cachedDisplayString
250endfunction
251
252" FUNCTION: Path.edit() {{{1
253function! s:Path.edit()
254 let l:bufname = self.str({'format': 'Edit'})
255 if bufname('%') !=# l:bufname
256 exec 'edit ' . l:bufname
257 endif
258endfunction
259
260" FUNCTION: Path.extractDriveLetter(fullpath) {{{1
261"
262" If running windows, cache the drive letter for this path
263function! s:Path.extractDriveLetter(fullpath)
264 if nerdtree#runningWindows()
265 if a:fullpath =~# '^\(\\\\\|\/\/\)'
266 "For network shares, the 'drive' consists of the first two parts of the path, i.e. \\boxname\share
267 let self.drive = substitute(a:fullpath, '^\(\(\\\\\|\/\/\)[^\\\/]*\(\\\|\/\)[^\\\/]*\).*', '\1', '')
268 let self.drive = substitute(self.drive, '/', '\', 'g')
269 else
270 let self.drive = substitute(a:fullpath, '\(^[a-zA-Z]:\).*', '\1', '')
271 endif
272 else
273 let self.drive = ''
274 endif
275
276endfunction
277
278" FUNCTION: Path.exists() {{{1
279" return 1 if this path points to a location that is readable or is a directory
280function! s:Path.exists()
281 let p = self.str()
282 return filereadable(p) || isdirectory(p)
283endfunction
284
285" FUNCTION: Path._escChars() {{{1
286function! s:Path._escChars()
287 if nerdtree#runningWindows()
288 return " `\|\"#%&,?()\*^<>$"
289 endif
290
291 return " \\`\|\"#%&,?()\*^<>[]{}$"
292endfunction
293
294" FUNCTION: Path.getDir() {{{1
295"
296" Returns this path if it is a directory, else this paths parent.
297"
298" Return:
299" a Path object
300function! s:Path.getDir()
301 if self.isDirectory
302 return self
303 else
304 return self.getParent()
305 endif
306endfunction
307
308" FUNCTION: Path.getParent() {{{1
309"
310" Returns a new path object for this paths parent
311"
312" Return:
313" a new Path object
314function! s:Path.getParent()
315 if nerdtree#runningWindows()
316 let path = self.drive . '\' . join(self.pathSegments[0:-2], '\')
317 else
318 let path = '/'. join(self.pathSegments[0:-2], '/')
319 endif
320
321 return s:Path.New(path)
322endfunction
323
324" FUNCTION: Path.getLastPathComponent(dirSlash) {{{1
325"
326" Gets the last part of this path.
327"
328" Args:
329" dirSlash: if 1 then a trailing slash will be added to the returned value for
330" directory nodes.
331function! s:Path.getLastPathComponent(dirSlash)
332 if empty(self.pathSegments)
333 return ''
334 endif
335 let toReturn = self.pathSegments[-1]
336 if a:dirSlash && self.isDirectory
337 let toReturn = toReturn . '/'
338 endif
339 return toReturn
340endfunction
341
342" FUNCTION: Path.getSortOrderIndex() {{{1
343" returns the index of the pattern in g:NERDTreeSortOrder that this path matches
344function! s:Path.getSortOrderIndex()
345 let i = 0
346 while i < len(g:NERDTreeSortOrder)
347 if g:NERDTreeSortOrder[i] !~? '\[\[-\?\(timestamp\|size\|extension\)\]\]' &&
348 \ self.getLastPathComponent(1) =~# g:NERDTreeSortOrder[i]
349 return i
350 endif
351 let i = i + 1
352 endwhile
353
354 return index(g:NERDTreeSortOrder, '*')
355endfunction
356
357" FUNCTION: Path._splitChunks(path) {{{1
358" returns a list of path chunks
359function! s:Path._splitChunks(path)
360 let chunks = split(a:path, '\(\D\+\|\d\+\)\zs')
361 let i = 0
362 while i < len(chunks)
363 "convert number literals to numbers
364 if match(chunks[i], '^\d\+$') ==# 0
365 let chunks[i] = str2nr(chunks[i])
366 endif
367 let i = i + 1
368 endwhile
369 return chunks
370endfunction
371
372" FUNCTION: Path.getSortKey() {{{1
373" returns a key used in compare function for sorting
374function! s:Path.getSortKey()
375 if !exists('self._sortKey') || g:NERDTreeSortOrder !=# g:NERDTreeOldSortOrder
376 " Look for file metadata tags: [[timestamp]], [[extension]], [[size]]
377 let metadata = []
378 for tag in g:NERDTreeSortOrder
379 if tag =~? '\[\[-\?timestamp\]\]'
380 let metadata += [self.isDirectory ? 0 : getftime(self.str()) * (tag =~# '-' ? -1 : 1)]
381 elseif tag =~? '\[\[-\?size\]\]'
382 let metadata += [self.isDirectory ? 0 : getfsize(self.str()) * (tag =~# '-' ? -1 : 1)]
383 elseif tag =~? '\[\[extension\]\]'
384 let extension = matchstr(self.getLastPathComponent(0), '[^.]\+\.\zs[^.]\+$')
385 let metadata += [self.isDirectory ? '' : (extension ==# '' ? nr2char(str2nr('0x10ffff',16)) : extension)]
386 endif
387 endfor
388
389 if g:NERDTreeSortOrder[0] =~# '\[\[.*\]\]'
390 " Apply tags' sorting first if specified first.
391 let self._sortKey = metadata + [self.getSortOrderIndex()]
392 else
393 " Otherwise, do regex grouping first.
394 let self._sortKey = [self.getSortOrderIndex()] + metadata
395 endif
396
397 let path = self.getLastPathComponent(0)
398 if !g:NERDTreeSortHiddenFirst
399 let path = substitute(path, '^[._]', '', '')
400 endif
401 if !g:NERDTreeCaseSensitiveSort
402 let path = tolower(path)
403 endif
404
405 call extend(self._sortKey, (g:NERDTreeNaturalSort ? self._splitChunks(path) : [path]))
406 endif
407 return self._sortKey
408endfunction
409
410" FUNCTION: Path.isHiddenUnder(path) {{{1
411function! s:Path.isHiddenUnder(path)
412
413 if !self.isUnder(a:path)
414 return 0
415 endif
416
417 let l:startIndex = len(a:path.pathSegments)
418 let l:segments = self.pathSegments[l:startIndex : ]
419
420 for l:segment in l:segments
421
422 if l:segment =~# '^\.'
423 return 1
424 endif
425 endfor
426
427 return 0
428endfunction
429
430" FUNCTION: Path.isUnixHiddenFile() {{{1
431" check for unix hidden files
432function! s:Path.isUnixHiddenFile()
433 return self.getLastPathComponent(0) =~# '^\.'
434endfunction
435
436" FUNCTION: Path.isUnixHiddenPath() {{{1
437" check for unix path with hidden components
438function! s:Path.isUnixHiddenPath()
439 if self.getLastPathComponent(0) =~# '^\.'
440 return 1
441 else
442 for segment in self.pathSegments
443 if segment =~# '^\.'
444 return 1
445 endif
446 endfor
447 return 0
448 endif
449endfunction
450
451" FUNCTION: Path.ignore(nerdtree) {{{1
452" returns true if this path should be ignored
453function! s:Path.ignore(nerdtree)
454 "filter out the user specified paths to ignore
455 if a:nerdtree.ui.isIgnoreFilterEnabled()
456 for i in g:NERDTreeIgnore
457 if self._ignorePatternMatches(i)
458 return 1
459 endif
460 endfor
461
462 for l:Callback in g:NERDTree.PathFilters()
463 let l:Callback = type(l:Callback) ==# type(function('tr')) ? l:Callback : function(l:Callback)
464 if l:Callback({'path': self, 'nerdtree': a:nerdtree})
465 return 1
466 endif
467 endfor
468 endif
469
470 "dont show hidden files unless instructed to
471 if !a:nerdtree.ui.getShowHidden() && self.isUnixHiddenFile()
472 return 1
473 endif
474
475 if a:nerdtree.ui.getShowFiles() ==# 0 && self.isDirectory ==# 0
476 return 1
477 endif
478
479 return 0
480endfunction
481
482" FUNCTION: Path._ignorePatternMatches(pattern) {{{1
483" returns true if this path matches the given ignore pattern
484function! s:Path._ignorePatternMatches(pattern)
485 let pat = a:pattern
486 if strpart(pat,len(pat)-8) ==# '[[path]]'
487 let pat = strpart(pat,0, len(pat)-8)
488 return self.str() =~# pat
489 elseif strpart(pat,len(pat)-7) ==# '[[dir]]'
490 if !self.isDirectory
491 return 0
492 endif
493 let pat = strpart(pat,0, len(pat)-7)
494 elseif strpart(pat,len(pat)-8) ==# '[[file]]'
495 if self.isDirectory
496 return 0
497 endif
498 let pat = strpart(pat,0, len(pat)-8)
499 endif
500
501 return self.getLastPathComponent(0) =~# pat
502endfunction
503
504" FUNCTION: Path.isAncestor(path) {{{1
505" return 1 if this path is somewhere above the given path in the filesystem.
506"
507" a:path should be a dir
508function! s:Path.isAncestor(child)
509 return a:child.isUnder(self)
510endfunction
511
512" FUNCTION: Path.isUnder(path) {{{1
513" return 1 if this path is somewhere under the given path in the filesystem.
514function! s:Path.isUnder(parent)
515 if a:parent.isDirectory ==# 0
516 return 0
517 endif
518 if nerdtree#runningWindows() && a:parent.drive !=# self.drive
519 return 0
520 endif
521 let l:this_count = len(self.pathSegments)
522 if l:this_count ==# 0
523 return 0
524 endif
525 let l:that_count = len(a:parent.pathSegments)
526 if l:that_count ==# 0
527 return 1
528 endif
529 if l:that_count >= l:this_count
530 return 0
531 endif
532 for i in range(0, l:that_count-1)
533 if self.pathSegments[i] !=# a:parent.pathSegments[i]
534 return 0
535 endif
536 endfor
537 return 1
538endfunction
539
540" FUNCTION: Path.JoinPathStrings(...) {{{1
541function! s:Path.JoinPathStrings(...)
542 let components = []
543 for i in a:000
544 let components = extend(components, split(i, '/'))
545 endfor
546 return '/' . join(components, '/')
547endfunction
548
549" FUNCTION: Path.equals() {{{1
550"
551" Determines whether 2 path objects are "equal".
552" They are equal if the paths they represent are the same
553"
554" Args:
555" path: the other path obj to compare this with
556function! s:Path.equals(path)
557 if nerdtree#runningWindows()
558 return self.str() ==? a:path.str()
559 else
560 return self.str() ==# a:path.str()
561 endif
562endfunction
563
564" FUNCTION: Path.New(pathStr) {{{1
565function! s:Path.New(pathStr)
566 let l:newPath = copy(self)
567
568 call l:newPath.readInfoFromDisk(s:Path.AbsolutePathFor(a:pathStr))
569
570 let l:newPath.cachedDisplayString = ''
571 let l:newPath.flagSet = g:NERDTreeFlagSet.New()
572
573 return l:newPath
574endfunction
575
576" FUNCTION: Path.Resolve() {{{1
577" Invoke the vim resolve() function and return the result
578" This is necessary because in some versions of vim resolve() removes trailing
579" slashes while in other versions it doesn't. This always removes the trailing
580" slash
581function! s:Path.Resolve(path)
582 let tmp = resolve(a:path)
583 return tmp =~# '.\+/$' ? substitute(tmp, '/$', '', '') : tmp
584endfunction
585
586" FUNCTION: Path.readInfoFromDisk(fullpath) {{{1
587"
588"
589" Throws NERDTree.Path.InvalidArguments exception.
590function! s:Path.readInfoFromDisk(fullpath)
591 call self.extractDriveLetter(a:fullpath)
592
593 let fullpath = s:Path.WinToUnixPath(a:fullpath)
594
595 if getftype(fullpath) ==# 'fifo'
596 throw 'NERDTree.InvalidFiletypeError: Cant handle FIFO files: ' . a:fullpath
597 endif
598
599 let self.pathSegments = filter(split(fullpath, '/'), '!empty(v:val)')
600
601 let self.isReadOnly = 0
602 if isdirectory(a:fullpath)
603 let self.isDirectory = 1
604 elseif filereadable(a:fullpath)
605 let self.isDirectory = 0
606 let self.isReadOnly = filewritable(a:fullpath) ==# 0
607 else
608 throw 'NERDTree.InvalidArgumentsError: Invalid path = ' . a:fullpath
609 endif
610
611 let self.isExecutable = 0
612 if !self.isDirectory
613 let self.isExecutable = getfperm(a:fullpath) =~# 'x'
614 endif
615
616 "grab the last part of the path (minus the trailing slash)
617 let lastPathComponent = self.getLastPathComponent(0)
618
619 "get the path to the new node with the parent dir fully resolved
620 let hardPath = s:Path.Resolve(self.strTrunk()) . '/' . lastPathComponent
621
622 "if the last part of the path is a symlink then flag it as such
623 let self.isSymLink = (s:Path.Resolve(hardPath) !=# hardPath)
624 if self.isSymLink
625 let self.symLinkDest = s:Path.Resolve(fullpath)
626
627 "if the link is a dir then slap a / on the end of its dest
628 if isdirectory(self.symLinkDest)
629
630 "we always wanna treat MS windows shortcuts as files for
631 "simplicity
632 if hardPath !~# '\.lnk$'
633
634 let self.symLinkDest = self.symLinkDest . '/'
635 endif
636 endif
637 endif
638endfunction
639
640" FUNCTION: Path.refresh(nerdtree) {{{1
641function! s:Path.refresh(nerdtree)
642 call self.readInfoFromDisk(self.str())
643 call g:NERDTreePathNotifier.NotifyListeners('refresh', self, a:nerdtree, {})
644 call self.cacheDisplayString()
645endfunction
646
647" FUNCTION: Path.refreshFlags(nerdtree) {{{1
648function! s:Path.refreshFlags(nerdtree)
649 call g:NERDTreePathNotifier.NotifyListeners('refreshFlags', self, a:nerdtree, {})
650 call self.cacheDisplayString()
651endfunction
652
653" FUNCTION: Path.rename() {{{1
654"
655" Renames this node on the filesystem
656function! s:Path.rename(newPath)
657 if a:newPath ==# ''
658 throw 'NERDTree.InvalidArgumentsError: Invalid newPath for renaming = '. a:newPath
659 endif
660
661 call s:Path.createParentDirectories(a:newPath)
662
663 let success = rename(self.str(), a:newPath)
664 if success !=# 0
665 throw "NERDTree.PathRenameError: Could not rename: '" . self.str() . "'" . 'to:' . a:newPath
666 endif
667 call self.readInfoFromDisk(a:newPath)
668
669 for i in self.bookmarkNames()
670 let b = g:NERDTreeBookmark.BookmarkFor(i)
671 call b.setPath(copy(self))
672 endfor
673 call g:NERDTreeBookmark.Write()
674endfunction
675
676" FUNCTION: Path.str() {{{1
677" Return a string representation of this Path object.
678"
679" Args:
680" This function takes a single dictionary (optional) with keys and values that
681" specify how the returned pathname should be formatted.
682"
683" The dictionary may have the following keys:
684" 'format'
685" 'escape'
686" 'truncateTo'
687"
688" The 'format' key may have a value of:
689" 'Cd' - a string to be used with ":cd" and similar commands
690" 'Edit' - a string to be used with ":edit" and similar commands
691" 'UI' - a string to be displayed in the NERDTree user interface
692"
693" The 'escape' key, if specified, will cause the output to be escaped with
694" Vim's internal "shellescape()" function.
695"
696" The 'truncateTo' key shortens the length of the path to that given by the
697" value associated with 'truncateTo'. A '<' is prepended.
698function! s:Path.str(...)
699 let options = a:0 ? a:1 : {}
700 let toReturn = ''
701
702 if has_key(options, 'format')
703 let format = options['format']
704 if has_key(self, '_strFor' . format)
705 exec 'let toReturn = self._strFor' . format . '()'
706 else
707 throw 'NERDTree.UnknownFormatError: unknown format "'. format .'"'
708 endif
709 else
710 let toReturn = self._str()
711 endif
712
713 if nerdtree#has_opt(options, 'escape')
714 let toReturn = shellescape(toReturn)
715 endif
716
717 if has_key(options, 'truncateTo')
718 let limit = options['truncateTo']
719 if strdisplaywidth(toReturn) > limit-1
720 while strdisplaywidth(toReturn) > limit-1 && strchars(toReturn) > 0
721 let toReturn = substitute(toReturn, '^.', '', '')
722 endwhile
723 if len(split(toReturn, '/')) > 1
724 let toReturn = '</' . join(split(toReturn, '/')[1:], '/') . '/'
725 else
726 let toReturn = '<' . toReturn
727 endif
728 endif
729 endif
730
731 return toReturn
732endfunction
733
734" FUNCTION: Path._strForUI() {{{1
735function! s:Path._strForUI()
736 let toReturn = '/' . join(self.pathSegments, '/')
737 if self.isDirectory && toReturn !=# '/'
738 let toReturn = toReturn . '/'
739 endif
740 return toReturn
741endfunction
742
743" FUNCTION: Path._strForCd() {{{1
744" Return a string representation of this Path that is suitable for use as an
745" argument to Vim's internal ":cd" command.
746function! s:Path._strForCd()
747 return fnameescape(self.str())
748endfunction
749
750" FUNCTION: Path._strForEdit() {{{1
751" Return a string representation of this Path that is suitable for use as an
752" argument to Vim's internal ":edit" command.
753function! s:Path._strForEdit()
754
755 " Make the path relative to the current working directory, if possible.
756 let l:result = fnamemodify(self.str(), ':.')
757
758 " On Windows, the drive letter may be removed by "fnamemodify()". Add it
759 " back, if necessary.
760 if nerdtree#runningWindows() && l:result[0] == nerdtree#slash()
761 let l:result = self.drive . l:result
762 endif
763
764 let l:result = fnameescape(l:result)
765
766 if empty(l:result)
767 let l:result = '.'
768 endif
769
770 return l:result
771endfunction
772
773" FUNCTION: Path._strForGlob() {{{1
774function! s:Path._strForGlob()
775 let lead = nerdtree#slash()
776
777 "if we are running windows then slap a drive letter on the front
778 if nerdtree#runningWindows()
779 let lead = self.drive . '\'
780 endif
781
782 let toReturn = lead . join(self.pathSegments, nerdtree#slash())
783
784 if !nerdtree#runningWindows()
785 let toReturn = escape(toReturn, self._escChars())
786 endif
787 return toReturn
788endfunction
789
790" FUNCTION: Path._str() {{{1
791" Return the absolute pathname associated with this Path object. The pathname
792" returned is appropriate for the underlying file system.
793function! s:Path._str()
794 let l:separator = nerdtree#slash()
795 let l:leader = l:separator
796
797 if nerdtree#runningWindows()
798 let l:leader = self.drive . l:separator
799 endif
800
801 return l:leader . join(self.pathSegments, l:separator)
802endfunction
803
804" FUNCTION: Path.strTrunk() {{{1
805" Gets the path without the last segment on the end.
806function! s:Path.strTrunk()
807 return self.drive . '/' . join(self.pathSegments[0:-2], '/')
808endfunction
809
810" FUNCTION: Path.tabnr() {{{1
811" return the number of the first tab that is displaying this file
812"
813" return 0 if no tab was found
814function! s:Path.tabnr()
815 let str = self.str()
816 for t in range(tabpagenr('$'))
817 for b in tabpagebuflist(t+1)
818 if str ==# expand('#' . b . ':p')
819 return t+1
820 endif
821 endfor
822 endfor
823 return 0
824endfunction
825
826" FUNCTION: Path.WinToUnixPath(pathstr){{{1
827" Takes in a windows path and returns the unix equiv
828"
829" A class level method
830"
831" Args:
832" pathstr: the windows path to convert
833function! s:Path.WinToUnixPath(pathstr)
834 if !nerdtree#runningWindows()
835 return a:pathstr
836 endif
837
838 let toReturn = a:pathstr
839
840 "remove the x:\ of the front
841 let toReturn = substitute(toReturn, '^.*:\(\\\|/\)\?', '/', '')
842
843 "remove the \\ network share from the front
844 let toReturn = substitute(toReturn, '^\(\\\\\|\/\/\)[^\\\/]*\(\\\|\/\)[^\\\/]*\(\\\|\/\)\?', '/', '')
845
846 "convert all \ chars to /
847 let toReturn = substitute(toReturn, '\', '/', 'g')
848
849 return toReturn
850endfunction
851
852" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/.vim/pack/vendor/start/nerdtree/lib/nerdtree/tree_dir_node.vim b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/tree_dir_node.vim
new file mode 100644
index 0000000..f5f7682
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/tree_dir_node.vim
@@ -0,0 +1,706 @@
1" ============================================================================
2" CLASS: TreeDirNode
3"
4" A subclass of NERDTreeFileNode.
5"
6" The 'composite' part of the file/dir composite.
7" ============================================================================
8
9
10let s:TreeDirNode = copy(g:NERDTreeFileNode)
11let g:NERDTreeDirNode = s:TreeDirNode
12
13" FUNCTION: TreeDirNode.AbsoluteTreeRoot(){{{1
14" Class method that returns the highest cached ancestor of the current root.
15function! s:TreeDirNode.AbsoluteTreeRoot()
16 let currentNode = b:NERDTree.root
17 while currentNode.parent !=# {}
18 let currentNode = currentNode.parent
19 endwhile
20 return currentNode
21endfunction
22
23" FUNCTION: TreeDirNode.activate([options]) {{{1
24function! s:TreeDirNode.activate(...)
25 let l:options = (a:0 > 0) ? a:1 : {}
26
27 call self.toggleOpen(l:options)
28
29 " Note that we only re-render the NERDTree for this node if we did NOT
30 " create a new node and render it in a new window or tab. In the latter
31 " case, rendering the NERDTree for this node could overwrite the text of
32 " the new NERDTree!
33 if !has_key(l:options, 'where') || empty(l:options['where'])
34 call self.getNerdtree().render()
35 call self.putCursorHere(0, 0)
36 endif
37endfunction
38
39" FUNCTION: TreeDirNode.addChild(treenode, inOrder) {{{1
40" Adds the given treenode to the list of children for this node
41"
42" Args:
43" -treenode: the node to add
44" -inOrder: 1 if the new node should be inserted in sorted order
45function! s:TreeDirNode.addChild(treenode, inOrder)
46 call add(self.children, a:treenode)
47 let a:treenode.parent = self
48
49 if a:inOrder
50 call self.sortChildren()
51 endif
52endfunction
53
54" FUNCTION: TreeDirNode.close() {{{1
55" Mark this TreeDirNode as closed.
56function! s:TreeDirNode.close()
57
58 " Close all directories in this directory node's cascade. This is
59 " necessary to ensure consistency when cascades are rendered.
60 for l:dirNode in self.getCascade()
61 let l:dirNode.isOpen = 0
62 endfor
63endfunction
64
65" FUNCTION: TreeDirNode.closeChildren() {{{1
66" Recursively close any directory nodes that are descendants of this node.
67function! s:TreeDirNode.closeChildren()
68 for l:child in self.children
69 if l:child.path.isDirectory
70 call l:child.close()
71 call l:child.closeChildren()
72 endif
73 endfor
74endfunction
75
76" FUNCTION: TreeDirNode.createChild(path, inOrder) {{{1
77" Instantiates a new child node for this node with the given path. The new
78" nodes parent is set to this node.
79"
80" Args:
81" path: a Path object that this node will represent/contain
82" inOrder: 1 if the new node should be inserted in sorted order
83"
84" Returns:
85" the newly created node
86function! s:TreeDirNode.createChild(path, inOrder)
87 let newTreeNode = g:NERDTreeFileNode.New(a:path, self.getNerdtree())
88 call self.addChild(newTreeNode, a:inOrder)
89 return newTreeNode
90endfunction
91
92" FUNCTION: TreeDirNode.displayString() {{{1
93" Assemble and return a string that can represent this TreeDirNode object in
94" the NERDTree window.
95function! s:TreeDirNode.displayString()
96 let l:result = ''
97
98 " Build a label that identifies this TreeDirNode.
99 let l:label = ''
100 let l:cascade = self.getCascade()
101 for l:dirNode in l:cascade
102 let l:next = l:dirNode.path.displayString()
103 let l:label .= l:label ==# '' ? l:next : substitute(l:next,'^.','','')
104 endfor
105
106 " Select the appropriate open/closed status indicator symbol.
107 let l:symbol = (l:cascade[-1].isOpen ? g:NERDTreeDirArrowCollapsible : g:NERDTreeDirArrowExpandable )
108 let l:symbol .= (g:NERDTreeDirArrowExpandable ==# '' ? '' : ' ')
109 let l:flags = l:cascade[-1].path.flagSet.renderToString()
110
111 return l:symbol . l:flags . l:label
112endfunction
113
114" FUNCTION: TreeDirNode.findNode(path) {{{1
115" Will find one of the children (recursively) that has the given path
116"
117" Args:
118" path: a path object
119unlet s:TreeDirNode.findNode
120function! s:TreeDirNode.findNode(path)
121 if a:path.equals(self.path)
122 return self
123 endif
124 if stridx(a:path.str(), self.path.str(), 0) ==# -1
125 return {}
126 endif
127
128 if self.path.isDirectory
129 for i in self.children
130 let retVal = i.findNode(a:path)
131 if retVal !=# {}
132 return retVal
133 endif
134 endfor
135 endif
136 return {}
137endfunction
138
139" FUNCTION: TreeDirNode.getCascade() {{{1
140" Return an array of dir nodes (starting from self) that can be cascade opened.
141function! s:TreeDirNode.getCascade()
142 if !self.isCascadable()
143 return [self]
144 endif
145
146 let vc = self.getVisibleChildren()
147 let visChild = vc[0]
148
149 return [self] + visChild.getCascade()
150endfunction
151
152" FUNCTION: TreeDirNode.getCascadeRoot() {{{1
153" Return the first directory node in the cascade in which this directory node
154" is rendered.
155function! s:TreeDirNode.getCascadeRoot()
156
157 " Don't search above the current NERDTree root node.
158 if self.isRoot()
159 return self
160 endif
161
162 let l:cascadeRoot = self
163 let l:parent = self.parent
164
165 while !empty(l:parent) && !l:parent.isRoot()
166
167 if index(l:parent.getCascade(), self) ==# -1
168 break
169 endif
170
171 let l:cascadeRoot = l:parent
172 let l:parent = l:parent.parent
173 endwhile
174
175 return l:cascadeRoot
176endfunction
177
178" FUNCTION: TreeDirNode.getChildCount() {{{1
179" Returns the number of children this node has
180function! s:TreeDirNode.getChildCount()
181 return len(self.children)
182endfunction
183
184" FUNCTION: TreeDirNode.getChild(path) {{{1
185" Returns child node of this node that has the given path or {} if no such node
186" exists.
187"
188" This function doesnt not recurse into child dir nodes
189"
190" Args:
191" path: a path object
192function! s:TreeDirNode.getChild(path)
193 if stridx(a:path.str(), self.path.str(), 0) ==# -1
194 return {}
195 endif
196
197 let index = self.getChildIndex(a:path)
198 if index ==# -1
199 return {}
200 else
201 return self.children[index]
202 endif
203
204endfunction
205
206" FUNCTION: TreeDirNode.getChildByIndex(indx, visible) {{{1
207" returns the child at the given index
208"
209" Args:
210" indx: the index to get the child from
211" visible: 1 if only the visible children array should be used, 0 if all the
212" children should be searched.
213function! s:TreeDirNode.getChildByIndex(indx, visible)
214 let array_to_search = a:visible? self.getVisibleChildren() : self.children
215 if a:indx > len(array_to_search)
216 throw 'NERDTree.InvalidArgumentsError: Index is out of bounds.'
217 endif
218 return array_to_search[a:indx]
219endfunction
220
221" FUNCTION: TreeDirNode.getChildIndex(path) {{{1
222" Returns the index of the child node of this node that has the given path or
223" -1 if no such node exists.
224"
225" This function doesnt not recurse into child dir nodes
226"
227" Args:
228" path: a path object
229function! s:TreeDirNode.getChildIndex(path)
230 if stridx(a:path.str(), self.path.str(), 0) ==# -1
231 return -1
232 endif
233
234 "do a binary search for the child
235 let a = 0
236 let z = self.getChildCount()
237 while a < z
238 let mid = (a+z)/2
239 let diff = nerdtree#compareNodePaths(a:path, self.children[mid].path)
240
241 if diff ==# -1
242 let z = mid
243 elseif diff ==# 1
244 let a = mid+1
245 else
246 return mid
247 endif
248 endwhile
249 return -1
250endfunction
251
252" FUNCTION: TreeDirNode.getDirChildren() {{{1
253" Return a list of all child nodes from 'self.children' that are of type
254" TreeDirNode. This function supports http://github.com/scrooloose/nerdtree-project-plugin.git.
255function! s:TreeDirNode.getDirChildren()
256 return filter(copy(self.children), 'v:val.path.isDirectory ==# 1')
257endfunction
258
259" FUNCTION: TreeDirNode._glob(pattern, all) {{{1
260" Return a list of strings naming the descendants of the directory in this
261" TreeDirNode object that match the specified glob pattern.
262"
263" Args:
264" pattern: (string) the glob pattern to apply
265" all: (0 or 1) if 1, include '.' and '..' if they match 'pattern'; if 0,
266" always exclude them
267"
268" Note: If the pathnames in the result list are below the working directory,
269" they are returned as pathnames relative to that directory. This is because
270" this function, internally, attempts to obey 'wildignore' rules that use
271" relative paths.
272function! s:TreeDirNode._glob(pattern, all)
273
274 " Construct a path specification such that globpath() will return
275 " relative pathnames, if possible.
276 if self.path.str() ==# getcwd()
277 let l:pathSpec = ','
278 else
279 let l:pathSpec = escape(fnamemodify(self.path.str({'format': 'Glob'}), ':.'), ',')
280
281 " On Windows, the drive letter may be removed by "fnamemodify()".
282 if nerdtree#runningWindows() && l:pathSpec[0] == nerdtree#slash()
283 let l:pathSpec = self.path.drive . l:pathSpec
284 endif
285 endif
286
287 let l:globList = []
288
289 " See ':h version7.txt' and ':h version8.txt' for details on the
290 " development of the glob() and globpath() functions.
291 if v:version > 704 || (v:version ==# 704 && has('patch654'))
292 let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1, 0)
293 elseif v:version ==# 704 && has('patch279')
294 let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1)
295 elseif v:version > 702 || (v:version ==# 702 && has('patch051'))
296 let l:globString = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore)
297 let l:globList = split(l:globString, "\n")
298 else
299 let l:globString = globpath(l:pathSpec, a:pattern)
300 let l:globList = split(l:globString, "\n")
301 endif
302
303 " If a:all is false, filter '.' and '..' from the output.
304 if !a:all
305 let l:toRemove = []
306
307 for l:file in l:globList
308 let l:tail = fnamemodify(l:file, ':t')
309
310 " If l:file has a trailing slash, then its :tail will be ''. Use
311 " :h to drop the slash and the empty string after it; then use :t
312 " to get the directory name.
313 if l:tail ==# ''
314 let l:tail = fnamemodify(l:file, ':h:t')
315 endif
316
317 if l:tail ==# '.' || l:tail ==# '..'
318 call add(l:toRemove, l:file)
319 if len(l:toRemove) ==# 2
320 break
321 endif
322 endif
323 endfor
324
325 for l:file in l:toRemove
326 call remove(l:globList, index(l:globList, l:file))
327 endfor
328 endif
329
330 return l:globList
331endfunction
332
333" FUNCTION: TreeDirNode.GetSelected() {{{1
334" Returns the current node if it is a dir node, or else returns the current
335" nodes parent
336unlet s:TreeDirNode.GetSelected
337function! s:TreeDirNode.GetSelected()
338 let currentDir = g:NERDTreeFileNode.GetSelected()
339 if currentDir !=# {} && !currentDir.isRoot()
340 if currentDir.path.isDirectory ==# 0
341 let currentDir = currentDir.parent
342 endif
343 endif
344 return currentDir
345endfunction
346
347" FUNCTION: TreeDirNode.getVisibleChildCount() {{{1
348" Returns the number of visible children this node has
349function! s:TreeDirNode.getVisibleChildCount()
350 return len(self.getVisibleChildren())
351endfunction
352
353" FUNCTION: TreeDirNode.getVisibleChildren() {{{1
354" Returns a list of children to display for this node, in the correct order
355"
356" Return:
357" an array of treenodes
358function! s:TreeDirNode.getVisibleChildren()
359 let toReturn = []
360 for i in self.children
361 if i.path.ignore(self.getNerdtree()) ==# 0
362 call add(toReturn, i)
363 endif
364 endfor
365 return toReturn
366endfunction
367
368" FUNCTION: TreeDirNode.hasVisibleChildren() {{{1
369" returns 1 if this node has any childre, 0 otherwise..
370function! s:TreeDirNode.hasVisibleChildren()
371 return self.getVisibleChildCount() !=# 0
372endfunction
373
374" FUNCTION: TreeDirNode.isCascadable() {{{1
375" true if this dir has only one visible child that is also a dir
376" false if this dir is bookmarked or symlinked. Why? Two reasons:
377" 1. If cascaded, we don't know which dir is bookmarked or is a symlink.
378" 2. If the parent is a symlink or is bookmarked, you end up with unparsable
379" text, and NERDTree cannot get the path of any child node.
380" Also, return false if this directory is the tree root, which should never be
381" part of a cascade.
382function! s:TreeDirNode.isCascadable()
383 if g:NERDTreeCascadeSingleChildDir ==# 0
384 return 0
385 endif
386
387 if self.isRoot()
388 return 0
389 endif
390
391 if self.path.isSymLink
392 return 0
393 endif
394
395 for i in g:NERDTreeBookmark.Bookmarks()
396 if i.path.equals(self.path)
397 return 0
398 endif
399 endfor
400
401 let c = self.getVisibleChildren()
402 return len(c) ==# 1 && c[0].path.isDirectory
403endfunction
404
405" FUNCTION: TreeDirNode._initChildren() {{{1
406" Removes all childen from this node and re-reads them
407"
408" Args:
409" silent: 1 if the function should not echo any 'please wait' messages for
410" large directories
411"
412" Return: the number of child nodes read
413function! s:TreeDirNode._initChildren(silent)
414 "remove all the current child nodes
415 let self.children = []
416
417 let files = self._glob('*', 1) + self._glob('.*', 0)
418
419 if !a:silent && len(files) > g:NERDTreeNotificationThreshold
420 call nerdtree#echo('Please wait, caching a large dir ...')
421 endif
422
423 let invalidFilesFound = 0
424 for i in files
425 try
426 let path = g:NERDTreePath.New(i)
427 call self.createChild(path, 0)
428 call g:NERDTreePathNotifier.NotifyListeners('init', path, self.getNerdtree(), {})
429 catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
430 let invalidFilesFound += 1
431 endtry
432 endfor
433
434 let g:NERDTreeOldSortOrder = g:NERDTreeSortOrder
435 call self.sortChildren()
436
437 call nerdtree#echo('')
438
439 if invalidFilesFound
440 call nerdtree#echoWarning(invalidFilesFound . ' file(s) could not be loaded into the NERD tree')
441 endif
442 return self.getChildCount()
443endfunction
444
445" FUNCTION: TreeDirNode.New(path, nerdtree) {{{1
446" Return a new TreeDirNode object with the given path and parent.
447"
448" Args:
449" path: dir that the node represents
450" nerdtree: the tree the node belongs to
451function! s:TreeDirNode.New(path, nerdtree)
452 if a:path.isDirectory !=# 1
453 throw 'NERDTree.InvalidArgumentsError: A TreeDirNode object must be instantiated with a directory Path object.'
454 endif
455
456 let newTreeNode = copy(self)
457 let newTreeNode.path = a:path
458
459 let newTreeNode.isOpen = 0
460 let newTreeNode.children = []
461
462 let newTreeNode.parent = {}
463 let newTreeNode._nerdtree = a:nerdtree
464
465 return newTreeNode
466endfunction
467
468" FUNCTION: TreeDirNode.open([options]) {{{1
469" Open this directory node in the current tree or elsewhere if special options
470" are provided. Return 0 if options were processed. Otherwise, return the
471" number of new cached nodes.
472function! s:TreeDirNode.open(...)
473 let l:options = a:0 ? a:1 : {}
474
475 " If special options were specified, process them and return.
476 if has_key(l:options, 'where') && !empty(l:options['where'])
477 let l:opener = g:NERDTreeOpener.New(self.path, l:options)
478 call l:opener.open(self)
479 return 0
480 endif
481
482 " Open any ancestors of this node that render within the same cascade.
483 let l:parent = self.parent
484 while !empty(l:parent) && !l:parent.isRoot()
485 if index(l:parent.getCascade(), self) >= 0
486 let l:parent.isOpen = 1
487 let l:parent = l:parent.parent
488 else
489 break
490 endif
491 endwhile
492
493 let self.isOpen = 1
494
495 let l:numChildrenCached = 0
496 if empty(self.children)
497 let l:numChildrenCached = self._initChildren(0)
498 endif
499
500 return l:numChildrenCached
501endfunction
502
503" FUNCTION: TreeDirNode.openAlong([opts]) {{{1
504" recursive open the dir if it has only one directory child.
505"
506" return the level of opened directories.
507function! s:TreeDirNode.openAlong(...)
508 let opts = a:0 ? a:1 : {}
509 let level = 0
510
511 let node = self
512 while node.path.isDirectory
513 call node.open(opts)
514 let level += 1
515 if node.getVisibleChildCount() ==# 1
516 let node = node.getChildByIndex(0, 1)
517 else
518 break
519 endif
520 endwhile
521 return level
522endfunction
523
524" FUNCTION: TreeDirNode.openExplorer() {{{1
525" Open an explorer window for this node in the previous window. The explorer
526" can be a NERDTree window or a netrw window.
527function! s:TreeDirNode.openExplorer()
528 execute 'wincmd p'
529 execute 'edit '.self.path.str({'format':'Edit'})
530endfunction
531
532" FUNCTION: TreeDirNode.openInNewTab(options) {{{1
533unlet s:TreeDirNode.openInNewTab
534function! s:TreeDirNode.openInNewTab(options)
535 call nerdtree#deprecated('TreeDirNode.openInNewTab', 'is deprecated, use open() instead')
536 call self.open({'where': 't'})
537endfunction
538
539" FUNCTION: TreeDirNode._openInNewTab() {{{1
540function! s:TreeDirNode._openInNewTab()
541 tabnew
542 call g:NERDTreeCreator.CreateTabTree(self.path.str())
543endfunction
544
545" FUNCTION: TreeDirNode.openRecursively() {{{1
546" Open this directory node and any descendant directory nodes whose pathnames
547" are not ignored.
548function! s:TreeDirNode.openRecursively()
549 silent call self.open()
550
551 for l:child in self.children
552 if l:child.path.isDirectory && !l:child.path.ignore(l:child.getNerdtree())
553 call l:child.openRecursively()
554 endif
555 endfor
556endfunction
557
558" FUNCTION: TreeDirNode.refresh() {{{1
559function! s:TreeDirNode.refresh()
560 call self.path.refresh(self.getNerdtree())
561
562 "if this node was ever opened, refresh its children
563 if self.isOpen || !empty(self.children)
564 let files = self._glob('*', 1) + self._glob('.*', 0)
565 let newChildNodes = []
566 let invalidFilesFound = 0
567 for i in files
568 try
569 "create a new path and see if it exists in this nodes children
570 let path = g:NERDTreePath.New(i)
571 let newNode = self.getChild(path)
572 if newNode !=# {}
573 call newNode.refresh()
574 call add(newChildNodes, newNode)
575
576 "the node doesnt exist so create it
577 else
578 let newNode = g:NERDTreeFileNode.New(path, self.getNerdtree())
579 let newNode.parent = self
580 call add(newChildNodes, newNode)
581 endif
582 catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
583 let invalidFilesFound = 1
584 endtry
585 endfor
586
587 "swap this nodes children out for the children we just read/refreshed
588 let self.children = newChildNodes
589 call self.sortChildren()
590
591 if invalidFilesFound
592 call nerdtree#echoWarning('some files could not be loaded into the NERD tree')
593 endif
594 endif
595endfunction
596
597" FUNCTION: TreeDirNode.refreshFlags() {{{1
598unlet s:TreeDirNode.refreshFlags
599function! s:TreeDirNode.refreshFlags()
600 call self.path.refreshFlags(self.getNerdtree())
601 for i in self.children
602 call i.refreshFlags()
603 endfor
604endfunction
605
606" FUNCTION: TreeDirNode.refreshDirFlags() {{{1
607function! s:TreeDirNode.refreshDirFlags()
608 call self.path.refreshFlags(self.getNerdtree())
609endfunction
610
611" FUNCTION: TreeDirNode.reveal(path) {{{1
612" reveal the given path, i.e. cache and open all treenodes needed to display it
613" in the UI
614" Returns the revealed node
615function! s:TreeDirNode.reveal(path, ...)
616 let opts = a:0 ? a:1 : {}
617
618 if !a:path.isUnder(self.path)
619 throw 'NERDTree.InvalidArgumentsError: ' . a:path.str() . ' should be under ' . self.path.str()
620 endif
621
622 call self.open()
623
624 if self.path.equals(a:path.getParent())
625 let n = self.findNode(a:path)
626 " We may be looking for a newly-saved file that isn't in the tree yet.
627 if n ==# {}
628 call self.refresh()
629 let n = self.findNode(a:path)
630 endif
631 if has_key(opts, 'open')
632 call n.open()
633 endif
634 return n
635 endif
636
637 let p = a:path
638 while !p.getParent().equals(self.path)
639 let p = p.getParent()
640 endwhile
641
642 let n = self.findNode(p)
643 return n.reveal(a:path, opts)
644endfunction
645
646" FUNCTION: TreeDirNode.removeChild(treenode) {{{1
647" Remove the given treenode from self.children.
648" Throws NERDTree.ChildNotFoundError if the node is not found.
649"
650" Args:
651" treenode: the node object to remove
652function! s:TreeDirNode.removeChild(treenode)
653 for i in range(0, self.getChildCount()-1)
654 if self.children[i].equals(a:treenode)
655 call remove(self.children, i)
656 return
657 endif
658 endfor
659
660 throw 'NERDTree.ChildNotFoundError: child node was not found'
661endfunction
662
663" FUNCTION: TreeDirNode.sortChildren() {{{1
664" Sort self.children by alphabetical order and directory priority.
665function! s:TreeDirNode.sortChildren()
666 if count(g:NERDTreeSortOrder, '*') < 1
667 call add(g:NERDTreeSortOrder, '*')
668 endif
669 let CompareFunc = function('nerdtree#compareNodes')
670 call sort(self.children, CompareFunc)
671 let g:NERDTreeOldSortOrder = g:NERDTreeSortOrder
672endfunction
673
674" FUNCTION: TreeDirNode.toggleOpen([options]) {{{1
675" Opens this directory if it is closed and vice versa
676function! s:TreeDirNode.toggleOpen(...)
677 let opts = a:0 ? a:1 : {}
678 if self.isOpen ==# 1
679 call self.close()
680 else
681 if g:NERDTreeCascadeOpenSingleChildDir ==# 0
682 call self.open(opts)
683 else
684 call self.openAlong(opts)
685 endif
686 endif
687endfunction
688
689" FUNCTION: TreeDirNode.transplantChild(newNode) {{{1
690" Replaces the child of this with the given node (where the child node's full
691" path matches a:newNode's fullpath). The search for the matching node is
692" non-recursive
693"
694" Arg:
695" newNode: the node to graft into the tree
696function! s:TreeDirNode.transplantChild(newNode)
697 for i in range(0, self.getChildCount()-1)
698 if self.children[i].equals(a:newNode)
699 let self.children[i] = a:newNode
700 let a:newNode.parent = self
701 break
702 endif
703 endfor
704endfunction
705
706" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/.vim/pack/vendor/start/nerdtree/lib/nerdtree/tree_file_node.vim b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/tree_file_node.vim
new file mode 100644
index 0000000..957b98a
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/tree_file_node.vim
@@ -0,0 +1,349 @@
1" ============================================================================
2" CLASS: TreeFileNode
3"
4" This class is the parent of the TreeDirNode class and is the 'Component'
5" part of the composite design pattern between the NERDTree node classes.
6" ============================================================================
7
8
9let s:TreeFileNode = {}
10let g:NERDTreeFileNode = s:TreeFileNode
11
12" FUNCTION: TreeFileNode.activate(...) {{{1
13function! s:TreeFileNode.activate(...)
14 call self.open(a:0 ? a:1 : {})
15endfunction
16
17" FUNCTION: TreeFileNode.bookmark(name) {{{1
18" bookmark this node with a:name
19function! s:TreeFileNode.bookmark(name)
20
21 " if a bookmark exists with the same name and the node is cached then save
22 " it so we can update its display string
23 let oldMarkedNode = {}
24 try
25 let oldMarkedNode = g:NERDTreeBookmark.GetNodeForName(a:name, 1, self.getNerdtree())
26 catch /^NERDTree.BookmarkNotFoundError/
27 catch /^NERDTree.BookmarkedNodeNotFoundError/
28 endtry
29
30 call g:NERDTreeBookmark.AddBookmark(a:name, self.path)
31 call self.path.cacheDisplayString()
32 call g:NERDTreeBookmark.Write()
33
34 if !empty(oldMarkedNode)
35 call oldMarkedNode.path.cacheDisplayString()
36 endif
37endfunction
38
39" FUNCTION: TreeFileNode.cacheParent() {{{1
40" initializes self.parent if it isnt already
41function! s:TreeFileNode.cacheParent()
42 if empty(self.parent)
43 let parentPath = self.path.getParent()
44 if parentPath.equals(self.path)
45 throw 'NERDTree.CannotCacheParentError: already at root'
46 endif
47 let self.parent = s:TreeFileNode.New(parentPath, self.getNerdtree())
48 endif
49endfunction
50
51" FUNCTION: TreeFileNode.clearBookmarks() {{{1
52function! s:TreeFileNode.clearBookmarks()
53 for i in g:NERDTreeBookmark.Bookmarks()
54 if i.path.equals(self.path)
55 call i.delete()
56 end
57 endfor
58 call self.path.cacheDisplayString()
59endfunction
60
61" FUNCTION: TreeFileNode.copy(dest) {{{1
62function! s:TreeFileNode.copy(dest)
63 call self.path.copy(a:dest)
64 let newPath = g:NERDTreePath.New(a:dest)
65 let parent = self.getNerdtree().root.findNode(newPath.getParent())
66 if !empty(parent)
67 call parent.refresh()
68 return parent.findNode(newPath)
69 else
70 return {}
71 endif
72endfunction
73
74" FUNCTION: TreeFileNode.delete {{{1
75" Removes this node from the tree and calls the Delete method for its path obj
76function! s:TreeFileNode.delete()
77 call self.path.delete()
78 call self.parent.removeChild(self)
79endfunction
80
81" FUNCTION: TreeFileNode.displayString() {{{1
82"
83" Returns a string that specifies how the node should be represented as a
84" string
85"
86" Return:
87" a string that can be used in the view to represent this node
88function! s:TreeFileNode.displayString()
89 return self.path.flagSet.renderToString() . self.path.displayString()
90endfunction
91
92" FUNCTION: TreeFileNode.equals(treenode) {{{1
93"
94" Compares this treenode to the input treenode and returns 1 if they are the
95" same node.
96"
97" Use this method instead of == because sometimes when the treenodes contain
98" many children, vim seg faults when doing ==
99"
100" Args:
101" treenode: the other treenode to compare to
102function! s:TreeFileNode.equals(treenode)
103 return self.path.str() ==# a:treenode.path.str()
104endfunction
105
106" FUNCTION: TreeFileNode.findNode(path) {{{1
107" Returns self if this node.path.Equals the given path.
108" Returns {} if not equal.
109"
110" Args:
111" path: the path object to compare against
112function! s:TreeFileNode.findNode(path)
113 if a:path.equals(self.path)
114 return self
115 endif
116 return {}
117endfunction
118
119" FUNCTION: TreeFileNode.findSibling(direction) {{{1
120" Find the next or previous sibling of this node.
121"
122" Args:
123" direction: 0 for previous, 1 for next
124"
125" Return:
126" The next/previous TreeFileNode object or an empty dictionary if not found.
127function! s:TreeFileNode.findSibling(direction)
128
129 " There can be no siblings if there is no parent.
130 if empty(self.parent)
131 return {}
132 endif
133
134 let l:nodeIndex = self.parent.getChildIndex(self.path)
135
136 if l:nodeIndex == -1
137 return {}
138 endif
139
140 " Get the next index to begin the search.
141 let l:nodeIndex += a:direction ? 1 : -1
142
143 while 0 <= l:nodeIndex && l:nodeIndex < self.parent.getChildCount()
144
145 " Return the next node if it is not ignored.
146 if !self.parent.children[l:nodeIndex].path.ignore(self.getNerdtree())
147 return self.parent.children[l:nodeIndex]
148 endif
149
150 let l:nodeIndex += a:direction ? 1 : -1
151 endwhile
152
153 return {}
154endfunction
155
156" FUNCTION: TreeFileNode.getNerdtree(){{{1
157function! s:TreeFileNode.getNerdtree()
158 return self._nerdtree
159endfunction
160
161" FUNCTION: TreeFileNode.GetRootForTab(){{{1
162" get the root node for this tab
163function! s:TreeFileNode.GetRootForTab()
164 if g:NERDTree.ExistsForTab()
165 return getbufvar(t:NERDTreeBufName, 'NERDTree').root
166 end
167 return {}
168endfunction
169
170" FUNCTION: TreeFileNode.GetSelected() {{{1
171" If the cursor is currently positioned on a tree node, return the node.
172" Otherwise, return the empty dictionary.
173function! s:TreeFileNode.GetSelected()
174
175 try
176 let l:path = b:NERDTree.ui.getPath(line('.'))
177
178 if empty(l:path)
179 return {}
180 endif
181
182 return b:NERDTree.root.findNode(l:path)
183 catch
184 return {}
185 endtry
186endfunction
187
188" FUNCTION: TreeFileNode.isVisible() {{{1
189" returns 1 if this node should be visible according to the tree filters and
190" hidden file filters (and their on/off status)
191function! s:TreeFileNode.isVisible()
192 return !self.path.ignore(self.getNerdtree())
193endfunction
194
195" FUNCTION: TreeFileNode.isRoot() {{{1
196function! s:TreeFileNode.isRoot()
197 if !g:NERDTree.ExistsForBuf()
198 throw 'NERDTree.NoTreeError: No tree exists for the current buffer'
199 endif
200
201 return self.equals(self.getNerdtree().root)
202endfunction
203
204" FUNCTION: TreeFileNode.New(path, nerdtree) {{{1
205" Returns a new TreeNode object with the given path and parent
206"
207" Args:
208" path: file/dir that the node represents
209" nerdtree: the tree the node belongs to
210function! s:TreeFileNode.New(path, nerdtree)
211 if a:path.isDirectory
212 return g:NERDTreeDirNode.New(a:path, a:nerdtree)
213 else
214 let newTreeNode = copy(self)
215 let newTreeNode.path = a:path
216 let newTreeNode.parent = {}
217 let newTreeNode._nerdtree = a:nerdtree
218 return newTreeNode
219 endif
220endfunction
221
222" FUNCTION: TreeFileNode.open() {{{1
223function! s:TreeFileNode.open(...)
224 let opts = a:0 ? a:1 : {}
225 let opener = g:NERDTreeOpener.New(self.path, opts)
226 call opener.open(self)
227endfunction
228
229" FUNCTION: TreeFileNode.openSplit() {{{1
230" Open this node in a new window
231function! s:TreeFileNode.openSplit()
232 call nerdtree#deprecated('TreeFileNode.openSplit', 'is deprecated, use .open() instead.')
233 call self.open({'where': 'h'})
234endfunction
235
236" FUNCTION: TreeFileNode.openVSplit() {{{1
237" Open this node in a new vertical window
238function! s:TreeFileNode.openVSplit()
239 call nerdtree#deprecated('TreeFileNode.openVSplit', 'is deprecated, use .open() instead.')
240 call self.open({'where': 'v'})
241endfunction
242
243" FUNCTION: TreeFileNode.openInNewTab(options) {{{1
244function! s:TreeFileNode.openInNewTab(options)
245 call nerdtree#deprecated('TreeFileNode.openinNewTab', 'is deprecated, use .open() instead.')
246 call self.open(extend({'where': 't'}, a:options))
247endfunction
248
249" FUNCTION: TreeFileNode.openExplorer()
250function! s:TreeFileNode.openExplorer()
251 execute 'wincmd p'
252 execute 'edit '.self.path.getParent().str({'format':'Edit'})
253endfunction
254
255" FUNCTION: TreeFileNode.putCursorHere(isJump, recurseUpward){{{1
256" Places the cursor on the line number this node is rendered on
257"
258" Args:
259" isJump: 1 if this cursor movement should be counted as a jump by vim
260" recurseUpward: try to put the cursor on the parent if the this node isnt
261" visible
262function! s:TreeFileNode.putCursorHere(isJump, recurseUpward)
263 let ln = self.getNerdtree().ui.getLineNum(self)
264 if ln != -1
265 if a:isJump
266 mark '
267 endif
268 call cursor(ln, col('.'))
269 else
270 if a:recurseUpward
271 let node = self
272 while node != {} && self.getNerdtree().ui.getLineNum(node) ==# -1
273 let node = node.parent
274 call node.open()
275 endwhile
276 call self._nerdtree.render()
277 call node.putCursorHere(a:isJump, 0)
278 endif
279 endif
280endfunction
281
282" FUNCTION: TreeFileNode.refresh() {{{1
283function! s:TreeFileNode.refresh()
284 call self.path.refresh(self.getNerdtree())
285endfunction
286
287" FUNCTION: TreeFileNode.refreshFlags() {{{1
288function! s:TreeFileNode.refreshFlags()
289 call self.path.refreshFlags(self.getNerdtree())
290endfunction
291
292" FUNCTION: TreeFileNode.rename() {{{1
293" Calls the rename method for this nodes path obj
294function! s:TreeFileNode.rename(newName)
295 let newName = substitute(a:newName, '\(\\\|\/\)$', '', '')
296 call self.path.rename(newName)
297 call self.parent.removeChild(self)
298
299 let parentPath = self.path.getParent()
300 let newParent = self.getNerdtree().root.findNode(parentPath)
301
302 if newParent != {}
303 call newParent.createChild(self.path, 1)
304 call newParent.refresh()
305 endif
306endfunction
307
308" FUNCTION: TreeFileNode.renderToString {{{1
309" returns a string representation for this tree to be rendered in the view
310function! s:TreeFileNode.renderToString()
311 return self._renderToString(0, 0)
312endfunction
313
314" Args:
315" depth: the current depth in the tree for this call
316" drawText: 1 if we should actually draw the line for this node (if 0 then the
317" child nodes are rendered only)
318" for each depth in the tree
319function! s:TreeFileNode._renderToString(depth, drawText)
320 let output = ''
321 if a:drawText ==# 1
322
323 let treeParts = repeat(' ', a:depth - 1)
324 let treeParts .= (self.path.isDirectory || g:NERDTreeDirArrowExpandable ==# '' ? '' : ' ')
325
326 let line = treeParts . self.displayString()
327 let output = output . line . "\n"
328 endif
329
330 " if the node is an open dir, draw its children
331 if self.path.isDirectory ==# 1 && self.isOpen ==# 1
332
333 let childNodesToDraw = self.getVisibleChildren()
334
335 if self.isCascadable() && a:depth > 0
336
337 let output = output . childNodesToDraw[0]._renderToString(a:depth, 0)
338
339 elseif len(childNodesToDraw) > 0
340 for i in childNodesToDraw
341 let output = output . i._renderToString(a:depth + 1, 1)
342 endfor
343 endif
344 endif
345
346 return output
347endfunction
348
349" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/.vim/pack/vendor/start/nerdtree/lib/nerdtree/ui.vim b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/ui.vim
new file mode 100644
index 0000000..a481ba4
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/lib/nerdtree/ui.vim
@@ -0,0 +1,532 @@
1" ============================================================================
2" CLASS: UI
3" ============================================================================
4
5
6let s:UI = {}
7let g:NERDTreeUI = s:UI
8
9" FUNCTION: s:UI.centerView() {{{1
10" centers the nerd tree window around the cursor (provided the nerd tree
11" options permit)
12function! s:UI.centerView()
13 if g:NERDTreeAutoCenter
14 let current_line = winline()
15 let lines_to_top = current_line
16 let lines_to_bottom = winheight(g:NERDTree.GetWinNum()) - current_line
17 if lines_to_top < g:NERDTreeAutoCenterThreshold || lines_to_bottom < g:NERDTreeAutoCenterThreshold
18 normal! zz
19 endif
20 endif
21endfunction
22
23" FUNCTION: s:UI._dumpHelp {{{1
24" prints out the quick help
25function! s:UI._dumpHelp()
26 if self.getShowHelp()
27 let help = "\" NERDTree (" . nerdtree#version() . ") quickhelp~\n"
28 let help .= "\" ============================\n"
29 let help .= "\" File node mappings~\n"
30 let help .= '" '. (g:NERDTreeMouseMode ==# 3 ? 'single' : 'double') ."-click,\n"
31 if self.nerdtree.isTabTree()
32 let help .= '" '. g:NERDTreeMapActivateNode .": open in prev window\n"
33 else
34 let help .= '" '. g:NERDTreeMapActivateNode .": open in current window\n"
35 endif
36 if self.nerdtree.isTabTree()
37 let help .= '" '. g:NERDTreeMapPreview .": preview\n"
38 endif
39 let help .= '" '. g:NERDTreeMapOpenInTab.": open in new tab\n"
40 let help .= '" '. g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
41 let help .= "\" middle-click,\n"
42 let help .= '" '. g:NERDTreeMapOpenSplit .": open split\n"
43 let help .= '" '. g:NERDTreeMapPreviewSplit .": preview split\n"
44 let help .= '" '. g:NERDTreeMapOpenVSplit .": open vsplit\n"
45 let help .= '" '. g:NERDTreeMapPreviewVSplit .": preview vsplit\n"
46 let help .= '" '. g:NERDTreeMapCustomOpen .": custom open\n"
47
48 let help .= "\"\n\" ----------------------------\n"
49 let help .= "\" Directory node mappings~\n"
50 let help .= '" '. (g:NERDTreeMouseMode ==# 1 ? 'double' : 'single') ."-click,\n"
51 let help .= '" '. g:NERDTreeMapActivateNode .": open & close node\n"
52 let help .= '" '. g:NERDTreeMapOpenRecursively .": recursively open node\n"
53 let help .= '" '. g:NERDTreeMapOpenInTab.": open in new tab\n"
54 let help .= '" '. g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
55 let help .= '" '. g:NERDTreeMapCustomOpen .": custom open\n"
56 let help .= '" '. g:NERDTreeMapCloseDir .": close parent of node\n"
57 let help .= '" '. g:NERDTreeMapCloseChildren .": close all child nodes of\n"
58 let help .= "\" current node recursively\n"
59 let help .= "\" middle-click,\n"
60 let help .= '" '. g:NERDTreeMapOpenExpl.": explore selected dir\n"
61
62 let help .= "\"\n\" ----------------------------\n"
63 let help .= "\" Bookmark table mappings~\n"
64 let help .= "\" double-click,\n"
65 let help .= '" '. g:NERDTreeMapActivateNode .": open bookmark\n"
66 let help .= '" '. g:NERDTreeMapPreview .": preview file\n"
67 let help .= '" '. g:NERDTreeMapPreview .": find dir in tree\n"
68 let help .= '" '. g:NERDTreeMapOpenInTab.": open in new tab\n"
69 let help .= '" '. g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
70 let help .= '" '. g:NERDTreeMapOpenSplit .": open split\n"
71 let help .= '" '. g:NERDTreeMapPreviewSplit .": preview split\n"
72 let help .= '" '. g:NERDTreeMapOpenVSplit .": open vsplit\n"
73 let help .= '" '. g:NERDTreeMapPreviewVSplit .": preview vsplit\n"
74 let help .= '" '. g:NERDTreeMapCustomOpen .": custom open\n"
75 let help .= '" '. g:NERDTreeMapDeleteBookmark .": delete bookmark\n"
76
77 let help .= "\"\n\" ----------------------------\n"
78 let help .= "\" Tree navigation mappings~\n"
79 let help .= '" '. g:NERDTreeMapJumpRoot .": go to root\n"
80 let help .= '" '. g:NERDTreeMapJumpParent .": go to parent\n"
81 let help .= '" '. g:NERDTreeMapJumpFirstChild .": go to first child\n"
82 let help .= '" '. g:NERDTreeMapJumpLastChild .": go to last child\n"
83 let help .= '" '. g:NERDTreeMapJumpNextSibling .": go to next sibling\n"
84 let help .= '" '. g:NERDTreeMapJumpPrevSibling .": go to prev sibling\n"
85
86 let help .= "\"\n\" ----------------------------\n"
87 let help .= "\" Filesystem mappings~\n"
88 let help .= '" '. g:NERDTreeMapChangeRoot .": change tree root to the\n"
89 let help .= "\" selected dir\n"
90 let help .= '" '. g:NERDTreeMapUpdir .": move tree root up a dir\n"
91 let help .= '" '. g:NERDTreeMapUpdirKeepOpen .": move tree root up a dir\n"
92 let help .= "\" but leave old root open\n"
93 let help .= '" '. g:NERDTreeMapRefresh .": refresh cursor dir\n"
94 let help .= '" '. g:NERDTreeMapRefreshRoot .": refresh current root\n"
95 let help .= '" '. g:NERDTreeMapMenu .": Show menu\n"
96 let help .= '" '. g:NERDTreeMapChdir .":change the CWD to the\n"
97 let help .= "\" selected dir\n"
98 let help .= '" '. g:NERDTreeMapCWD .":change tree root to CWD\n"
99
100 let help .= "\"\n\" ----------------------------\n"
101 let help .= "\" Tree filtering mappings~\n"
102 let help .= '" '. g:NERDTreeMapToggleHidden .': hidden files (' . (self.getShowHidden() ? 'on' : 'off') . ")\n"
103 let help .= '" '. g:NERDTreeMapToggleFilters .': file filters (' . (self.isIgnoreFilterEnabled() ? 'on' : 'off') . ")\n"
104 let help .= '" '. g:NERDTreeMapToggleFiles .': files (' . (self.getShowFiles() ? 'on' : 'off') . ")\n"
105 let help .= '" '. g:NERDTreeMapToggleBookmarks .': bookmarks (' . (self.getShowBookmarks() ? 'on' : 'off') . ")\n"
106
107 " add quickhelp entries for each custom key map
108 let help .= "\"\n\" ----------------------------\n"
109 let help .= "\" Custom mappings~\n"
110 for i in g:NERDTreeKeyMap.All()
111 if !empty(i.quickhelpText)
112 let help .= '" '. i.key .': '. i.quickhelpText ."\n"
113 endif
114 endfor
115
116 let help .= "\"\n\" ----------------------------\n"
117 let help .= "\" Other mappings~\n"
118 let help .= '" '. g:NERDTreeMapQuit .": Close the NERDTree window\n"
119 let help .= '" '. g:NERDTreeMapToggleZoom .": Zoom (maximize-minimize)\n"
120 let help .= "\" the NERDTree window\n"
121 let help .= '" '. g:NERDTreeMapHelp .": toggle help\n"
122 let help .= "\"\n\" ----------------------------\n"
123 let help .= "\" Bookmark commands~\n"
124 let help .= "\" :Bookmark [<name>]\n"
125 let help .= "\" :BookmarkToRoot <name>\n"
126 let help .= "\" :RevealBookmark <name>\n"
127 let help .= "\" :OpenBookmark <name>\n"
128 let help .= "\" :ClearBookmarks [<names>]\n"
129 let help .= "\" :ClearAllBookmarks\n"
130 let help .= "\" :ReadBookmarks\n"
131 let help .= "\" :WriteBookmarks\n"
132 let help .= "\" :EditBookmarks\n"
133 silent! put =help
134 elseif !self.isMinimal()
135 let help ='" Press '. g:NERDTreeMapHelp ." for help\n"
136 silent! put =help
137 endif
138endfunction
139
140
141" FUNCTION: s:UI.new(nerdtree) {{{1
142function! s:UI.New(nerdtree)
143 let newObj = copy(self)
144 let newObj.nerdtree = a:nerdtree
145 let newObj._showHelp = 0
146 let newObj._ignoreEnabled = 1
147 let newObj._showFiles = g:NERDTreeShowFiles
148 let newObj._showHidden = g:NERDTreeShowHidden
149 let newObj._showBookmarks = g:NERDTreeShowBookmarks
150
151 return newObj
152endfunction
153
154" FUNCTION: s:UI.getPath(ln) {{{1
155" Return the Path object for the node that is rendered on the given line
156" number. If the 'up a dir' line is selected, return the Path object for
157" the parent of the root. Return the empty dictionary if the given line
158" does not reference a tree node.
159function! s:UI.getPath(ln)
160 let line = getline(a:ln)
161
162 let rootLine = self.getRootLineNum()
163
164 if a:ln ==# rootLine
165 return self.nerdtree.root.path
166 endif
167
168 if line ==# s:UI.UpDirLine()
169 return self.nerdtree.root.path.getParent()
170 endif
171
172 if a:ln < rootLine
173 return {}
174 endif
175
176 let indent = self._indentLevelFor(line)
177
178 " remove the tree parts and the leading space
179 let curFile = self._stripMarkup(line)
180
181 let dir = ''
182 let lnum = a:ln
183 while lnum > 0
184 let lnum = lnum - 1
185 let curLine = getline(lnum)
186 let curLineStripped = self._stripMarkup(curLine)
187
188 " have we reached the top of the tree?
189 if lnum ==# rootLine
190 let dir = self.nerdtree.root.path.str({'format': 'UI'}) . dir
191 break
192 endif
193 if curLineStripped =~# '/$'
194 let lpindent = self._indentLevelFor(curLine)
195 if lpindent < indent
196 let indent = indent - 1
197
198 let dir = substitute (curLineStripped,'^\\', '', '') . dir
199 continue
200 endif
201 endif
202 endwhile
203 let curFile = self.nerdtree.root.path.drive . dir . curFile
204 let toReturn = g:NERDTreePath.New(curFile)
205 return toReturn
206endfunction
207
208" FUNCTION: s:UI.getLineNum(node) {{{1
209" Return the line number where the given node is rendered. Return -1 if the
210" given node is not visible.
211function! s:UI.getLineNum(node)
212
213 if a:node.isRoot()
214 return self.getRootLineNum()
215 endif
216
217 let l:pathComponents = [substitute(self.nerdtree.root.path.str({'format': 'UI'}), '/\s*$', '', '')]
218 let l:currentPathComponent = 1
219
220 let l:fullPath = a:node.path.str({'format': 'UI'})
221
222 for l:lineNumber in range(self.getRootLineNum() + 1, line('$'))
223 let l:currentLine = getline(l:lineNumber)
224 let l:indentLevel = self._indentLevelFor(l:currentLine)
225
226 if l:indentLevel !=# l:currentPathComponent
227 continue
228 endif
229
230 let l:currentLine = self._stripMarkup(l:currentLine)
231 let l:currentPath = join(l:pathComponents, '/') . '/' . l:currentLine
232
233 " Directories: If the current path 'starts with' the full path, then
234 " either the paths are equal or the line is a cascade containing the
235 " full path.
236 if l:fullPath[-1:] ==# '/' && stridx(l:currentPath, l:fullPath) ==# 0
237 return l:lineNumber
238 endif
239
240 " Files: The paths must exactly match.
241 if l:fullPath ==# l:currentPath
242 return l:lineNumber
243 endif
244
245 " Otherwise: If the full path starts with the current path and the
246 " current path is a directory, we add a new path component.
247 if stridx(l:fullPath, l:currentPath) ==# 0 && l:currentPath[-1:] ==# '/'
248 let l:currentLine = substitute(l:currentLine, '/\s*$', '', '')
249 call add(l:pathComponents, l:currentLine)
250 let l:currentPathComponent += 1
251 endif
252 endfor
253
254 return -1
255endfunction
256
257" FUNCTION: s:UI.getRootLineNum(){{{1
258" gets the line number of the root node
259function! s:UI.getRootLineNum()
260 let rootLine = 1
261 while rootLine <= line('$') && getline(rootLine) !~# '^\(/\|<\)'
262 let rootLine = rootLine + 1
263 endwhile
264 return rootLine
265endfunction
266
267" FUNCTION: s:UI.getShowBookmarks() {{{1
268function! s:UI.getShowBookmarks()
269 return self._showBookmarks
270endfunction
271
272" FUNCTION: s:UI.getShowFiles() {{{1
273function! s:UI.getShowFiles()
274 return self._showFiles
275endfunction
276
277" FUNCTION: s:UI.getShowHelp() {{{1
278function! s:UI.getShowHelp()
279 return self._showHelp
280endfunction
281
282" FUNCTION: s:UI.getShowHidden() {{{1
283function! s:UI.getShowHidden()
284 return self._showHidden
285endfunction
286
287" FUNCTION: s:UI._indentLevelFor(line) {{{1
288function! s:UI._indentLevelFor(line)
289 " Replace multi-character DirArrows with a single space so the
290 " indentation calculation doesn't get messed up.
291 if g:NERDTreeDirArrowExpandable ==# ''
292 let l:line = ' '.a:line
293 else
294 let l:line = substitute(substitute(a:line, '\V'.g:NERDTreeDirArrowExpandable, ' ', ''), '\V'.g:NERDTreeDirArrowCollapsible, ' ', '')
295 endif
296 let leadChars = match(l:line, '\M\[^ ]')
297 return leadChars / s:UI.IndentWid()
298endfunction
299
300" FUNCTION: s:UI.IndentWid() {{{1
301function! s:UI.IndentWid()
302 return 2
303endfunction
304
305" FUNCTION: s:UI.isIgnoreFilterEnabled() {{{1
306function! s:UI.isIgnoreFilterEnabled()
307 return self._ignoreEnabled ==# 1
308endfunction
309
310" FUNCTION: s:UI.isMinimal() {{{1
311function! s:UI.isMinimal()
312 return g:NERDTreeMinimalUI
313endfunction
314
315" FUNCTION: s:UI.MarkupReg() {{{1
316function! s:UI.MarkupReg()
317 return '^ *['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']\? '
318endfunction
319
320" FUNCTION: s:UI._renderBookmarks {{{1
321function! s:UI._renderBookmarks()
322
323 if !self.isMinimal()
324 call setline(line('.')+1, '>----------Bookmarks----------')
325 call cursor(line('.')+1, col('.'))
326 endif
327
328 if g:NERDTreeBookmarksSort ==# 1 || g:NERDTreeBookmarksSort ==# 2
329 call g:NERDTreeBookmark.SortBookmarksList()
330 endif
331
332 for i in g:NERDTreeBookmark.Bookmarks()
333 call setline(line('.')+1, i.str())
334 call cursor(line('.')+1, col('.'))
335 endfor
336
337 call setline(line('.')+1, '')
338 call cursor(line('.')+1, col('.'))
339endfunction
340
341" FUNCTION: s:UI.restoreScreenState() {{{1
342"
343" Sets the screen state back to what it was when nerdtree#saveScreenState was last
344" called.
345"
346" Assumes the cursor is in the NERDTree window
347function! s:UI.restoreScreenState()
348 if !has_key(self, '_screenState')
349 return
350 endif
351 call nerdtree#exec('silent vertical resize ' . self._screenState['oldWindowSize'], 1)
352
353 let old_scrolloff=&scrolloff
354 let &scrolloff=0
355 call cursor(self._screenState['oldTopLine'], 0)
356 normal! zt
357 call setpos('.', self._screenState['oldPos'])
358 let &scrolloff=old_scrolloff
359endfunction
360
361" FUNCTION: s:UI.saveScreenState() {{{1
362" Saves the current cursor position in the current buffer and the window
363" scroll position
364function! s:UI.saveScreenState()
365 let win = winnr()
366 let self._screenState = {}
367 try
368 call g:NERDTree.CursorToTreeWin()
369 let self._screenState['oldPos'] = getpos('.')
370 let self._screenState['oldTopLine'] = line('w0')
371 let self._screenState['oldWindowSize'] = winnr('$')==1 ? g:NERDTreeWinSize : winwidth('')
372 call nerdtree#exec(win . 'wincmd w', 1)
373 catch
374 endtry
375endfunction
376
377" FUNCTION: s:UI.setShowHidden(val) {{{1
378function! s:UI.setShowHidden(val)
379 let self._showHidden = a:val
380endfunction
381
382" FUNCTION: s:UI._stripMarkup(line){{{1
383" find the filename in the given line, and return it.
384"
385" Args:
386" line: the subject line
387function! s:UI._stripMarkup(line)
388 let l:line = substitute(a:line, '^.\{-}' . g:NERDTreeNodeDelimiter, '', '')
389 return substitute(l:line, g:NERDTreeNodeDelimiter.'.*$', '', '')
390endfunction
391
392" FUNCTION: s:UI.render() {{{1
393function! s:UI.render()
394 setlocal noreadonly modifiable
395
396 " remember the top line of the buffer and the current line so we can
397 " restore the view exactly how it was
398 let curLine = line('.')
399 let curCol = col('.')
400 let topLine = line('w0')
401
402 " delete all lines in the buffer (being careful not to clobber a register)
403 silent 1,$delete _
404
405 call self._dumpHelp()
406
407 " delete the blank line before the help and add one after it
408 if !self.isMinimal()
409 call setline(line('.')+1, '')
410 call cursor(line('.')+1, col('.'))
411 endif
412
413 if self.getShowBookmarks()
414 call self._renderBookmarks()
415 endif
416
417 " add the 'up a dir' line
418 if !self.isMinimal()
419 call setline(line('.')+1, s:UI.UpDirLine())
420 call cursor(line('.')+1, col('.'))
421 endif
422
423 " draw the header line
424 let header = self.nerdtree.root.path.str({'format': 'UI', 'truncateTo': winwidth(0)})
425 call setline(line('.')+1, header)
426 call cursor(line('.')+1, col('.'))
427
428 " draw the tree
429 silent put =self.nerdtree.root.renderToString()
430
431 " delete the blank line at the top of the buffer
432 silent 1,1delete _
433
434 " restore the view
435 let old_scrolloff=&scrolloff
436 let &scrolloff=0
437 call cursor(topLine, 1)
438 normal! zt
439 call cursor(curLine, curCol)
440 let &scrolloff = old_scrolloff
441
442 setlocal readonly nomodifiable
443endfunction
444
445
446" FUNCTION: UI.renderViewSavingPosition {{{1
447" Renders the tree and ensures the cursor stays on the current node or the
448" current nodes parent if it is no longer available upon re-rendering
449function! s:UI.renderViewSavingPosition()
450 let currentNode = g:NERDTreeFileNode.GetSelected()
451
452 " go up the tree till we find a node that will be visible or till we run
453 " out of nodes
454 while currentNode !=# {} && !currentNode.isVisible() && !currentNode.isRoot()
455 let currentNode = currentNode.parent
456 endwhile
457
458 call self.render()
459
460 if currentNode !=# {}
461 call currentNode.putCursorHere(0, 0)
462 endif
463endfunction
464
465" FUNCTION: s:UI.toggleHelp() {{{1
466function! s:UI.toggleHelp()
467 let self._showHelp = !self._showHelp
468endfunction
469
470" FUNCTION: s:UI.toggleIgnoreFilter() {{{1
471" toggles the use of the NERDTreeIgnore option
472function! s:UI.toggleIgnoreFilter()
473 let self._ignoreEnabled = !self._ignoreEnabled
474 call self.renderViewSavingPosition()
475 call self.centerView()
476endfunction
477
478" FUNCTION: s:UI.toggleShowBookmarks() {{{1
479" Toggle the visibility of the Bookmark table.
480function! s:UI.toggleShowBookmarks()
481 let self._showBookmarks = !self._showBookmarks
482
483 if self.getShowBookmarks()
484 call self.nerdtree.render()
485 call g:NERDTree.CursorToBookmarkTable()
486 else
487
488 if empty(g:NERDTreeFileNode.GetSelected())
489 call b:NERDTree.root.putCursorHere(0, 0)
490 normal! 0
491 endif
492
493 call self.renderViewSavingPosition()
494 endif
495
496 call self.centerView()
497endfunction
498
499" FUNCTION: s:UI.toggleShowFiles() {{{1
500" toggles the display of hidden files
501function! s:UI.toggleShowFiles()
502 let self._showFiles = !self._showFiles
503 call self.renderViewSavingPosition()
504 call self.centerView()
505endfunction
506
507" FUNCTION: s:UI.toggleShowHidden() {{{1
508" toggles the display of hidden files
509function! s:UI.toggleShowHidden()
510 let self._showHidden = !self._showHidden
511 call self.renderViewSavingPosition()
512 call self.centerView()
513endfunction
514
515" FUNCTION: s:UI.toggleZoom() {{{1
516" zoom (maximize/minimize) the NERDTree window
517function! s:UI.toggleZoom()
518 if exists('b:NERDTreeZoomed') && b:NERDTreeZoomed
519 call nerdtree#exec('silent vertical resize '. g:NERDTreeWinSize, 1)
520 let b:NERDTreeZoomed = 0
521 else
522 call nerdtree#exec('vertical resize '. get(g:, 'NERDTreeWinSizeMax', ''), 1)
523 let b:NERDTreeZoomed = 1
524 endif
525endfunction
526
527" FUNCTION: s:UI.UpDirLine() {{{1
528function! s:UI.UpDirLine()
529 return '.. (up a dir)'
530endfunction
531
532" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/.vim/pack/vendor/start/nerdtree/nerdtree_plugin/exec_menuitem.vim b/.vim/pack/vendor/start/nerdtree/nerdtree_plugin/exec_menuitem.vim
new file mode 100644
index 0000000..fb6c486
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/nerdtree_plugin/exec_menuitem.vim
@@ -0,0 +1,40 @@
1" ============================================================================
2" File: exec_menuitem.vim
3" Description: plugin for NERD Tree that provides an execute file menu item
4" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
5" License: This program is free software. It comes without any warranty,
6" to the extent permitted by applicable law. You can redistribute
7" it and/or modify it under the terms of the Do What The Fuck You
8" Want To Public License, Version 2, as published by Sam Hocevar.
9" See http://sam.zoy.org/wtfpl/COPYING for more details.
10"
11" ============================================================================
12if exists('g:loaded_nerdtree_exec_menuitem')
13 finish
14endif
15let g:loaded_nerdtree_exec_menuitem = 1
16
17call NERDTreeAddMenuItem({
18 \ 'text': '(!)Execute file',
19 \ 'shortcut': '!',
20 \ 'callback': 'NERDTreeExecFile',
21 \ 'isActiveCallback': 'NERDTreeExecFileActive' })
22
23function! NERDTreeExecFileActive()
24 let node = g:NERDTreeFileNode.GetSelected()
25 return !node.path.isDirectory && node.path.isExecutable
26endfunction
27
28function! NERDTreeExecFile()
29 let treenode = g:NERDTreeFileNode.GetSelected()
30 echo "==========================================================\n"
31 echo "Complete the command to execute (add arguments etc):\n"
32 let cmd = treenode.path.str({'escape': 1})
33 let cmd = input(':!', cmd . ' ')
34
35 if cmd !=# ''
36 exec ':!' . cmd
37 else
38 echo 'Aborted'
39 endif
40endfunction
diff --git a/.vim/pack/vendor/start/nerdtree/nerdtree_plugin/fs_menu.vim b/.vim/pack/vendor/start/nerdtree/nerdtree_plugin/fs_menu.vim
new file mode 100644
index 0000000..05bee60
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/nerdtree_plugin/fs_menu.vim
@@ -0,0 +1,484 @@
1" ============================================================================
2" File: fs_menu.vim
3" Description: plugin for the NERD Tree that provides a file system menu
4" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
5" License: This program is free software. It comes without any warranty,
6" to the extent permitted by applicable law. You can redistribute
7" it and/or modify it under the terms of the Do What The Fuck You
8" Want To Public License, Version 2, as published by Sam Hocevar.
9" See http://sam.zoy.org/wtfpl/COPYING for more details.
10"
11" ============================================================================
12if exists('g:loaded_nerdtree_fs_menu')
13 finish
14endif
15let g:loaded_nerdtree_fs_menu = 1
16
17"Automatically delete the buffer after deleting or renaming a file
18if !exists('g:NERDTreeAutoDeleteBuffer')
19 let g:NERDTreeAutoDeleteBuffer = 0
20endif
21
22call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callback': 'NERDTreeAddNode'})
23call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'})
24call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})
25
26if has('gui_mac') || has('gui_macvim') || has('mac')
27 call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'})
28 call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'})
29 call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'})
30endif
31
32if executable('xdg-open')
33 call NERDTreeAddMenuItem({'text': '(r)eveal the current node in file manager', 'shortcut': 'r', 'callback': 'NERDTreeRevealFileLinux'})
34 call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileLinux'})
35endif
36
37if nerdtree#runningWindows()
38 call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileWindows'})
39endif
40
41if g:NERDTreePath.CopyingSupported()
42 call NERDTreeAddMenuItem({'text': '(c)opy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'})
43endif
44call NERDTreeAddMenuItem({'text': (has('clipboard')?'copy (p)ath to clipboard':'print (p)ath to screen'), 'shortcut': 'p', 'callback': 'NERDTreeCopyPath'})
45
46if has('unix') || has('osx')
47 call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNode'})
48else
49 call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNodeWin32'})
50endif
51
52if exists('*system')
53 call NERDTreeAddMenuItem({'text': 'Run (s)ystem command in this directory', 'shortcut':'s', 'callback': 'NERDTreeSystemCommand'})
54endif
55
56"FUNCTION: s:inputPrompt(action){{{1
57"returns the string that should be prompted to the user for the given action
58"
59"Args:
60"action: the action that is being performed, e.g. 'delete'
61function! s:inputPrompt(action)
62 if a:action ==# 'add'
63 let title = 'Add a childnode'
64 let info = "Enter the dir/file name to be created. Dirs end with a '/'"
65 let minimal = 'Add node:'
66
67 elseif a:action ==# 'copy'
68 let title = 'Copy the current node'
69 let info = 'Enter the new path to copy the node to:'
70 let minimal = 'Copy to:'
71
72 elseif a:action ==# 'delete'
73 let title = 'Delete the current node'
74 let info = 'Are you sure you wish to delete the node:'
75 let minimal = 'Delete?'
76
77 elseif a:action ==# 'deleteNonEmpty'
78 let title = 'Delete the current node'
79 let info = "STOP! Directory is not empty! To delete, type 'yes'"
80 let minimal = 'Delete directory?'
81
82 elseif a:action ==# 'move'
83 let title = 'Rename the current node'
84 let info = 'Enter the new path for the node:'
85 let minimal = 'Move to:'
86 endif
87
88 if g:NERDTreeMenuController.isMinimal()
89 redraw! " Clear the menu
90 return minimal . ' '
91 else
92 let divider = '=========================================================='
93 return title . "\n" . divider . "\n" . info . "\n"
94 end
95endfunction
96
97"FUNCTION: s:promptToDelBuffer(bufnum, msg){{{1
98"prints out the given msg and, if the user responds by pushing 'y' then the
99"buffer with the given bufnum is deleted
100"
101"Args:
102"bufnum: the buffer that may be deleted
103"msg: a message that will be echoed to the user asking them if they wish to
104" del the buffer
105function! s:promptToDelBuffer(bufnum, msg)
106 echo a:msg
107 if g:NERDTreeAutoDeleteBuffer || nr2char(getchar()) ==# 'y'
108 " 1. ensure that all windows which display the just deleted filename
109 " now display an empty buffer (so a layout is preserved).
110 " Is not it better to close single tabs with this file only ?
111 let s:originalTabNumber = tabpagenr()
112 let s:originalWindowNumber = winnr()
113 " Go to the next buffer in buffer list if at least one extra buffer is listed
114 " Otherwise open a new empty buffer
115 if v:version >= 800
116 let l:listedBufferCount = len(getbufinfo({'buflisted':1}))
117 elseif v:version >= 702
118 let l:listedBufferCount = len(filter(range(1, bufnr('$')), 'buflisted(v:val)'))
119 else
120 " Ignore buffer count in this case to make sure we keep the old
121 " behavior
122 let l:listedBufferCount = 0
123 endif
124 if l:listedBufferCount > 1
125 call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . a:bufnum . " | exec ':bnext! ' | endif", 1)
126 else
127 call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . a:bufnum . " | exec ':enew! ' | endif", 1)
128 endif
129 call nerdtree#exec('tabnext ' . s:originalTabNumber, 1)
130 call nerdtree#exec(s:originalWindowNumber . 'wincmd w', 1)
131 " 3. We don't need a previous buffer anymore
132 call nerdtree#exec('bwipeout! ' . a:bufnum, 0)
133 endif
134endfunction
135
136"FUNCTION: s:renameBuffer(bufNum, newNodeName, isDirectory){{{1
137"The buffer with the given bufNum is replaced with a new one
138"
139"Args:
140"bufNum: the buffer that may be deleted
141"newNodeName: the name given to the renamed node
142"isDirectory: determines how to do the create the new filenames
143function! s:renameBuffer(bufNum, newNodeName, isDirectory)
144 if a:isDirectory
145 let quotedFileName = fnameescape(a:newNodeName . '/' . fnamemodify(bufname(a:bufNum),':t'))
146 let editStr = g:NERDTreePath.New(a:newNodeName . '/' . fnamemodify(bufname(a:bufNum),':t')).str({'format': 'Edit'})
147 else
148 let quotedFileName = fnameescape(a:newNodeName)
149 let editStr = g:NERDTreePath.New(a:newNodeName).str({'format': 'Edit'})
150 endif
151 " 1. ensure that a new buffer is loaded
152 call nerdtree#exec('badd ' . quotedFileName, 0)
153 " 2. ensure that all windows which display the just deleted filename
154 " display a buffer for a new filename.
155 let s:originalTabNumber = tabpagenr()
156 let s:originalWindowNumber = winnr()
157 call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . a:bufNum . " | exec ':e! " . editStr . "' | endif", 0)
158 call nerdtree#exec('tabnext ' . s:originalTabNumber, 1)
159 call nerdtree#exec(s:originalWindowNumber . 'wincmd w', 1)
160 " 3. We don't need a previous buffer anymore
161 try
162 call nerdtree#exec('confirm bwipeout ' . a:bufNum, 0)
163 catch
164 " This happens when answering Cancel if confirmation is needed. Do nothing.
165 endtry
166endfunction
167
168"FUNCTION: NERDTreeAddNode(){{{1
169function! NERDTreeAddNode()
170 let curDirNode = g:NERDTreeDirNode.GetSelected()
171 let prompt = s:inputPrompt('add')
172 let newNodeName = substitute(input(prompt, curDirNode.path.str() . nerdtree#slash(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
173
174 if newNodeName ==# ''
175 call nerdtree#echo('Node Creation Aborted.')
176 return
177 endif
178
179 try
180 let newPath = g:NERDTreePath.Create(newNodeName)
181 let parentNode = b:NERDTree.root.findNode(newPath.getParent())
182
183 let newTreeNode = g:NERDTreeFileNode.New(newPath, b:NERDTree)
184 " Emptying g:NERDTreeOldSortOrder forces the sort to
185 " recalculate the cached sortKey so nodes sort correctly.
186 let g:NERDTreeOldSortOrder = []
187 if empty(parentNode)
188 call b:NERDTree.root.refresh()
189 call b:NERDTree.render()
190 elseif parentNode.isOpen || !empty(parentNode.children)
191 call parentNode.addChild(newTreeNode, 1)
192 call NERDTreeRender()
193 call newTreeNode.putCursorHere(1, 0)
194 endif
195
196 redraw!
197 catch /^NERDTree/
198 call nerdtree#echoWarning('Node Not Created.')
199 endtry
200endfunction
201
202"FUNCTION: NERDTreeMoveNode(){{{1
203function! NERDTreeMoveNode()
204 let curNode = g:NERDTreeFileNode.GetSelected()
205 let prompt = s:inputPrompt('move')
206 let newNodePath = input(prompt, curNode.path.str(), 'file')
207 while filereadable(newNodePath)
208 call nerdtree#echoWarning('This destination already exists. Try again.')
209 let newNodePath = substitute(input(prompt, curNode.path.str(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
210 endwhile
211
212
213 if newNodePath ==# ''
214 call nerdtree#echo('Node Renaming Aborted.')
215 return
216 endif
217
218 try
219 if curNode.path.isDirectory
220 let l:curPath = escape(curNode.path.str(),'\') . (nerdtree#runningWindows()?'\\':'/') . '.*'
221 let l:openBuffers = filter(range(1,bufnr('$')),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") =~# "'.escape(l:curPath,'\').'"')
222 else
223 let l:openBuffers = filter(range(1,bufnr('$')),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") ==# curNode.path.str()')
224 endif
225
226 call curNode.rename(newNodePath)
227 " Emptying g:NERDTreeOldSortOrder forces the sort to
228 " recalculate the cached sortKey so nodes sort correctly.
229 let g:NERDTreeOldSortOrder = []
230 call b:NERDTree.root.refresh()
231 call NERDTreeRender()
232
233 " If the file node is open, or files under the directory node are
234 " open, ask the user if they want to replace the file(s) with the
235 " renamed files.
236 if !empty(l:openBuffers)
237 if curNode.path.isDirectory
238 echo "\nDirectory renamed.\n\nFiles with the old directory name are open in buffers " . join(l:openBuffers, ', ') . '. Replace these buffers with the new files? (yN)'
239 else
240 echo "\nFile renamed.\n\nThe old file is open in buffer " . l:openBuffers[0] . '. Replace this buffer with the new file? (yN)'
241 endif
242 if g:NERDTreeAutoDeleteBuffer || nr2char(getchar()) ==# 'y'
243 for bufNum in l:openBuffers
244 call s:renameBuffer(bufNum, newNodePath, curNode.path.isDirectory)
245 endfor
246 endif
247 endif
248
249 call curNode.putCursorHere(1, 0)
250
251 redraw!
252 catch /^NERDTree/
253 call nerdtree#echoWarning('Node Not Renamed.')
254 endtry
255endfunction
256
257" FUNCTION: NERDTreeDeleteNode() {{{1
258function! NERDTreeDeleteNode()
259 let currentNode = g:NERDTreeFileNode.GetSelected()
260 let confirmed = 0
261
262 if currentNode.path.isDirectory && ((currentNode.isOpen && currentNode.getChildCount() > 0) ||
263 \ (len(currentNode._glob('*', 1)) > 0))
264 let prompt = s:inputPrompt('deleteNonEmpty') . currentNode.path.str() . ': '
265 let choice = input(prompt)
266 let confirmed = choice ==# 'yes'
267 else
268 let prompt = s:inputPrompt('delete') . currentNode.path.str() . ' (yN): '
269 echo prompt
270 let choice = nr2char(getchar())
271 let confirmed = choice ==# 'y'
272 endif
273
274 if confirmed
275 try
276 call currentNode.delete()
277 call NERDTreeRender()
278
279 "if the node is open in a buffer, ask the user if they want to
280 "close that buffer
281 let bufnum = bufnr('^'.currentNode.path.str().'$')
282 if buflisted(bufnum)
283 let prompt = "\nNode deleted.\n\nThe file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? ' (hidden)' : '') .'. Delete this buffer? (yN)'
284 call s:promptToDelBuffer(bufnum, prompt)
285 endif
286
287 redraw!
288 catch /^NERDTree/
289 call nerdtree#echoWarning('Could not remove node')
290 endtry
291 else
292 call nerdtree#echo('delete aborted')
293 endif
294endfunction
295
296" FUNCTION: NERDTreeListNode() {{{1
297function! NERDTreeListNode()
298 let treenode = g:NERDTreeFileNode.GetSelected()
299 if !empty(treenode)
300 let s:uname = system('uname')
301 let stat_cmd = 'stat -c "%s" '
302
303 if s:uname =~? 'Darwin'
304 let stat_cmd = 'stat -f "%z" '
305 endif
306
307 let cmd = 'size=$(' . stat_cmd . shellescape(treenode.path.str()) . ') && ' .
308 \ 'size_with_commas=$(echo $size | sed -e :a -e "s/\(.*[0-9]\)\([0-9]\{3\}\)/\1,\2/;ta") && ' .
309 \ 'ls -ld ' . shellescape(treenode.path.str()) . ' | sed -e "s/ $size / $size_with_commas /"'
310
311 let metadata = split(system(cmd),'\n')
312 call nerdtree#echo(metadata[0])
313 else
314 call nerdtree#echo('No information available')
315 endif
316endfunction
317
318" FUNCTION: NERDTreeListNodeWin32() {{{1
319function! NERDTreeListNodeWin32()
320 let l:node = g:NERDTreeFileNode.GetSelected()
321
322 if !empty(l:node)
323 let l:path = l:node.path.str()
324 call nerdtree#echo(printf('%s:%s MOD:%s BYTES:%d PERMISSIONS:%s',
325 \ toupper(getftype(l:path)),
326 \ fnamemodify(l:path, ':t'),
327 \ strftime('%c', getftime(l:path)),
328 \ getfsize(l:path),
329 \ getfperm(l:path)))
330 return
331 endif
332
333 call nerdtree#echo('node not recognized')
334endfunction
335
336" FUNCTION: NERDTreeCopyNode() {{{1
337function! NERDTreeCopyNode()
338 let currentNode = g:NERDTreeFileNode.GetSelected()
339 let prompt = s:inputPrompt('copy')
340 let newNodePath = substitute(input(prompt, currentNode.path.str(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
341
342 if newNodePath !=# ''
343 "strip trailing slash
344 let newNodePath = substitute(newNodePath, '\/$', '', '')
345
346 let confirmed = 1
347 if currentNode.path.copyingWillOverwrite(newNodePath)
348 call nerdtree#echo('Warning: copying may overwrite files! Continue? (yN)')
349 let choice = nr2char(getchar())
350 let confirmed = choice ==# 'y'
351 endif
352
353 if confirmed
354 try
355 let newNode = currentNode.copy(newNodePath)
356 " Emptying g:NERDTreeOldSortOrder forces the sort to
357 " recalculate the cached sortKey so nodes sort correctly.
358 let g:NERDTreeOldSortOrder = []
359 if empty(newNode)
360 call b:NERDTree.root.refresh()
361 call b:NERDTree.render()
362 else
363 call NERDTreeRender()
364 call newNode.putCursorHere(0, 0)
365 endif
366 catch /^NERDTree/
367 call nerdtree#echoWarning('Could not copy node')
368 endtry
369 endif
370 else
371 call nerdtree#echo('Copy aborted.')
372 endif
373 redraw!
374endfunction
375
376" FUNCTION: NERDTreeCopyPath() {{{1
377function! NERDTreeCopyPath()
378 let l:nodePath = g:NERDTreeFileNode.GetSelected().path.str()
379 if has('clipboard')
380 if &clipboard ==# 'unnamedplus'
381 let @+ = l:nodePath
382 else
383 let @* = l:nodePath
384 endif
385 call nerdtree#echo('The path [' . l:nodePath . '] was copied to your clipboard.')
386 else
387 call nerdtree#echo('The full path is: ' . l:nodePath)
388 endif
389endfunction
390
391" FUNCTION: NERDTreeQuickLook() {{{1
392function! NERDTreeQuickLook()
393 let l:node = g:NERDTreeFileNode.GetSelected()
394
395 if empty(l:node)
396 return
397 endif
398
399 call system('qlmanage -p 2>/dev/null ' . shellescape(l:node.path.str()))
400endfunction
401
402" FUNCTION: NERDTreeRevealInFinder() {{{1
403function! NERDTreeRevealInFinder()
404 let l:node = g:NERDTreeFileNode.GetSelected()
405
406 if empty(l:node)
407 return
408 endif
409
410 call system('open -R ' . shellescape(l:node.path.str()))
411endfunction
412
413" FUNCTION: NERDTreeExecuteFile() {{{1
414function! NERDTreeExecuteFile()
415 let l:node = g:NERDTreeFileNode.GetSelected()
416
417 if empty(l:node)
418 return
419 endif
420
421 call system('open ' . shellescape(l:node.path.str()))
422endfunction
423
424" FUNCTION: NERDTreeRevealFileLinux() {{{1
425function! NERDTreeRevealFileLinux()
426 let l:node = g:NERDTreeFileNode.GetSelected()
427
428 if empty(l:node)
429 return
430 endif
431
432 " Handle the edge case of "/", which has no parent.
433 if l:node.path.str() ==# '/'
434 call system('xdg-open /')
435 return
436 endif
437
438 if empty(l:node.parent)
439 return
440 endif
441
442 call system('xdg-open ' . shellescape(l:node.parent.path.str()))
443endfunction
444
445" FUNCTION: NERDTreeExecuteFileLinux() {{{1
446function! NERDTreeExecuteFileLinux()
447 let l:node = g:NERDTreeFileNode.GetSelected()
448
449 if empty(l:node)
450 return
451 endif
452
453 call system('xdg-open ' . shellescape(l:node.path.str()))
454endfunction
455
456" FUNCTION: NERDTreeExecuteFileWindows() {{{1
457function! NERDTreeExecuteFileWindows()
458 let l:node = g:NERDTreeFileNode.GetSelected()
459
460 if empty(l:node)
461 return
462 endif
463
464 call system('cmd.exe /c start "" ' . shellescape(l:node.path.str()))
465endfunction
466
467" FUNCTION: NERDTreeSystemCommand() {{{1
468function! NERDTreeSystemCommand()
469 let l:node = g:NERDTreeFileNode.GetSelected()
470
471 if empty(l:node)
472 return
473 endif
474
475 let l:cwd = getcwd()
476 let l:directory = l:node.path.isDirectory ? l:node.path.str() : l:node.parent.path.str()
477 execute 'cd '.l:directory
478
479 let l:nl = nr2char(10)
480 echo l:nl . system(input(l:directory . (nerdtree#runningWindows() ? '> ' : ' $ ')))
481 execute 'cd '.l:cwd
482endfunction
483
484" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/.vim/pack/vendor/start/nerdtree/nerdtree_plugin/vcs.vim b/.vim/pack/vendor/start/nerdtree/nerdtree_plugin/vcs.vim
new file mode 100644
index 0000000..d20e35e
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/nerdtree_plugin/vcs.vim
@@ -0,0 +1,47 @@
1" ============================================================================
2" File: vcs.vim
3" Description: NERDTree plugin that provides a command to open on the root of
4" a version control system repository.
5" Maintainer: Phil Runninger
6" License: This program is free software. It comes without any warranty,
7" to the extent permitted by applicable law. You can redistribute
8" it and/or modify it under the terms of the Do What The Fuck You
9" Want To Public License, Version 2, as published by Sam Hocevar.
10" See http://sam.zoy.org/wtfpl/COPYING for more details.
11"
12" ============================================================================
13command! -n=? -complete=dir -bar NERDTreeVCS :call <SID>CreateTabTreeVCS('<args>')
14command! -n=? -complete=dir -bar NERDTreeToggleVCS :call <SID>ToggleTabTreeVCS('<args>')
15
16" FUNCTION: s:CreateTabTreeVCS(a:name) {{{1
17function! s:CreateTabTreeVCS(name)
18 let l:path = g:NERDTreeCreator._pathForString(a:name)
19 let l:path = s:FindParentVCSRoot(l:path)
20 call g:NERDTreeCreator.createTabTree(empty(l:path) ? '' : l:path._str())
21endfunction
22
23" FUNCTION: s:ToggleTabTreeVCS(a:name) {{{1
24" Behaves the same as ToggleTabTree except roots directory at VCS root
25function! s:ToggleTabTreeVCS(name)
26 let l:path = g:NERDTreeCreator._pathForString(a:name)
27 let l:path = s:FindParentVCSRoot(l:path)
28 call g:NERDTreeCreator.toggleTabTree(empty(l:path) ? '' : l:path._str())
29endfunction
30
31" FUNCTION: s:FindParentVCSRoot(a:path) {{{1
32" Finds the root version control system folder of the given path. If a:path is
33" not part of a repository, return the original path.
34function! s:FindParentVCSRoot(path)
35 let l:path = a:path
36 while !empty(l:path) &&
37 \ l:path._str() !~# '^\(\a:[\\\/]\|\/\)$' &&
38 \ !isdirectory(l:path._str() . '/.git') &&
39 \ !isdirectory(l:path._str() . '/.svn') &&
40 \ !isdirectory(l:path._str() . '/.hg') &&
41 \ !isdirectory(l:path._str() . '/.bzr') &&
42 \ !isdirectory(l:path._str() . '/_darcs')
43 let l:path = l:path.getParent()
44 endwhile
45 return (empty(l:path) || l:path._str() =~# '^\(\a:[\\\/]\|\/\)$') ? a:path : l:path
46endfunction
47
diff --git a/.vim/pack/vendor/start/nerdtree/plugin/NERD_tree.vim b/.vim/pack/vendor/start/nerdtree/plugin/NERD_tree.vim
new file mode 100644
index 0000000..ef60cca
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/plugin/NERD_tree.vim
@@ -0,0 +1,234 @@
1" ============================================================================
2" File: NERD_tree.vim
3" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
4" License: This program is free software. It comes without any warranty,
5" to the extent permitted by applicable law. You can redistribute
6" it and/or modify it under the terms of the Do What The Fuck You
7" Want To Public License, Version 2, as published by Sam Hocevar.
8" See http://sam.zoy.org/wtfpl/COPYING for more details.
9"
10" ============================================================================
11"
12" SECTION: Script init stuff {{{1
13"============================================================
14scriptencoding utf-8
15
16if exists('loaded_nerd_tree')
17 finish
18endif
19if v:version < 703
20 echoerr "NERDTree: this plugin requires vim >= 7.3. DOWNLOAD IT! You'll thank me later!"
21 finish
22endif
23let loaded_nerd_tree = 1
24
25"for line continuation - i.e dont want C in &cpoptions
26let s:old_cpo = &cpoptions
27set cpoptions&vim
28
29"SECTION: Initialize variable calls and other random constants {{{2
30let g:NERDTreeAutoCenter = get(g:, 'NERDTreeAutoCenter', 1)
31let g:NERDTreeAutoCenterThreshold = get(g:, 'NERDTreeAutoCenterThreshold', 3)
32let g:NERDTreeCaseSensitiveSort = get(g:, 'NERDTreeCaseSensitiveSort', 0)
33let g:NERDTreeNaturalSort = get(g:, 'NERDTreeNaturalSort', 0)
34let g:NERDTreeSortHiddenFirst = get(g:, 'NERDTreeSortHiddenFirst', 1)
35let g:NERDTreeUseTCD = get(g:, 'NERDTreeUseTCD', 0)
36let g:NERDTreeChDirMode = get(g:, 'NERDTreeChDirMode', 0)
37let g:NERDTreeCreatePrefix = get(g:, 'NERDTreeCreatePrefix', 'silent')
38let g:NERDTreeMinimalUI = get(g:, 'NERDTreeMinimalUI', 0)
39let g:NERDTreeMinimalMenu = get(g:, 'NERDTreeMinimalMenu', 0)
40let g:NERDTreeIgnore = get(g:, 'NERDTreeIgnore', ['\~$'])
41let g:NERDTreeBookmarksFile = get(g:, 'NERDTreeBookmarksFile', expand('$HOME') . '/.NERDTreeBookmarks')
42let g:NERDTreeBookmarksSort = get(g:, 'NERDTreeBookmarksSort', 1)
43let g:NERDTreeHighlightCursorline = get(g:, 'NERDTreeHighlightCursorline', 1)
44let g:NERDTreeHijackNetrw = get(g:, 'NERDTreeHijackNetrw', 1)
45let g:NERDTreeMarkBookmarks = get(g:, 'NERDTreeMarkBookmarks', 1)
46let g:NERDTreeMouseMode = get(g:, 'NERDTreeMouseMode', 1)
47let g:NERDTreeNotificationThreshold = get(g:, 'NERDTreeNotificationThreshold', 100)
48let g:NERDTreeQuitOnOpen = get(g:, 'NERDTreeQuitOnOpen', 0)
49let g:NERDTreeRespectWildIgnore = get(g:, 'NERDTreeRespectWildIgnore', 0)
50let g:NERDTreeShowBookmarks = get(g:, 'NERDTreeShowBookmarks', 0)
51let g:NERDTreeShowFiles = get(g:, 'NERDTreeShowFiles', 1)
52let g:NERDTreeShowHidden = get(g:, 'NERDTreeShowHidden', 0)
53let g:NERDTreeShowLineNumbers = get(g:, 'NERDTreeShowLineNumbers', 0)
54let g:NERDTreeSortDirs = get(g:, 'NERDTreeSortDirs', 1)
55
56if !nerdtree#runningWindows() && !nerdtree#runningCygwin()
57 let g:NERDTreeDirArrowExpandable = get(g:, 'NERDTreeDirArrowExpandable', 'â–¸')
58 let g:NERDTreeDirArrowCollapsible = get(g:, 'NERDTreeDirArrowCollapsible', 'â–¾')
59else
60 let g:NERDTreeDirArrowExpandable = get(g:, 'NERDTreeDirArrowExpandable', '+')
61 let g:NERDTreeDirArrowCollapsible = get(g:, 'NERDTreeDirArrowCollapsible', '~')
62endif
63
64let g:NERDTreeCascadeOpenSingleChildDir = get(g:, 'NERDTreeCascadeOpenSingleChildDir', 1)
65let g:NERDTreeCascadeSingleChildDir = get(g:, 'NERDTreeCascadeSingleChildDir', 1)
66
67let g:NERDTreeSortOrder = get(g:, 'NERDTreeSortOrder', ['\/$', '*', '\.swp$', '\.bak$', '\~$'])
68let g:NERDTreeOldSortOrder = []
69
70let g:NERDTreeGlyphReadOnly = get(g:, 'NERDTreeGlyphReadOnly', 'RO')
71
72if has('conceal')
73 let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\x07")
74elseif (g:NERDTreeDirArrowExpandable ==# "\u00a0" || g:NERDTreeDirArrowCollapsible ==# "\u00a0")
75 let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\u00b7")
76else
77 let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\u00a0")
78endif
79
80"the exists() crap here is a hack to stop vim spazzing out when
81"loading a session that was created with an open nerd tree. It spazzes
82"because it doesnt store b:NERDTree(its a b: var, and its a hash)
83let g:NERDTreeStatusline = get(g:, 'NERDTreeStatusline', "%{exists('b:NERDTree')?b:NERDTree.root.path.str():''}")
84
85let g:NERDTreeWinPos = get(g:, 'NERDTreeWinPos', 'left')
86let g:NERDTreeWinSize = get(g:, 'NERDTreeWinSize', 31)
87
88"init the shell commands that will be used to copy nodes, and remove dir trees
89"Note: the space after the command is important
90if nerdtree#runningWindows()
91 let g:NERDTreeRemoveDirCmd = get(g:, 'NERDTreeRemoveDirCmd', 'rmdir /s /q ')
92 let g:NERDTreeCopyDirCmd = get(g:, 'NERDTreeCopyDirCmd', 'xcopy /s /e /i /y /q ')
93 let g:NERDTreeCopyFileCmd = get(g:, 'NERDTreeCopyFileCmd', 'copy /y ')
94else
95 let g:NERDTreeRemoveDirCmd = get(g:, 'NERDTreeRemoveDirCmd', 'rm -rf ')
96 let g:NERDTreeCopyCmd = get(g:, 'NERDTreeCopyCmd', 'cp -r ')
97endif
98
99"SECTION: Init variable calls for key mappings {{{2
100let g:NERDTreeMapCustomOpen = get(g:, 'NERDTreeMapCustomOpen', '<CR>')
101let g:NERDTreeMapActivateNode = get(g:, 'NERDTreeMapActivateNode', 'o')
102let g:NERDTreeMapChangeRoot = get(g:, 'NERDTreeMapChangeRoot', 'C')
103let g:NERDTreeMapChdir = get(g:, 'NERDTreeMapChdir', 'cd')
104let g:NERDTreeMapCloseChildren = get(g:, 'NERDTreeMapCloseChildren', 'X')
105let g:NERDTreeMapCloseDir = get(g:, 'NERDTreeMapCloseDir', 'x')
106let g:NERDTreeMapDeleteBookmark = get(g:, 'NERDTreeMapDeleteBookmark', 'D')
107let g:NERDTreeMapMenu = get(g:, 'NERDTreeMapMenu', 'm')
108let g:NERDTreeMapHelp = get(g:, 'NERDTreeMapHelp', '?')
109let g:NERDTreeMapJumpFirstChild = get(g:, 'NERDTreeMapJumpFirstChild', 'K')
110let g:NERDTreeMapJumpLastChild = get(g:, 'NERDTreeMapJumpLastChild', 'J')
111let g:NERDTreeMapJumpNextSibling = get(g:, 'NERDTreeMapJumpNextSibling', '<C-j>')
112let g:NERDTreeMapJumpParent = get(g:, 'NERDTreeMapJumpParent', 'p')
113let g:NERDTreeMapJumpPrevSibling = get(g:, 'NERDTreeMapJumpPrevSibling', '<C-k>')
114let g:NERDTreeMapJumpRoot = get(g:, 'NERDTreeMapJumpRoot', 'P')
115let g:NERDTreeMapOpenExpl = get(g:, 'NERDTreeMapOpenExpl', 'e')
116let g:NERDTreeMapOpenInTab = get(g:, 'NERDTreeMapOpenInTab', 't')
117let g:NERDTreeMapOpenInTabSilent = get(g:, 'NERDTreeMapOpenInTabSilent', 'T')
118let g:NERDTreeMapOpenRecursively = get(g:, 'NERDTreeMapOpenRecursively', 'O')
119let g:NERDTreeMapOpenSplit = get(g:, 'NERDTreeMapOpenSplit', 'i')
120let g:NERDTreeMapOpenVSplit = get(g:, 'NERDTreeMapOpenVSplit', 's')
121let g:NERDTreeMapPreview = get(g:, 'NERDTreeMapPreview', 'g'.NERDTreeMapActivateNode)
122let g:NERDTreeMapPreviewSplit = get(g:, 'NERDTreeMapPreviewSplit', 'g'.NERDTreeMapOpenSplit)
123let g:NERDTreeMapPreviewVSplit = get(g:, 'NERDTreeMapPreviewVSplit', 'g'.NERDTreeMapOpenVSplit)
124let g:NERDTreeMapQuit = get(g:, 'NERDTreeMapQuit', 'q')
125let g:NERDTreeMapRefresh = get(g:, 'NERDTreeMapRefresh', 'r')
126let g:NERDTreeMapRefreshRoot = get(g:, 'NERDTreeMapRefreshRoot', 'R')
127let g:NERDTreeMapToggleBookmarks = get(g:, 'NERDTreeMapToggleBookmarks', 'B')
128let g:NERDTreeMapToggleFiles = get(g:, 'NERDTreeMapToggleFiles', 'F')
129let g:NERDTreeMapToggleFilters = get(g:, 'NERDTreeMapToggleFilters', 'f')
130let g:NERDTreeMapToggleHidden = get(g:, 'NERDTreeMapToggleHidden', 'I')
131let g:NERDTreeMapToggleZoom = get(g:, 'NERDTreeMapToggleZoom', 'A')
132let g:NERDTreeMapUpdir = get(g:, 'NERDTreeMapUpdir', 'u')
133let g:NERDTreeMapUpdirKeepOpen = get(g:, 'NERDTreeMapUpdirKeepOpen', 'U')
134let g:NERDTreeMapCWD = get(g:, 'NERDTreeMapCWD', 'CD')
135let g:NERDTreeMenuDown = get(g:, 'NERDTreeMenuDown', 'j')
136let g:NERDTreeMenuUp = get(g:, 'NERDTreeMenuUp', 'k')
137
138"SECTION: Load class files{{{2
139call nerdtree#loadClassFiles()
140
141" SECTION: Commands {{{1
142"============================================================
143call nerdtree#ui_glue#setupCommands()
144
145" SECTION: Auto commands {{{1
146"============================================================
147augroup NERDTree
148 "Save the cursor position whenever we close the nerd tree
149 exec 'autocmd BufLeave,WinLeave '. g:NERDTreeCreator.BufNamePrefix() .'* if g:NERDTree.IsOpen() | call b:NERDTree.ui.saveScreenState() | endif'
150
151 "disallow insert mode in the NERDTree
152 exec 'autocmd BufEnter,WinEnter '. g:NERDTreeCreator.BufNamePrefix() .'* stopinsert'
153augroup END
154
155if g:NERDTreeHijackNetrw
156 augroup NERDTreeHijackNetrw
157 autocmd VimEnter * silent! autocmd! FileExplorer
158 au BufEnter,VimEnter * call nerdtree#checkForBrowse(expand('<amatch>'))
159 augroup END
160endif
161
162if g:NERDTreeChDirMode ==# 3
163 augroup NERDTreeChDirOnTabSwitch
164 autocmd TabEnter * if g:NERDTree.ExistsForTab()|call g:NERDTree.ForCurrentTab().getRoot().path.changeToDir()|endif
165 augroup END
166endif
167
168" SECTION: Public API {{{1
169"============================================================
170function! NERDTreeAddMenuItem(options)
171 call g:NERDTreeMenuItem.Create(a:options)
172endfunction
173
174function! NERDTreeAddMenuSeparator(...)
175 let opts = a:0 ? a:1 : {}
176 call g:NERDTreeMenuItem.CreateSeparator(opts)
177endfunction
178
179function! NERDTreeAddSubmenu(options)
180 return g:NERDTreeMenuItem.Create(a:options)
181endfunction
182
183function! NERDTreeAddKeyMap(options)
184 call g:NERDTreeKeyMap.Create(a:options)
185endfunction
186
187function! NERDTreeRender()
188 call nerdtree#renderView()
189endfunction
190
191function! NERDTreeFocus()
192 if g:NERDTree.IsOpen()
193 call g:NERDTree.CursorToTreeWin(0)
194 else
195 call g:NERDTreeCreator.ToggleTabTree('')
196 endif
197endfunction
198
199function! NERDTreeCWD()
200
201 if empty(getcwd())
202 call nerdtree#echoWarning('current directory does not exist')
203 return
204 endif
205
206 try
207 let l:cwdPath = g:NERDTreePath.New(getcwd())
208 catch /^NERDTree.InvalidArgumentsError/
209 call nerdtree#echoWarning('current directory does not exist')
210 return
211 endtry
212
213 call NERDTreeFocus()
214
215 if b:NERDTree.root.path.equals(l:cwdPath)
216 return
217 endif
218
219 let l:newRoot = g:NERDTreeFileNode.New(l:cwdPath, b:NERDTree)
220 call b:NERDTree.changeRoot(l:newRoot)
221 normal! ^
222endfunction
223
224function! NERDTreeAddPathFilter(callback)
225 call g:NERDTree.AddPathFilter(a:callback)
226endfunction
227
228" SECTION: Post Source Actions {{{1
229call nerdtree#postSourceActions()
230
231"reset &cpoptions back to users setting
232let &cpoptions = s:old_cpo
233
234" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/.vim/pack/vendor/start/nerdtree/syntax/nerdtree.vim b/.vim/pack/vendor/start/nerdtree/syntax/nerdtree.vim
new file mode 100644
index 0000000..c4197ee
--- /dev/null
+++ b/.vim/pack/vendor/start/nerdtree/syntax/nerdtree.vim
@@ -0,0 +1,97 @@
1let s:tree_up_dir_line = '.. (up a dir)'
2syn match NERDTreeIgnore #\~#
3exec 'syn match NERDTreeIgnore #\['.g:NERDTreeGlyphReadOnly.'\]#'
4
5"highlighting for the .. (up dir) line at the top of the tree
6execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line .'#'
7
8"quickhelp syntax elements
9syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#ms=s+2,me=e-1
10syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#ms=s+2,me=e-1
11syn match NERDTreeHelpTitle #" .*\~$#ms=s+2,me=e-1
12syn match NERDTreeToggleOn #(on)#ms=s+1,he=e-1
13syn match NERDTreeToggleOff #(off)#ms=e-3,me=e-1
14syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3
15syn match NERDTreeHelp #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeIgnore,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand
16
17"highlighting for sym links
18syn match NERDTreeLinkTarget #->.*# containedin=NERDTreeDir,NERDTreeFile
19syn match NERDTreeLinkFile #.* ->#me=e-3 containedin=NERDTreeFile
20syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir
21
22"highlighting to conceal the delimiter around the file/dir name
23if has('conceal')
24 exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# conceal containedin=ALL'
25 setlocal conceallevel=2 concealcursor=nvic
26else
27 exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# containedin=ALL'
28 hi! link NERDTreeNodeDelimiters Ignore
29endif
30
31"highlighing for directory nodes and file nodes
32syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
33
34if g:NERDTreeDirArrowExpandable !=# ''
35 exec 'syn match NERDTreeClosable #' . escape(g:NERDTreeDirArrowCollapsible, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
36 exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
37 let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
38 exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
39 exec 'syn match NERDTreeExecFile #^.*'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmarkName'
40 exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmarkName,NERDTreeExecFile'
41else
42 exec 'syn match NERDTreeDir #[^'.g:NERDTreeNodeDelimiter.']\{-}/\ze\($\|'.g:NERDTreeNodeDelimiter.'\)#'
43 exec 'syn match NERDTreeExecFile #[^'.g:NERDTreeNodeDelimiter.']\{-}'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmarkName'
44 exec 'syn match NERDTreeFile #^.*'.g:NERDTreeNodeDelimiter.'.*[^\/]\($\|'.g:NERDTreeNodeDelimiter.'.*\)# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmarkName,NERDTreeExecFile'
45endif
46
47"highlighting for readonly files
48exec 'syn match NERDTreeRO #.*'.g:NERDTreeNodeDelimiter.'\zs.*\ze'.g:NERDTreeNodeDelimiter.'.*\['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmarkName,NERDTreeFile'
49
50exec 'syn match NERDTreeFlags #\[[^\]]*\]\ze'.g:NERDTreeNodeDelimiter.'# containedin=NERDTreeFile,NERDTreeExecFile,NERDTreeLinkFile,NERDTreeRO,NERDTreeDir'
51
52syn match NERDTreeCWD #^[</].*$#
53
54"highlighting for bookmarks
55syn match NERDTreeBookmarkName # {.*}#hs=s+2,he=e-1
56
57"highlighting for the bookmarks table
58syn match NERDTreeBookmarksLeader #^>#
59syn match NERDTreeBookmarksHeader #^>-\+Bookmarks-\+$# contains=NERDTreeBookmarksLeader
60syn match NERDTreeBookmarkName #^>.\{-} #he=e-1 contains=NERDTreeBookmarksLeader
61syn match NERDTreeBookmark #^>.*$# contains=NERDTreeBookmarksLeader,NERDTreeBookmarkName,NERDTreeBookmarksHeader
62
63hi def link NERDTreePart Special
64hi def link NERDTreePartFile Type
65hi def link NERDTreeExecFile Title
66hi def link NERDTreeDirSlash Identifier
67
68hi def link NERDTreeBookmarksHeader statement
69hi def link NERDTreeBookmarksLeader ignore
70hi def link NERDTreeBookmarkName Identifier
71hi def link NERDTreeBookmark normal
72
73hi def link NERDTreeHelp String
74hi def link NERDTreeHelpKey Identifier
75hi def link NERDTreeHelpCommand Identifier
76hi def link NERDTreeHelpTitle Macro
77hi def link NERDTreeToggleOn Question
78hi def link NERDTreeToggleOff WarningMsg
79
80hi def link NERDTreeLinkTarget Type
81hi def link NERDTreeLinkFile Macro
82hi def link NERDTreeLinkDir Macro
83
84hi def link NERDTreeDir Directory
85hi def link NERDTreeUp Directory
86hi def link NERDTreeFile Normal
87hi def link NERDTreeCWD Statement
88hi def link NERDTreeOpenable Directory
89hi def link NERDTreeClosable Directory
90hi def link NERDTreeIgnore ignore
91hi def link NERDTreeRO WarningMsg
92hi def link NERDTreeBookmark Statement
93hi def link NERDTreeFlags Number
94
95hi def link NERDTreeCurrentNode Search
96
97hi NERDTreeFile ctermbg=NONE guibg=NONE