diff options
author | Sam Chudnick <sam@chudnick.com> | 2023-06-11 07:54:59 -0400 |
---|---|---|
committer | Sam Chudnick <sam@chudnick.com> | 2023-06-11 07:54:59 -0400 |
commit | 3adcf542289a0883924ae9b9be8b898c36702c95 (patch) | |
tree | f02166ef4c95161ffa994eb1a3e5729c93c2c66b /.vim/pack/vendor | |
parent | dfcc303e7cc284a45f55bae81ed888dc256432b8 (diff) |
Add some Vim plugins
Diffstat (limited to '.vim/pack/vendor')
42 files changed, 10746 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 @@ | |||
1 | if exists('g:loaded_nerdtree_autoload') | ||
2 | finish | ||
3 | endif | ||
4 | let g:loaded_nerdtree_autoload = 1 | ||
5 | |||
6 | let 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. | ||
12 | function! 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 | ||
28 | endfunction | ||
29 | |||
30 | " SECTION: General Functions {{{1 | ||
31 | "============================================================ | ||
32 | |||
33 | " FUNCTION: nerdtree#closeTreeOnOpen() {{{2 | ||
34 | function! nerdtree#closeTreeOnOpen() abort | ||
35 | return g:NERDTreeQuitOnOpen == 1 || g:NERDTreeQuitOnOpen == 3 | ||
36 | endfunction | ||
37 | |||
38 | " FUNCTION: nerdtree#closeBookmarksOnOpen() {{{2 | ||
39 | function! nerdtree#closeBookmarksOnOpen() abort | ||
40 | return g:NERDTreeQuitOnOpen == 2 || g:NERDTreeQuitOnOpen == 3 | ||
41 | endfunction | ||
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. | ||
47 | function! nerdtree#slash() abort | ||
48 | if nerdtree#runningWindows() | ||
49 | if exists('+shellslash') && &shellslash | ||
50 | return '/' | ||
51 | endif | ||
52 | |||
53 | return '\' | ||
54 | endif | ||
55 | |||
56 | return '/' | ||
57 | endfunction | ||
58 | |||
59 | "FUNCTION: nerdtree#checkForBrowse(dir) {{{2 | ||
60 | "inits a window tree in the current buffer if appropriate | ||
61 | function! 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) | ||
71 | endfunction | ||
72 | |||
73 | "FUNCTION: s:reuseWin(dir) {{{2 | ||
74 | "finds a NERDTree buffer with root of dir, and opens it. | ||
75 | function! 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 | ||
93 | endfunction | ||
94 | |||
95 | " FUNCTION: nerdtree#completeBookmarks(A,L,P) {{{2 | ||
96 | " completion function for the bookmark commands | ||
97 | function! nerdtree#completeBookmarks(A,L,P) abort | ||
98 | return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"') | ||
99 | endfunction | ||
100 | |||
101 | "FUNCTION: nerdtree#compareNodes(n1, n2) {{{2 | ||
102 | function! nerdtree#compareNodes(n1, n2) abort | ||
103 | return nerdtree#compareNodePaths(a:n1.path, a:n2.path) | ||
104 | endfunction | ||
105 | |||
106 | "FUNCTION: nerdtree#compareNodePaths(p1, p2) {{{2 | ||
107 | function! 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 | ||
138 | endfunction | ||
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 | ||
143 | function! 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 | ||
153 | endfunction | ||
154 | |||
155 | " FUNCTION: nerdtree#exec(cmd, ignoreAll) {{{2 | ||
156 | " Same as :exec cmd but, if ignoreAll is TRUE, set eventignore=all for the duration | ||
157 | function! 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 | ||
167 | endfunction | ||
168 | |||
169 | " FUNCTION: nerdtree#has_opt(options, name) {{{2 | ||
170 | function! nerdtree#has_opt(options, name) abort | ||
171 | return has_key(a:options, a:name) && a:options[a:name] ==# 1 | ||
172 | endfunction | ||
173 | |||
174 | " FUNCTION: nerdtree#loadClassFiles() {{{2 | ||
175 | function! 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 | ||
190 | endfunction | ||
191 | |||
192 | " FUNCTION: nerdtree#postSourceActions() {{{2 | ||
193 | function! 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 | ||
199 | endfunction | ||
200 | |||
201 | "FUNCTION: nerdtree#runningWindows(dir) {{{2 | ||
202 | function! nerdtree#runningWindows() abort | ||
203 | return has('win16') || has('win32') || has('win64') | ||
204 | endfunction | ||
205 | |||
206 | "FUNCTION: nerdtree#runningCygwin(dir) {{{2 | ||
207 | function! nerdtree#runningCygwin() abort | ||
208 | return has('win32unix') | ||
209 | endfunction | ||
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 | ||
219 | function! nerdtree#echo(msg) abort | ||
220 | redraw | ||
221 | echomsg empty(a:msg) ? '' : ('NERDTree: ' . a:msg) | ||
222 | endfunction | ||
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 | ||
228 | function! nerdtree#echoError(msg) abort | ||
229 | echohl errormsg | ||
230 | call nerdtree#echo(a:msg) | ||
231 | echohl normal | ||
232 | endfunction | ||
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 | ||
238 | function! nerdtree#echoWarning(msg) abort | ||
239 | echohl warningmsg | ||
240 | call nerdtree#echo(a:msg) | ||
241 | echohl normal | ||
242 | endfunction | ||
243 | |||
244 | "FUNCTION: nerdtree#renderView {{{2 | ||
245 | function! nerdtree#renderView() abort | ||
246 | call b:NERDTree.render() | ||
247 | endfunction | ||
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 @@ | |||
1 | if exists('g:loaded_nerdtree_ui_glue_autoload') | ||
2 | finish | ||
3 | endif | ||
4 | let g:loaded_nerdtree_ui_glue_autoload = 1 | ||
5 | |||
6 | " FUNCTION: nerdtree#ui_glue#createDefaultBindings() {{{1 | ||
7 | function! 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' }) | ||
82 | endfunction | ||
83 | |||
84 | |||
85 | "SECTION: Interface bindings {{{1 | ||
86 | "============================================================ | ||
87 | |||
88 | "FUNCTION: s:customOpenFile() {{{1 | ||
89 | " Open file node with the 'custom' key, initially <CR>. | ||
90 | function! s:customOpenFile(node) abort | ||
91 | call a:node.activate(s:initCustomOpenArgs().file) | ||
92 | endfunction | ||
93 | |||
94 | "FUNCTION: s:customOpenDir() {{{1 | ||
95 | " Open directory node with the 'custom' key, initially <CR>. | ||
96 | function! s:customOpenDir(node) abort | ||
97 | call s:activateDirNode(a:node, s:initCustomOpenArgs().dir) | ||
98 | endfunction | ||
99 | |||
100 | "FUNCTION: s:customOpenBookmark() {{{1 | ||
101 | " Open bookmark node with the 'custom' key, initially <CR>. | ||
102 | function! 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 | ||
108 | endfunction | ||
109 | |||
110 | "FUNCTION: s:initCustomOpenArgs() {{{1 | ||
111 | function! 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 | ||
122 | endfunction | ||
123 | |||
124 | "FUNCTION: s:activateAll() {{{1 | ||
125 | "handle the user activating the updir line | ||
126 | function! s:activateAll() abort | ||
127 | if getline('.') ==# g:NERDTreeUI.UpDirLine() | ||
128 | return nerdtree#ui_glue#upDir(0) | ||
129 | endif | ||
130 | endfunction | ||
131 | |||
132 | " FUNCTION: s:activateDirNode(directoryNode, options) {{{1 | ||
133 | " Open a directory with optional options | ||
134 | function! 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 : {}) | ||
142 | endfunction | ||
143 | |||
144 | "FUNCTION: s:activateFileNode() {{{1 | ||
145 | "handle the user activating a tree node | ||
146 | function! s:activateFileNode(node) abort | ||
147 | call a:node.activate({'reuse': 'all', 'where': 'p', 'keepopen': !nerdtree#closeTreeOnOpen()}) | ||
148 | endfunction | ||
149 | |||
150 | "FUNCTION: s:activateBookmark(bookmark) {{{1 | ||
151 | "handle the user activating a bookmark | ||
152 | function! s:activateBookmark(bm) abort | ||
153 | call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p', 'keepopen': !nerdtree#closeTreeOnOpen()} : {}) | ||
154 | endfunction | ||
155 | |||
156 | " FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1 | ||
157 | " Associate the current node with the given name | ||
158 | function! 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 | ||
174 | endfunction | ||
175 | |||
176 | " FUNCTION: s:chCwd(node) {{{1 | ||
177 | function! 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 | ||
183 | endfunction | ||
184 | |||
185 | " FUNCTION: s:chRoot(node) {{{1 | ||
186 | " changes the current root to the selected one | ||
187 | function! s:chRoot(node) abort | ||
188 | call b:NERDTree.changeRoot(a:node) | ||
189 | endfunction | ||
190 | |||
191 | " FUNCTION: s:nerdtree#ui_glue#chRootCwd() {{{1 | ||
192 | " Change the NERDTree root to match the current working directory. | ||
193 | function! nerdtree#ui_glue#chRootCwd() abort | ||
194 | NERDTreeCWD | ||
195 | endfunction | ||
196 | |||
197 | " FUNCTION: nnerdtree#ui_glue#clearBookmarks(bookmarks) {{{1 | ||
198 | function! 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() | ||
212 | endfunction | ||
213 | |||
214 | " FUNCTION: s:closeChildren(node) {{{1 | ||
215 | " closes all childnodes of the current node | ||
216 | function! s:closeChildren(node) abort | ||
217 | call a:node.closeChildren() | ||
218 | call b:NERDTree.render() | ||
219 | call a:node.putCursorHere(0, 0) | ||
220 | endfunction | ||
221 | |||
222 | " FUNCTION: s:closeCurrentDir(node) {{{1 | ||
223 | " Close the parent directory of the current node. | ||
224 | function! 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) | ||
245 | endfunction | ||
246 | |||
247 | " FUNCTION: s:closeTreeWindow() {{{1 | ||
248 | " close the tree window | ||
249 | function! 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 | ||
259 | endfunction | ||
260 | |||
261 | " FUNCTION: s:deleteBookmark(bookmark) {{{1 | ||
262 | " Prompt the user to confirm the deletion of the selected bookmark. | ||
263 | function! 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 | ||
285 | endfunction | ||
286 | |||
287 | " FUNCTION: s:displayHelp() {{{1 | ||
288 | " toggles the help display | ||
289 | function! s:displayHelp() abort | ||
290 | call b:NERDTree.ui.toggleHelp() | ||
291 | call b:NERDTree.render() | ||
292 | call b:NERDTree.ui.centerView() | ||
293 | endfunction | ||
294 | |||
295 | " FUNCTION: s:findAndRevealPath(pathStr) {{{1 | ||
296 | function! 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) | ||
346 | endfunction | ||
347 | |||
348 | "FUNCTION: s:handleLeftClick() {{{1 | ||
349 | "Checks if the click should open the current node | ||
350 | function! 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 | ||
382 | endfunction | ||
383 | |||
384 | " FUNCTION: s:handleMiddleMouse() {{{1 | ||
385 | function! 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 | ||
403 | endfunction | ||
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 | ||
408 | function! nerdtree#ui_glue#invokeKeyMap(key) abort | ||
409 | call g:NERDTreeKeyMap.Invoke(a:key) | ||
410 | endfunction | ||
411 | |||
412 | " FUNCTION: s:jumpToFirstChild(node) {{{1 | ||
413 | function! s:jumpToFirstChild(node) abort | ||
414 | call s:jumpToChild(a:node, 0) | ||
415 | endfunction | ||
416 | |||
417 | " FUNCTION: s:jumpToLastChild(node) {{{1 | ||
418 | function! s:jumpToLastChild(node) abort | ||
419 | call s:jumpToChild(a:node, 1) | ||
420 | endfunction | ||
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 | ||
428 | function! 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() | ||
442 | endfunction | ||
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. | ||
447 | function! 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() | ||
461 | endfunction | ||
462 | |||
463 | " FUNCTION: s:jumpToRoot() {{{1 | ||
464 | " moves the cursor to the root node | ||
465 | function! s:jumpToRoot() abort | ||
466 | call b:NERDTree.root.putCursorHere(1, 0) | ||
467 | call b:NERDTree.ui.centerView() | ||
468 | endfunction | ||
469 | |||
470 | " FUNCTION: s:jumpToNextSibling(node) {{{1 | ||
471 | function! s:jumpToNextSibling(node) abort | ||
472 | call s:jumpToSibling(a:node, 1) | ||
473 | endfunction | ||
474 | |||
475 | " FUNCTION: s:jumpToPrevSibling(node) {{{1 | ||
476 | function! s:jumpToPrevSibling(node) abort | ||
477 | call s:jumpToSibling(a:node, 0) | ||
478 | endfunction | ||
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 | ||
486 | function! 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() | ||
496 | endfunction | ||
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. | ||
501 | function! 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) | ||
514 | endfunction | ||
515 | |||
516 | " FUNCTION: s:openHSplit(target) {{{1 | ||
517 | function! s:openHSplit(target) abort | ||
518 | call a:target.activate({'where': 'h', 'keepopen': !nerdtree#closeTreeOnOpen()}) | ||
519 | endfunction | ||
520 | |||
521 | " FUNCTION: s:openVSplit(target) {{{1 | ||
522 | function! s:openVSplit(target) abort | ||
523 | call a:target.activate({'where': 'v', 'keepopen': !nerdtree#closeTreeOnOpen()}) | ||
524 | endfunction | ||
525 | |||
526 | "FUNCTION: s:openHSplitBookmark(bookmark) {{{1 | ||
527 | "handle the user activating a bookmark | ||
528 | function! s:openHSplitBookmark(bm) abort | ||
529 | call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'h', 'keepopen': !nerdtree#closeTreeOnOpen()} : {}) | ||
530 | endfunction | ||
531 | |||
532 | "FUNCTION: s:openVSplitBookmark(bookmark) {{{1 | ||
533 | "handle the user activating a bookmark | ||
534 | function! s:openVSplitBookmark(bm) abort | ||
535 | call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'v', 'keepopen': !nerdtree#closeTreeOnOpen()} : {}) | ||
536 | endfunction | ||
537 | |||
538 | " FUNCTION: s:previewHSplitBookmark(bookmark) {{{1 | ||
539 | function! s:previewNodeHSplitBookmark(bookmark) abort | ||
540 | call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'h', 'keepopen': 1} : {}) | ||
541 | endfunction | ||
542 | |||
543 | " FUNCTION: s:previewVSplitBookmark(bookmark) {{{1 | ||
544 | function! s:previewNodeVSplitBookmark(bookmark) abort | ||
545 | call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'v', 'keepopen': 1} : {}) | ||
546 | endfunction | ||
547 | |||
548 | " FUNCTION: s:openExplorer(node) {{{1 | ||
549 | function! s:openExplorer(node) abort | ||
550 | call a:node.openExplorer() | ||
551 | endfunction | ||
552 | |||
553 | " FUNCTION: s:openInNewTab(target) {{{1 | ||
554 | function! 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) | ||
557 | endfunction | ||
558 | |||
559 | " FUNCTION: s:openInNewTabSilent(target) {{{1 | ||
560 | function! 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) | ||
563 | endfunction | ||
564 | |||
565 | " FUNCTION: s:openNodeRecursively(node) {{{1 | ||
566 | function! 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('') | ||
571 | endfunction | ||
572 | |||
573 | " FUNCTION: s:previewBookmark(bookmark) {{{1 | ||
574 | function! 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 | ||
580 | endfunction | ||
581 | |||
582 | "FUNCTION: s:previewNodeCurrent(node) {{{1 | ||
583 | function! s:previewNodeCurrent(node) abort | ||
584 | call a:node.open({'stay': 1, 'where': 'p', 'keepopen': 1}) | ||
585 | endfunction | ||
586 | |||
587 | "FUNCTION: s:previewNodeHSplit(node) {{{1 | ||
588 | function! s:previewNodeHSplit(node) abort | ||
589 | call a:node.open({'stay': 1, 'where': 'h', 'keepopen': 1}) | ||
590 | endfunction | ||
591 | |||
592 | "FUNCTION: s:previewNodeVSplit(node) {{{1 | ||
593 | function! s:previewNodeVSplit(node) abort | ||
594 | call a:node.open({'stay': 1, 'where': 'v', 'keepopen': 1}) | ||
595 | endfunction | ||
596 | |||
597 | " FUNCTION: nerdtree#ui_glue#revealBookmark(name) {{{1 | ||
598 | " put the cursor on the node associate with the given name | ||
599 | function! 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 | ||
606 | endfunction | ||
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. | ||
611 | function! 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('') | ||
624 | endfunction | ||
625 | |||
626 | " FUNCTION: s:refreshCurrent(node) {{{1 | ||
627 | " refreshes the root for the current node | ||
628 | function! 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('') | ||
638 | endfunction | ||
639 | |||
640 | " FUNCTION: nerdtree#ui_glue#setupCommands() {{{1 | ||
641 | function! 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() | ||
651 | endfunction | ||
652 | |||
653 | " Function: s:SID() {{{1 | ||
654 | function! 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 | ||
659 | endfun | ||
660 | |||
661 | " FUNCTION: s:showMenu(node) {{{1 | ||
662 | function! s:showMenu(node) abort | ||
663 | let mc = g:NERDTreeMenuController.New(g:NERDTreeMenuItem.AllEnabled()) | ||
664 | call mc.showMenu() | ||
665 | endfunction | ||
666 | |||
667 | " FUNCTION: s:toggleIgnoreFilter() {{{1 | ||
668 | function! s:toggleIgnoreFilter() abort | ||
669 | call b:NERDTree.ui.toggleIgnoreFilter() | ||
670 | endfunction | ||
671 | |||
672 | " FUNCTION: s:toggleShowBookmarks() {{{1 | ||
673 | function! s:toggleShowBookmarks() abort | ||
674 | call b:NERDTree.ui.toggleShowBookmarks() | ||
675 | endfunction | ||
676 | |||
677 | " FUNCTION: s:toggleShowFiles() {{{1 | ||
678 | function! s:toggleShowFiles() abort | ||
679 | call b:NERDTree.ui.toggleShowFiles() | ||
680 | endfunction | ||
681 | |||
682 | " FUNCTION: s:toggleShowHidden() {{{1 | ||
683 | " toggles the display of hidden files | ||
684 | function! s:toggleShowHidden() abort | ||
685 | call b:NERDTree.ui.toggleShowHidden() | ||
686 | endfunction | ||
687 | |||
688 | " FUNCTION: s:toggleZoom() {{{1 | ||
689 | function! s:toggleZoom() abort | ||
690 | call b:NERDTree.ui.toggleZoom() | ||
691 | endfunction | ||
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 | ||
699 | function! 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) | ||
720 | endfunction | ||
721 | |||
722 | " FUNCTION: s:upDirCurrentRootOpen() {{{1 | ||
723 | function! s:upDirCurrentRootOpen() abort | ||
724 | call nerdtree#ui_glue#upDir(1) | ||
725 | endfunction | ||
726 | |||
727 | " FUNCTION: s:upDirCurrentRootClosed() {{{1 | ||
728 | function! s:upDirCurrentRootClosed() abort | ||
729 | call nerdtree#ui_glue#upDir(0) | ||
730 | endfunction | ||
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 | ============================================================================== | ||
20 | CONTENTS *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 | ============================================================================== | ||
43 | 1. Intro *NERDTree* | ||
44 | |||
45 | What is this "NERDTree"?? | ||
46 | |||
47 | The NERDTree allows you to explore your filesystem and to open files and | ||
48 | directories. It presents the filesystem to you in the form of a tree which you | ||
49 | manipulate with the keyboard and/or mouse. It also allows you to perform | ||
50 | simple filesystem operations. | ||
51 | |||
52 | The 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 | ============================================================================== | ||
97 | 2. Functionality provided *NERDTreeFunctionality* | ||
98 | |||
99 | ------------------------------------------------------------------------------ | ||
100 | 2.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 | ------------------------------------------------------------------------------ | ||
169 | 2.2. Bookmarks *NERDTreeBookmarks* | ||
170 | |||
171 | Bookmarks in the NERDTree are a way to tag files or directories of interest. | ||
172 | For example, you could use bookmarks to tag all of your project directories. | ||
173 | |||
174 | ------------------------------------------------------------------------------ | ||
175 | 2.2.1. The Bookmark Table *NERDTreeBookmarkTable* | ||
176 | |||
177 | If the bookmark table is active (see |NERDTree-B| and | ||
178 | |NERDTreeShowBookmarks|), it will be rendered above the tree. You can double | ||
179 | click bookmarks or use the |NERDTree-o| mapping to activate them. See also, | ||
180 | |NERDTree-t| and |NERDTree-T| | ||
181 | |||
182 | ------------------------------------------------------------------------------ | ||
183 | 2.2.2. Bookmark commands *NERDTreeBookmarkCommands* | ||
184 | |||
185 | Note: 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 | |||
225 | See also |:NERDTree| and |:NERDTreeFromBookmark|. | ||
226 | |||
227 | ------------------------------------------------------------------------------ | ||
228 | 2.2.3. Invalid Bookmarks *NERDTreeInvalidBookmarks* | ||
229 | |||
230 | If invalid bookmarks are detected, the script will issue an error message and | ||
231 | the invalid bookmarks will become unavailable for use. | ||
232 | |||
233 | These bookmarks will still be stored in the bookmarks file (see | ||
234 | |NERDTreeBookmarksFile|), down at the bottom. There will always be a blank line | ||
235 | after the valid bookmarks but before the invalid ones. | ||
236 | |||
237 | Each line in the bookmarks file represents one bookmark. The proper format is: | ||
238 | <bookmark name><space><full path to the bookmark location> | ||
239 | |||
240 | You can use the :EditBookmarks command to open the bookmarks file for editing. | ||
241 | After you have corrected any invalid bookmarks, either restart vim, or run | ||
242 | :ReadBookmarks from the NERDTree window. | ||
243 | |||
244 | ------------------------------------------------------------------------------ | ||
245 | 2.3. NERDTree Mappings *NERDTreeMappings* | ||
246 | |||
247 | Default~ | ||
248 | Key Description help-tag~ | ||
249 | |||
250 | o........Open files, directories and bookmarks......................|NERDTree-o| | ||
251 | go.......Open selected file, but leave cursor in the NERDTree......|NERDTree-go| | ||
252 | Find selected bookmark directory in current NERDTree | ||
253 | t........Open selected node/bookmark in a new tab...................|NERDTree-t| | ||
254 | T........Same as 't' but keep the focus on the current tab..........|NERDTree-T| | ||
255 | i........Open selected file in a split window.......................|NERDTree-i| | ||
256 | gi.......Same as i, but leave the cursor on the NERDTree...........|NERDTree-gi| | ||
257 | s........Open selected file in a new vsplit.........................|NERDTree-s| | ||
258 | gs.......Same as s, but leave the cursor on the NERDTree...........|NERDTree-gs| | ||
259 | <CR>.....User-definable custom open action.......................|NERDTree-<CR>| | ||
260 | O........Recursively open the selected directory....................|NERDTree-O| | ||
261 | x........Close the current nodes parent.............................|NERDTree-x| | ||
262 | X........Recursively close all children of the current node.........|NERDTree-X| | ||
263 | e........Edit the current directory.................................|NERDTree-e| | ||
264 | |||
265 | double-click....same as |NERDTree-o|. | ||
266 | middle-click....same as |NERDTree-i| for files, and |NERDTree-e| for directories. | ||
267 | |||
268 | D........Delete the current bookmark ...............................|NERDTree-D| | ||
269 | |||
270 | P........Jump to the root node......................................|NERDTree-P| | ||
271 | p........Jump to current nodes parent...............................|NERDTree-p| | ||
272 | K........Jump up inside directories at the current tree depth.......|NERDTree-K| | ||
273 | J........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 | |||
277 | C........Change the tree root to the selected directory.............|NERDTree-C| | ||
278 | u........Move the tree root up one directory........................|NERDTree-u| | ||
279 | U........Same as 'u' except the old root node is left open..........|NERDTree-U| | ||
280 | r........Recursively refresh the current directory..................|NERDTree-r| | ||
281 | R........Recursively refresh the current root.......................|NERDTree-R| | ||
282 | m........Display the NERDTree menu..................................|NERDTree-m| | ||
283 | cd.......Change the CWD to the directory of the selected node......|NERDTree-cd| | ||
284 | CD.......Change tree root to the CWD...............................|NERDTree-CD| | ||
285 | |||
286 | I........Toggle whether hidden files displayed......................|NERDTree-I| | ||
287 | f........Toggle whether the file filters are used...................|NERDTree-f| | ||
288 | F........Toggle whether files are displayed.........................|NERDTree-F| | ||
289 | B........Toggle whether the bookmark table is displayed.............|NERDTree-B| | ||
290 | |||
291 | q........Close the NERDTree window..................................|NERDTree-q| | ||
292 | A........Zoom (maximize/minimize) the NERDTree window...............|NERDTree-A| | ||
293 | ?........Toggle the display of the quick help.......................|NERDTree-?| | ||
294 | |||
295 | ------------------------------------------------------------------------------ | ||
296 | *NERDTree-o* | ||
297 | Default key: o | ||
298 | Map setting: NERDTreeMapActivateNode | ||
299 | Applies to: files and directories. | ||
300 | |||
301 | If a file node is selected, it is opened in the previous window. | ||
302 | |||
303 | If a directory is selected it is opened or closed depending on its current | ||
304 | state. | ||
305 | |||
306 | If a bookmark that links to a directory is selected then that directory | ||
307 | becomes the new root. | ||
308 | |||
309 | If a bookmark that links to a file is selected then that file is opened in the | ||
310 | previous window. | ||
311 | |||
312 | ------------------------------------------------------------------------------ | ||
313 | *NERDTree-go* | ||
314 | Default key: go | ||
315 | Map setting: NERDTreeMapPreview | ||
316 | Applies to: files. | ||
317 | |||
318 | If a file node or a bookmark that links to a file is selected, it is opened in | ||
319 | the previous window, but the cursor does not move. | ||
320 | |||
321 | If a bookmark that links to a directory is selected then that directory | ||
322 | becomes the new root. | ||
323 | |||
324 | The default key combo for this mapping is "g" + NERDTreeMapActivateNode (see | ||
325 | |NERDTree-o|). | ||
326 | |||
327 | ------------------------------------------------------------------------------ | ||
328 | *NERDTree-t* | ||
329 | Default key: t | ||
330 | Map setting: *NERDTreeMapOpenInTab* | ||
331 | Applies to: files and directories. | ||
332 | |||
333 | Opens the selected file in a new tab. If a directory is selected, a fresh | ||
334 | NERDTree for that directory is opened in a new tab. | ||
335 | |||
336 | If a bookmark which points to a directory is selected, open a NERDTree for | ||
337 | that directory in a new tab. If the bookmark points to a file, open that file | ||
338 | in a new tab. | ||
339 | |||
340 | ------------------------------------------------------------------------------ | ||
341 | *NERDTree-T* | ||
342 | Default key: T | ||
343 | Map setting: *NERDTreeMapOpenInTabSilent* | ||
344 | Applies to: files and directories. | ||
345 | |||
346 | The same as |NERDTree-t| except that the focus is kept in the current tab. | ||
347 | |||
348 | ------------------------------------------------------------------------------ | ||
349 | *NERDTree-i* | ||
350 | Default key: i | ||
351 | Map setting: *NERDTreeMapOpenSplit* | ||
352 | Applies to: files, and bookmarks pointing to files. | ||
353 | |||
354 | Opens the selected file in a new split window and puts the cursor in the new | ||
355 | window. | ||
356 | |||
357 | ------------------------------------------------------------------------------ | ||
358 | *NERDTree-gi* | ||
359 | Default key: gi | ||
360 | Map setting: *NERDTreeMapPreviewSplit* | ||
361 | Applies to: files, and bookmarks pointing to files. | ||
362 | |||
363 | The same as |NERDTree-i| except that the cursor is not moved. | ||
364 | |||
365 | The default key combo for this mapping is "g" + NERDTreeMapOpenSplit (see | ||
366 | |NERDTree-i|). | ||
367 | |||
368 | ------------------------------------------------------------------------------ | ||
369 | *NERDTree-s* | ||
370 | Default key: s | ||
371 | Map setting: *NERDTreeMapOpenVSplit* | ||
372 | Applies to: files, and bookmarks pointing to files. | ||
373 | |||
374 | Opens the selected file in a new vertically split window and puts the cursor | ||
375 | in the new window. | ||
376 | |||
377 | ------------------------------------------------------------------------------ | ||
378 | *NERDTree-gs* | ||
379 | Default key: gs | ||
380 | Map setting: *NERDTreeMapPreviewVSplit* | ||
381 | Applies to: files, and bookmarks pointing to files. | ||
382 | |||
383 | The same as |NERDTree-s| except that the cursor is not moved. | ||
384 | |||
385 | The default key combo for this mapping is "g" + NERDTreeMapOpenVSplit (see | ||
386 | |NERDTree-s|). | ||
387 | |||
388 | ------------------------------------------------------------------------------ | ||
389 | *NERDTree-<CR>* | ||
390 | Default key: <CR> | ||
391 | Map setting: *NERDTreeMapCustomOpen* | ||
392 | Applies to: files, directories, and bookmarks | ||
393 | |||
394 | Performs a customized open action on the selected node. This allows the user | ||
395 | to define an action that behaves differently from any of the standard | ||
396 | keys. See |NERDTreeCustomOpenArgs| for more details. | ||
397 | ------------------------------------------------------------------------------ | ||
398 | *NERDTree-O* | ||
399 | Default key: O | ||
400 | Map setting: *NERDTreeMapOpenRecursively* | ||
401 | Applies to: directories. | ||
402 | |||
403 | Recursively opens the selected directory. | ||
404 | |||
405 | All files and directories are cached, but if a directory would not be | ||
406 | displayed due to file filters (see |NERDTreeIgnore| |NERDTree-f|) or the | ||
407 | hidden file filter (see |NERDTreeShowHidden|) then its contents are not | ||
408 | cached. This is handy, especially if you have .svn directories. | ||
409 | |||
410 | ------------------------------------------------------------------------------ | ||
411 | *NERDTree-x* | ||
412 | Default key: x | ||
413 | Map setting: *NERDTreeMapCloseDir* | ||
414 | Applies to: files and directories. | ||
415 | |||
416 | Closes the parent of the selected node. | ||
417 | |||
418 | ------------------------------------------------------------------------------ | ||
419 | *NERDTree-X* | ||
420 | Default key: X | ||
421 | Map setting: *NERDTreeMapCloseChildren* | ||
422 | Applies to: directories. | ||
423 | |||
424 | Recursively closes all children of the selected directory. | ||
425 | |||
426 | Tip: To quickly "reset" the tree, use |NERDTree-P| with this mapping. | ||
427 | |||
428 | ------------------------------------------------------------------------------ | ||
429 | *NERDTree-e* | ||
430 | Default key: e | ||
431 | Map setting: *NERDTreeMapOpenExpl* | ||
432 | Applies to: files and directories. | ||
433 | |||
434 | |:edit|s the selected directory, or the selected file's directory. This could | ||
435 | result in a NERDTree or a netrw being opened, depending on | ||
436 | |NERDTreeHijackNetrw|. | ||
437 | |||
438 | ------------------------------------------------------------------------------ | ||
439 | *NERDTree-D* | ||
440 | Default key: D | ||
441 | Map setting: *NERDTreeMapDeleteBookmark* | ||
442 | Applies to: lines in the bookmarks table | ||
443 | |||
444 | Deletes the currently selected bookmark. | ||
445 | |||
446 | ------------------------------------------------------------------------------ | ||
447 | *NERDTree-P* | ||
448 | Default key: P | ||
449 | Map setting: *NERDTreeMapJumpRoot* | ||
450 | Applies to: no restrictions. | ||
451 | |||
452 | Jump to the tree root. | ||
453 | |||
454 | ------------------------------------------------------------------------------ | ||
455 | *NERDTree-p* | ||
456 | Default key: p | ||
457 | Map setting: *NERDTreeMapJumpParent* | ||
458 | Applies to: files and directories. | ||
459 | |||
460 | Jump to the parent node of the selected node. | ||
461 | |||
462 | ------------------------------------------------------------------------------ | ||
463 | *NERDTree-K* | ||
464 | Default key: K | ||
465 | Map setting: *NERDTreeMapJumpFirstChild* | ||
466 | Applies to: files and directories. | ||
467 | |||
468 | Jump to the first child of the current nodes parent. | ||
469 | |||
470 | If 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* | ||
477 | Default key: J | ||
478 | Map setting: *NERDTreeMapJumpLastChild* | ||
479 | Applies to: files and directories. | ||
480 | |||
481 | Jump to the last child of the current nodes parent. | ||
482 | |||
483 | If 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* | ||
490 | Default key: <C-J> | ||
491 | Map setting: *NERDTreeMapJumpNextSibling* | ||
492 | Applies to: files and directories. | ||
493 | |||
494 | Jump to the next sibling of the selected node. | ||
495 | |||
496 | ------------------------------------------------------------------------------ | ||
497 | *NERDTree-C-K* | ||
498 | Default key: <C-K> | ||
499 | Map setting: *NERDTreeMapJumpPrevSibling* | ||
500 | Applies to: files and directories. | ||
501 | |||
502 | Jump to the previous sibling of the selected node. | ||
503 | |||
504 | ------------------------------------------------------------------------------ | ||
505 | *NERDTree-C* | ||
506 | Default key: C | ||
507 | Map setting: *NERDTreeMapChangeRoot* | ||
508 | Applies to: files and directories. | ||
509 | |||
510 | Make the selected directory node the new tree root. If a file is selected, its | ||
511 | parent is used. | ||
512 | |||
513 | ------------------------------------------------------------------------------ | ||
514 | *NERDTree-u* | ||
515 | Default key: u | ||
516 | Map setting: *NERDTreeMapUpdir* | ||
517 | Applies to: no restrictions. | ||
518 | |||
519 | Move the tree root up a directory (like doing a "cd .."). | ||
520 | |||
521 | ------------------------------------------------------------------------------ | ||
522 | *NERDTree-U* | ||
523 | Default key: U | ||
524 | Map setting: *NERDTreeMapUpdirKeepOpen* | ||
525 | Applies to: no restrictions. | ||
526 | |||
527 | Like |NERDTree-u| except that the old tree root is kept open. | ||
528 | |||
529 | ------------------------------------------------------------------------------ | ||
530 | *NERDTree-r* | ||
531 | Default key: r | ||
532 | Map setting: *NERDTreeMapRefresh* | ||
533 | Applies to: files and directories. | ||
534 | |||
535 | If a directory is selected, recursively refresh that directory, i.e. scan the | ||
536 | filesystem for changes and represent them in the tree. | ||
537 | |||
538 | If a file node is selected then the above is done on it's parent. | ||
539 | |||
540 | ------------------------------------------------------------------------------ | ||
541 | *NERDTree-R* | ||
542 | Default key: R | ||
543 | Map setting: *NERDTreeMapRefreshRoot* | ||
544 | Applies to: no restrictions. | ||
545 | |||
546 | Recursively refresh the tree root. | ||
547 | |||
548 | ------------------------------------------------------------------------------ | ||
549 | *NERDTree-m* | ||
550 | Default key: m | ||
551 | Map setting: *NERDTreeMapMenu* | ||
552 | Applies to: files and directories. | ||
553 | |||
554 | Display the NERDTree menu. See |NERDTreeMenu| for details. | ||
555 | |||
556 | ------------------------------------------------------------------------------ | ||
557 | *NERDTree-cd* | ||
558 | Default key: cd | ||
559 | Map setting: *NERDTreeMapChdir* | ||
560 | Applies to: files and directories. | ||
561 | |||
562 | Change Vim's current working directory to that of the selected node. | ||
563 | |||
564 | ------------------------------------------------------------------------------ | ||
565 | *NERDTree-CD* | ||
566 | Default key: CD | ||
567 | Map setting: *NERDTreeMapCWD* | ||
568 | Applies to: no restrictions. | ||
569 | |||
570 | Change the NERDTree root to Vim's current working directory. | ||
571 | |||
572 | ------------------------------------------------------------------------------ | ||
573 | *NERDTree-I* | ||
574 | Default key: I | ||
575 | Map setting: *NERDTreeMapToggleHidden* | ||
576 | Applies to: no restrictions. | ||
577 | |||
578 | Toggles whether hidden files (i.e. "dot files") are displayed. | ||
579 | |||
580 | ------------------------------------------------------------------------------ | ||
581 | *NERDTree-f* | ||
582 | Default key: f | ||
583 | Map setting: *NERDTreeMapToggleFilters* | ||
584 | Applies to: no restrictions. | ||
585 | |||
586 | Toggles whether file filters are used. See |NERDTreeIgnore| for details. | ||
587 | |||
588 | ------------------------------------------------------------------------------ | ||
589 | *NERDTree-F* | ||
590 | Default key: F | ||
591 | Map setting: *NERDTreeMapToggleFiles* | ||
592 | Applies to: no restrictions. | ||
593 | |||
594 | Toggles whether file nodes are displayed. | ||
595 | |||
596 | ------------------------------------------------------------------------------ | ||
597 | *NERDTree-B* | ||
598 | Default key: B | ||
599 | Map setting: *NERDTreeMapToggleBookmarks* | ||
600 | Applies to: no restrictions. | ||
601 | |||
602 | Toggles whether the bookmarks table is displayed. | ||
603 | |||
604 | ------------------------------------------------------------------------------ | ||
605 | *NERDTree-q* | ||
606 | Default key: q | ||
607 | Map setting: *NERDTreeMapQuit* | ||
608 | Applies to: no restrictions. | ||
609 | |||
610 | Closes the NERDTree window. | ||
611 | |||
612 | ------------------------------------------------------------------------------ | ||
613 | *NERDTree-A* | ||
614 | Default key: A | ||
615 | Map setting: *NERDTreeMapToggleZoom* | ||
616 | Applies to: no restrictions. | ||
617 | |||
618 | Maximize (zoom) and minimize the NERDTree window. | ||
619 | |||
620 | ------------------------------------------------------------------------------ | ||
621 | *NERDTree-?* | ||
622 | Default key: ? | ||
623 | Map setting: *NERDTreeMapHelp* | ||
624 | Applies to: no restrictions. | ||
625 | |||
626 | Toggles whether the quickhelp is displayed. | ||
627 | |||
628 | ------------------------------------------------------------------------------ | ||
629 | 2.3. The NERDTree menu *NERDTreeMenu* | ||
630 | |||
631 | The 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 | ||
633 | file explorers have. | ||
634 | |||
635 | The script comes with two default menu plugins: exec_menuitem.vim and | ||
636 | fs_menu.vim. fs_menu.vim adds some basic filesystem operations to the menu for | ||
637 | creating/deleting/moving/copying files and directories. exec_menuitem.vim | ||
638 | provides a menu item to execute executable files. | ||
639 | |||
640 | Related tags: |NERDTree-m| |NERDTreeApi| | ||
641 | |||
642 | ------------------------------------------------------------------------------ | ||
643 | *NERDTreeMenu-j* | ||
644 | Default key: j | ||
645 | Map option: *NERDTreeMenuDown* | ||
646 | Applies to: The NERDTree menu. | ||
647 | |||
648 | Moves the cursor down. | ||
649 | |||
650 | ------------------------------------------------------------------------------ | ||
651 | *NERDTreeMenu-k* | ||
652 | Default key: k | ||
653 | Map option: *NERDTreeMenuUp* | ||
654 | Applies to: The NERDTree menu. | ||
655 | |||
656 | Moves the cursor up. | ||
657 | |||
658 | ============================================================================== | ||
659 | 3. Customisation *NERDTreeSettings* | ||
660 | |||
661 | |||
662 | ------------------------------------------------------------------------------ | ||
663 | 3.1. Customisation summary *NERDTreeSettingsSummary* | ||
664 | |||
665 | The plugin provides the following settings that can customise the behaviour | ||
666 | the 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 | ------------------------------------------------------------------------------ | ||
778 | 3.2. Customisation details *NERDTreeSettingsDetails* | ||
779 | |||
780 | To 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* | ||
785 | If this plugin is making you feel homicidal, it may be a good idea to turn it | ||
786 | off with this line in your vimrc: > | ||
787 | let loaded_nerd_tree=1 | ||
788 | < | ||
789 | ------------------------------------------------------------------------------ | ||
790 | *NERDTreeAutoCenter* | ||
791 | Values: 0 or 1. | ||
792 | Default: 1 | ||
793 | |||
794 | If set to 1, the NERDTree window will center around the cursor if it moves to | ||
795 | within |NERDTreeAutoCenterThreshold| lines of the top/bottom of the window. | ||
796 | |||
797 | This is ONLY done in response to tree navigation mappings, | ||
798 | i.e. |NERDTree-J| |NERDTree-K| |NERDTree-C-J| |NERDTree-C-K| |NERDTree-p| | ||
799 | |NERDTree-P| | ||
800 | |||
801 | The centering is done with a |zz| operation. | ||
802 | |||
803 | ------------------------------------------------------------------------------ | ||
804 | *NERDTreeAutoCenterThreshold* | ||
805 | Values: Any natural number. | ||
806 | Default: 3 | ||
807 | |||
808 | This setting controls the "sensitivity" of the NERDTree auto centering. See | ||
809 | |NERDTreeAutoCenter| for details. | ||
810 | |||
811 | ------------------------------------------------------------------------------ | ||
812 | *NERDTreeCaseSensitiveSort* | ||
813 | Values: 0 or 1. | ||
814 | Default: 0. | ||
815 | |||
816 | By default the NERDTree does not sort nodes case sensitively, i.e. nodes | ||
817 | could appear like this: > | ||
818 | bar.c | ||
819 | Baz.c | ||
820 | blarg.c | ||
821 | boner.c | ||
822 | Foo.c | ||
823 | < | ||
824 | But, if you set this setting to 1 then the case of the nodes will be taken | ||
825 | into 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* | ||
834 | Values: 0 or 1. | ||
835 | Default: 0. | ||
836 | |||
837 | By default the NERDTree does not sort nodes in natural sort order, i.e. nodes | ||
838 | could 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 | < | ||
848 | But if you set this setting to 1 then the natural sort order will be used. The | ||
849 | above 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* | ||
861 | Values: 0 or 1. | ||
862 | Default: 0. | ||
863 | |||
864 | By default, NERDTree will use the `:cd` command to change the current working | ||
865 | directory. If this setting is turned on, and the `:tcd` command is available, it | ||
866 | will be used instead. | ||
867 | |||
868 | ------------------------------------------------------------------------------ | ||
869 | *NERDTreeChDirMode* | ||
870 | Values: 0, 1, 2, or 3. | ||
871 | Default: 0. | ||
872 | |||
873 | Use this setting to tell the script when (if at all) to change the current | ||
874 | working directory (CWD) for vim. | ||
875 | |||
876 | If it is set to 0 then the CWD is never changed by the NERDTree. | ||
877 | |||
878 | If set to 1 then the CWD is changed when the NERDTree is first loaded to the | ||
879 | directory it is initialized in. For example, if you start the NERDTree with > | ||
880 | :NERDTree /home/marty/foobar | ||
881 | < | ||
882 | then the CWD will be changed to /home/marty/foobar and will not be changed | ||
883 | again unless you init another NERDTree with a similar command. | ||
884 | |||
885 | If the setting is set to 2 then it behaves the same as if set to 1 except that | ||
886 | the CWD is changed whenever the tree root is changed. For example, if the CWD | ||
887 | is /home/marty/foobar and you make the node for /home/marty/foobar/baz the new | ||
888 | root then the CWD will become /home/marty/foobar/baz. | ||
889 | |||
890 | If the set to 3, then it behaves the same as if set to 2, and the CWD is | ||
891 | changed whenever changing tabs to whatever the tree root is on that tab. | ||
892 | |||
893 | ------------------------------------------------------------------------------ | ||
894 | *NERDTreeHighlightCursorline* | ||
895 | Values: 0 or 1. | ||
896 | Default: 1. | ||
897 | |||
898 | If set to 1, the current cursor line in the NERDTree buffer will be | ||
899 | highlighted. This is done using the `'cursorline'` Vim option. | ||
900 | |||
901 | ------------------------------------------------------------------------------ | ||
902 | *NERDTreeHijackNetrw* | ||
903 | Values: 0 or 1. | ||
904 | Default: 1. | ||
905 | |||
906 | If set to 1, doing a > | ||
907 | :edit <some directory> | ||
908 | < | ||
909 | will open up a window level NERDTree instead of a netrw in the target window. | ||
910 | |||
911 | Window level trees behaves slightly different from a regular trees in the | ||
912 | following 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* | ||
919 | Values: a list of regular expressions. | ||
920 | Default: ['\~$']. | ||
921 | |||
922 | This setting is used to specify which files the NERDTree should ignore. It | ||
923 | must be a list of regular expressions. When the NERDTree is rendered, any | ||
924 | files/directories that match any of the regex's in NERDTreeIgnore won't be | ||
925 | displayed. | ||
926 | |||
927 | For example if you put the following line in your vimrc: > | ||
928 | let NERDTreeIgnore=['\.vim$', '\~$'] | ||
929 | < | ||
930 | then all files ending in .vim or ~ will be ignored. | ||
931 | |||
932 | There are 3 magic flags that can be appended to the end of each regular | ||
933 | expression to specify that the regex should match only filenames, only lowest | ||
934 | level 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 | < | ||
938 | This will cause all directories ending in ".d" to be ignored, all files ending | ||
939 | in ".o" to be ignored, and the "cache" subdirectory of any "tmp" directory to | ||
940 | be ignored. All other "cache" directories will be displayed. | ||
941 | |||
942 | When using the "[[path]]" tag on Windows, make sure you use escaped | ||
943 | backslashes for the separators in the regex, eg. 'Temp\\cache$[[path]]' | ||
944 | |||
945 | Note: to tell the NERDTree not to ignore any files you must use the following | ||
946 | line: > | ||
947 | let NERDTreeIgnore=[] | ||
948 | < | ||
949 | The file filters can be turned on and off dynamically with the |NERDTree-f| | ||
950 | mapping. | ||
951 | |||
952 | ------------------------------------------------------------------------------ | ||
953 | *NERDTreeRespectWildIgnore* | ||
954 | Values: 0 or 1. | ||
955 | Default: 0. | ||
956 | |||
957 | If set to 1, the `'wildignore'` setting is respected. | ||
958 | |||
959 | ------------------------------------------------------------------------------ | ||
960 | *NERDTreeBookmarksFile* | ||
961 | Values: a path | ||
962 | Default: $HOME/.NERDTreeBookmarks | ||
963 | |||
964 | This is where bookmarks are saved. See |NERDTreeBookmarkCommands|. | ||
965 | |||
966 | ------------------------------------------------------------------------------ | ||
967 | *NERDTreeBookmarksSort* | ||
968 | Values: 0, 1, or 2 | ||
969 | Default: 1 | ||
970 | |||
971 | This setting controls the method by which the list of user bookmarks is | ||
972 | sorted. When sorted, bookmarks will render in alphabetical order by name. | ||
973 | |||
974 | If set to 0, the bookmarks list is not sorted. | ||
975 | If set to 1, the bookmarks list is sorted in a case-insensitive manner. | ||
976 | If set to 2, the bookmarks list is sorted in a case-sensitive manner. | ||
977 | |||
978 | ------------------------------------------------------------------------------ | ||
979 | *NERDTreeMarkBookmarks* | ||
980 | Values: 0 or 1 | ||
981 | Default: 1 | ||
982 | |||
983 | If set to 1, Bookmarks will be specially marked whenever the NERDTree is | ||
984 | rendered. Users of the |NERDTreeMinimalUI| setting may prefer to disable | ||
985 | this setting for even less visual clutter. | ||
986 | |||
987 | ------------------------------------------------------------------------------ | ||
988 | *NERDTreeMouseMode* | ||
989 | Values: 1, 2 or 3. | ||
990 | Default: 1. | ||
991 | |||
992 | If set to 1 then a double click on a node is required to open it. | ||
993 | If set to 2 then a single click will open directory nodes, while a double | ||
994 | click will still be required for file nodes. | ||
995 | If set to 3 then a single click will open any node. | ||
996 | |||
997 | Note: a double click anywhere on a line that a tree node is on will | ||
998 | activate it, but all single-click activations must be done on name of the node | ||
999 | itself. For example, if you have the following node: > | ||
1000 | | | |-application.rb | ||
1001 | < | ||
1002 | then (to single click activate it) you must click somewhere in | ||
1003 | 'application.rb'. | ||
1004 | |||
1005 | ------------------------------------------------------------------------------ | ||
1006 | *NERDTreeQuitOnOpen* | ||
1007 | Values: 0,1,2 or 3. | ||
1008 | Default: 0 | ||
1009 | |||
1010 | This setting governs whether the NERDTree window or the bookmarks table closes | ||
1011 | after 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* | ||
1023 | Values: 0 or 1. | ||
1024 | Default: 0. | ||
1025 | |||
1026 | If this setting is set to 1 then the bookmarks table will be displayed. | ||
1027 | |||
1028 | This setting can be toggled dynamically, per tree, with the |NERDTree-B| | ||
1029 | mapping. | ||
1030 | |||
1031 | ------------------------------------------------------------------------------ | ||
1032 | *NERDTreeShowFiles* | ||
1033 | Values: 0 or 1. | ||
1034 | Default: 1. | ||
1035 | |||
1036 | If this setting is set to 1 then files are displayed in the NERDTree. If it | ||
1037 | is set to 0 then only directories are displayed. | ||
1038 | |||
1039 | This setting can be toggled dynamically, per tree, with the |NERDTree-F| | ||
1040 | mapping and is useful for drastically shrinking the tree when you are | ||
1041 | navigating to a different part of the tree. | ||
1042 | |||
1043 | ------------------------------------------------------------------------------ | ||
1044 | *NERDTreeShowHidden* | ||
1045 | Values: 0 or 1. | ||
1046 | Default: 0. | ||
1047 | |||
1048 | This setting tells vim whether to display hidden files by default. This | ||
1049 | setting can be dynamically toggled, per tree, with the |NERDTree-I| mapping. | ||
1050 | Use one of the follow lines for this setting: > | ||
1051 | let NERDTreeShowHidden=0 | ||
1052 | let NERDTreeShowHidden=1 | ||
1053 | < | ||
1054 | ------------------------------------------------------------------------------ | ||
1055 | *NERDTreeShowLineNumbers* | ||
1056 | Values: 0 or 1. | ||
1057 | Default: 0. | ||
1058 | |||
1059 | This setting tells vim whether to display line numbers for the NERDTree | ||
1060 | window. Use one of the follow lines for this setting: > | ||
1061 | let NERDTreeShowLineNumbers=0 | ||
1062 | let NERDTreeShowLineNumbers=1 | ||
1063 | < | ||
1064 | ------------------------------------------------------------------------------ | ||
1065 | *NERDTreeSortOrder* | ||
1066 | Values: a list of regular expressions. | ||
1067 | Default: ['\/$', '*', '\.swp$', '\.bak$', '\~$'] | ||
1068 | |||
1069 | This setting is a list of regular expressions which are used to group or sort | ||
1070 | the nodes under their parent. | ||
1071 | |||
1072 | For example, if the setting is: > | ||
1073 | ['\.vim$', '\.c$', '\.h$', '*', 'foobar'] | ||
1074 | < | ||
1075 | then all .vim files will be grouped at the top, followed by all .c files then | ||
1076 | all .h files. All files containing the string 'foobar' will be placed at the | ||
1077 | end. The star is a special flag: it tells the script that every node that | ||
1078 | doesn't match any of the other regexps should be placed here. | ||
1079 | |||
1080 | If no star is present in NERDTreeSortOrder, then one is automatically | ||
1081 | appended to the end of the list. | ||
1082 | |||
1083 | The regex '\/$' should be used to match directory nodes. | ||
1084 | |||
1085 | Files can also be sorted by 1) the modification timestamp, 2) the size, or 3) | ||
1086 | the extension. Directories are always sorted by name. To accomplish this, the | ||
1087 | following special flags are used: | ||
1088 | [[timestamp]] [[-timestamp]] [[size]] [[-size]] [[extension]] | ||
1089 | The hyphen specifies a descending sort; extensions are sorted in ascending | ||
1090 | order only. If placed at the beginning of the list, files are sorted according | ||
1091 | to these flags first, and then grouped by the remaining items in the list. If | ||
1092 | the flags are in any other position of the list, this special sorting is done | ||
1093 | secondarily. See examples 4, 5, and 6 below. | ||
1094 | |||
1095 | After this sorting is done, the files in each group are sorted alphabetically. | ||
1096 | |||
1097 | Examples: > | ||
1098 | (1) ['*', '\/$'] | ||
1099 | (2) [] | ||
1100 | (3) ['\/$', '\.rb$', '\.php$', '*', '\.swp$', '\.bak$', '\~$'] | ||
1101 | (4) ['[[-size]]'] | ||
1102 | (5) ['\/$', '*', '[[timestamp]]'] | ||
1103 | (6) ['foo','\/$','[[extension]]'] | ||
1104 | < | ||
1105 | 1. Directories will appear last, everything else will appear above. | ||
1106 | 2. Everything will simply appear in alphabetical order. | ||
1107 | 3. 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. | ||
1109 | 4. Everything is sorted by size, largest to smallest, with directories | ||
1110 | considered to have size 0 bytes. | ||
1111 | 5. Directories will appear first alphabetically, followed by files, sorted by | ||
1112 | timestamp, oldest first. | ||
1113 | 6. 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* | ||
1118 | Values: Any valid `'statusline'` setting. | ||
1119 | Default: %{exists('b:NERDTree')?b:NERDTree.root.path.str():''} | ||
1120 | |||
1121 | Defines the value for the `'statusline'` setting in NERDTree windows. | ||
1122 | |||
1123 | Note: The setting is actually applied using |:let-&|, not |:set|, so | ||
1124 | escaping spaces is not necessary. | ||
1125 | |||
1126 | Setting this to -1 will deactivate it so that your global `'statusline'` | ||
1127 | setting is used. | ||
1128 | |||
1129 | ------------------------------------------------------------------------------ | ||
1130 | *NERDTreeWinPos* | ||
1131 | Values: "left" or "right" | ||
1132 | Default: "left". | ||
1133 | |||
1134 | This setting is used to determine where NERDTree window is placed on the | ||
1135 | screen. | ||
1136 | |||
1137 | This setting makes it possible to use two different explorer plugins | ||
1138 | simultaneously. For example, you could have the taglist plugin on the left of | ||
1139 | the window and the NERDTree on the right. | ||
1140 | |||
1141 | ------------------------------------------------------------------------------ | ||
1142 | *NERDTreeWinSize* | ||
1143 | Values: a positive integer. | ||
1144 | Default: 31. | ||
1145 | |||
1146 | This setting is used to change the size of the NERDTree when it is loaded. | ||
1147 | |||
1148 | ------------------------------------------------------------------------------ | ||
1149 | *NERDTreeMinimalUI* | ||
1150 | Values: 0 or 1 | ||
1151 | Default: 0 | ||
1152 | |||
1153 | This setting disables the 'Bookmarks' label 'Press ? for help' text. Use one | ||
1154 | of the following lines for this setting: > | ||
1155 | let NERDTreeMinimalUI=0 | ||
1156 | let NERDTreeMinimalUI=1 | ||
1157 | < | ||
1158 | ------------------------------------------------------------------------------ | ||
1159 | *NERDTreeMinimalMenu* | ||
1160 | Values: 0 or 1 | ||
1161 | Default: 0 | ||
1162 | |||
1163 | This setting makes NERDTree use a smaller, more compact menu for adding, | ||
1164 | copying, deleting nodes. This menu fits on a single line so Vim doesn't need to | ||
1165 | scroll down to present it. This setting is recommended for users already | ||
1166 | familiar 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 | |||
1170 | An action can be selected with its shortcut key or with the NERDTreeMenuUp and | ||
1171 | NERDTreeMenuDown keys, then pressing enter. | ||
1172 | |||
1173 | Use one of the following lines for this setting: > | ||
1174 | let NERDTreeMinimalMenu=0 | ||
1175 | let NERDTreeMinimalMenu=1 | ||
1176 | < | ||
1177 | ------------------------------------------------------------------------------ | ||
1178 | *NERDTreeCascadeSingleChildDir* | ||
1179 | Values: 0 or 1 | ||
1180 | Default: 1. | ||
1181 | |||
1182 | When displaying directory nodes, this setting tells NERDTree to collapse | ||
1183 | directories that have only one child. Use one of the following lines for this | ||
1184 | setting: > | ||
1185 | let NERDTreeCascadeSingleChildDir=0 | ||
1186 | let NERDTreeCascadeSingleChildDir=1 | ||
1187 | < | ||
1188 | ------------------------------------------------------------------------------ | ||
1189 | *NERDTreeCascadeOpenSingleChildDir* | ||
1190 | Values: 0 or 1 | ||
1191 | Default: 1. | ||
1192 | |||
1193 | When opening directory nodes, this setting tells NERDTree to recursively open | ||
1194 | directories that have only one child which is also a directory. NERDTree will | ||
1195 | stop when it finds a directory that contains anything but another single | ||
1196 | directory. This setting also causes the |NERDTree-x| mapping to close | ||
1197 | directories in the same manner. This setting may be useful for Java projects. | ||
1198 | Use one of the following lines for this setting: > | ||
1199 | let NERDTreeCascadeOpenSingleChildDir=0 | ||
1200 | let NERDTreeCascadeOpenSingleChildDir=1 | ||
1201 | < | ||
1202 | ------------------------------------------------------------------------------ | ||
1203 | *NERDTreeAutoDeleteBuffer* | ||
1204 | Values: 0 or 1 | ||
1205 | Default: 0. | ||
1206 | |||
1207 | When using a context menu to delete or rename a file you may also want to | ||
1208 | delete the buffer which is no more valid. If the setting is not set you will | ||
1209 | see a confirmation if you really want to delete an old buffer. If you always | ||
1210 | press 'y' then it's worth it to set this setting to 1. Use one of the | ||
1211 | following lines for this setting: > | ||
1212 | let NERDTreeAutoDeleteBuffer=0 | ||
1213 | let NERDTreeAutoDeleteBuffer=1 | ||
1214 | < | ||
1215 | ------------------------------------------------------------------------------ | ||
1216 | *NERDTreeCreatePrefix* | ||
1217 | Values: Any valid command prefix. | ||
1218 | Default: "silent". | ||
1219 | |||
1220 | Internally, NERDTree uses the |:edit| command to create a buffer in which to | ||
1221 | display its tree view. You can augment this behavior by specifying a prefix | ||
1222 | string such as "keepalt" or similar. For example, to have NERDTree create its | ||
1223 | tree window using `silent keepalt keepjumps edit`: > | ||
1224 | let NERDTreeCreatePrefix='silent keepalt keepjumps' | ||
1225 | < | ||
1226 | ------------------------------------------------------------------------------ | ||
1227 | *NERDTreeDirArrowCollapsible* *NERDTreeDirArrowExpandable* | ||
1228 | Values: Any single character. | ||
1229 | Defaults: Windows: ~ and + Others: ▾ and ▸ | ||
1230 | |||
1231 | These characters indicate whether a directory is collapsible or expandable. | ||
1232 | Example: > | ||
1233 | let NERDTreeDirArrowExpandable=">" | ||
1234 | let NERDTreeDirArrowCollapsible="v" | ||
1235 | < | ||
1236 | They can be set to "\u00a0" to replace the arrows with a non-breaking space. | ||
1237 | If you do this you may need to change the node delimiter. See | ||
1238 | |NERDTreeNodeDelimiter|. You cannot use the same character for both the arrows | ||
1239 | and the delimiter. | ||
1240 | |||
1241 | Alternatively, they can be set to '' (an empty string). This removes the | ||
1242 | arrows and the single space that follows them, shifting the entire tree two | ||
1243 | character positions to the left. | ||
1244 | |||
1245 | ------------------------------------------------------------------------------ | ||
1246 | *NERDTreeNodeDelimiter* | ||
1247 | Values: Any single character. | ||
1248 | Default: varies (see below) | ||
1249 | |||
1250 | This character is used to separate the file or directory name from the rest of | ||
1251 | the characters in the line of text. It allows filenames to contain special | ||
1252 | characters that are otherwise used in the NERDTree, such as square brackets, | ||
1253 | braces, trailing asterisk, and leading space. For more details, see the | ||
1254 | responsible pull request: https://github.com/preservim/nerdtree/pull/868. | ||
1255 | |||
1256 | The default value of this variable depends on the features compiled into your | ||
1257 | vim 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 | |||
1269 | In 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 | |||
1272 | Other plugins can interfere with these defaults, so if you need to change the | ||
1273 | delimiter, be sure to choose a character that won't appear in your filenames | ||
1274 | or any of the flags set by your installed NERDTree plugins. The suggestions | ||
1275 | below are but a few of the many possibilities. Remember to use double quotes | ||
1276 | when 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* | ||
1284 | Values: A nested dictionary, as described below | ||
1285 | Default: {'file': {'reuse': 'all', 'where': 'p'}, 'dir': {}} | ||
1286 | |||
1287 | This dictionary contains two keys, 'file' and 'dir', whose values each are | ||
1288 | another 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 | ||
1290 | to customize the way the node is opened. The default value matches what | ||
1291 | |NERDTree-o| does. To change that behavior, use these keys and | ||
1292 | values 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 | |||
1301 | For example: | ||
1302 | To open files and directories (creating a new NERDTree) in a new tab, > | ||
1303 | {'file':{'where': 't'}, 'dir':{'where':'t'}} | ||
1304 | < | ||
1305 | To 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 | ============================================================================== | ||
1309 | 4. The NERDTree API *NERDTreeAPI* | ||
1310 | |||
1311 | The NERDTree script allows you to add custom key mappings and menu items via | ||
1312 | a 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 | |||
1315 | The script exposes some prototype objects that can be used to manipulate the | ||
1316 | tree and/or get information from it: > | ||
1317 | g:NERDTreePath | ||
1318 | g:NERDTreeDirNode | ||
1319 | g:NERDTreeFileNode | ||
1320 | g:NERDTreeBookmark | ||
1321 | < | ||
1322 | See the code/comments in NERD_tree.vim to find how to use these objects. The | ||
1323 | following 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 | |||
1328 | See this blog post for more details: | ||
1329 | http://got-ravings.blogspot.com/2008/09/vim-pr0n-prototype-based-objects.html | ||
1330 | |||
1331 | A number of API functions take a callback argument to call. The callback can | ||
1332 | be either a string with the name of a function to call, or a |Funcref| object | ||
1333 | which will be called directly. | ||
1334 | |||
1335 | ------------------------------------------------------------------------------ | ||
1336 | 4.1. Key map API *NERDTreeKeymapAPI* | ||
1337 | |||
1338 | NERDTreeAddKeyMap({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 | ------------------------------------------------------------------------------ | ||
1376 | 4.2. Menu API *NERDTreeMenuAPI* | ||
1377 | |||
1378 | NERDTreeAddSubmenu({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 | |||
1395 | NERDTreeAddMenuItem({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 | |||
1415 | NERDTreeAddMenuSeparator([{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 | |||
1421 | Below 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 | < | ||
1445 | This will create the following menu: > | ||
1446 | -------------------- | ||
1447 | a (t)op level menu item | ||
1448 | a (s)ub menu | ||
1449 | < | ||
1450 | Where selecting "a (s)ub menu" will lead to a second menu: > | ||
1451 | (n)ested item 1 | ||
1452 | (n)ested item 2 | ||
1453 | < | ||
1454 | When any of the 3 concrete menu items are selected the function "SomeFunction" | ||
1455 | will be called. | ||
1456 | |||
1457 | ------------------------------------------------------------------------------ | ||
1458 | 4.3 NERDTreeAddPathFilter(callback) *NERDTreeAddPathFilter()* | ||
1459 | |||
1460 | Path filters are essentially a more powerful version of |NERDTreeIgnore|. | ||
1461 | If the simple regex matching in |NERDTreeIgnore| is not enough then use | ||
1462 | |NERDTreeAddPathFilter()| to add a callback function that paths will be | ||
1463 | checked 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 | ------------------------------------------------------------------------------ | ||
1475 | 4.4 Path Listener API *NERDTreePathListenerAPI* | ||
1476 | |||
1477 | Use 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 | < | ||
1490 | Current events supported: | ||
1491 | init ~ | ||
1492 | refresh ~ | ||
1493 | refreshFlags ~ | ||
1494 | |||
1495 | ------------------------------------------------------------------------------ | ||
1496 | NERDTreeRender() *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 | ============================================================================== | ||
1501 | 5. About *NERDTreeAbout* | ||
1502 | |||
1503 | The author of the NERDTree is a terrible terrible monster called Martyzilla | ||
1504 | who gobbles up small children with milk and sugar for breakfast. | ||
1505 | |||
1506 | He can be reached at martin.grenfell at gmail dot com. He would love to hear | ||
1507 | from you, so feel free to send him suggestions and/or comments about this | ||
1508 | plugin. Don't be shy --- the worst he can do is slaughter you and stuff you | ||
1509 | in the fridge for later ;) | ||
1510 | |||
1511 | Martyzilla recruited two other unwitting accomplices to become his minions in | ||
1512 | his quest to conquer the Vim plugin world. While he may still love to receive | ||
1513 | your emails, the best way to send suggestions, bug reports, and questions is | ||
1514 | to submit an issue at http://github.com/preservim/nerdtree/issues. | ||
1515 | |||
1516 | The 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 | |||
1520 | Title 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 | ============================================================================== | ||
1528 | 6. License *NERDTreeLicense* | ||
1529 | |||
1530 | The NERDTree is released under the wtfpl. | ||
1531 | See 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* | ||
12 | NERDTree NERDTree.txt /*NERDTree* | ||
13 | NERDTree-<CR> NERDTree.txt /*NERDTree-<CR>* | ||
14 | NERDTree-? NERDTree.txt /*NERDTree-?* | ||
15 | NERDTree-A NERDTree.txt /*NERDTree-A* | ||
16 | NERDTree-B NERDTree.txt /*NERDTree-B* | ||
17 | NERDTree-C NERDTree.txt /*NERDTree-C* | ||
18 | NERDTree-C-J NERDTree.txt /*NERDTree-C-J* | ||
19 | NERDTree-C-K NERDTree.txt /*NERDTree-C-K* | ||
20 | NERDTree-CD NERDTree.txt /*NERDTree-CD* | ||
21 | NERDTree-D NERDTree.txt /*NERDTree-D* | ||
22 | NERDTree-F NERDTree.txt /*NERDTree-F* | ||
23 | NERDTree-I NERDTree.txt /*NERDTree-I* | ||
24 | NERDTree-J NERDTree.txt /*NERDTree-J* | ||
25 | NERDTree-K NERDTree.txt /*NERDTree-K* | ||
26 | NERDTree-O NERDTree.txt /*NERDTree-O* | ||
27 | NERDTree-P NERDTree.txt /*NERDTree-P* | ||
28 | NERDTree-R NERDTree.txt /*NERDTree-R* | ||
29 | NERDTree-T NERDTree.txt /*NERDTree-T* | ||
30 | NERDTree-U NERDTree.txt /*NERDTree-U* | ||
31 | NERDTree-X NERDTree.txt /*NERDTree-X* | ||
32 | NERDTree-cd NERDTree.txt /*NERDTree-cd* | ||
33 | NERDTree-contents NERDTree.txt /*NERDTree-contents* | ||
34 | NERDTree-e NERDTree.txt /*NERDTree-e* | ||
35 | NERDTree-f NERDTree.txt /*NERDTree-f* | ||
36 | NERDTree-gi NERDTree.txt /*NERDTree-gi* | ||
37 | NERDTree-go NERDTree.txt /*NERDTree-go* | ||
38 | NERDTree-gs NERDTree.txt /*NERDTree-gs* | ||
39 | NERDTree-i NERDTree.txt /*NERDTree-i* | ||
40 | NERDTree-m NERDTree.txt /*NERDTree-m* | ||
41 | NERDTree-o NERDTree.txt /*NERDTree-o* | ||
42 | NERDTree-p NERDTree.txt /*NERDTree-p* | ||
43 | NERDTree-q NERDTree.txt /*NERDTree-q* | ||
44 | NERDTree-r NERDTree.txt /*NERDTree-r* | ||
45 | NERDTree-s NERDTree.txt /*NERDTree-s* | ||
46 | NERDTree-t NERDTree.txt /*NERDTree-t* | ||
47 | NERDTree-u NERDTree.txt /*NERDTree-u* | ||
48 | NERDTree-x NERDTree.txt /*NERDTree-x* | ||
49 | NERDTree.txt NERDTree.txt /*NERDTree.txt* | ||
50 | NERDTreeAPI NERDTree.txt /*NERDTreeAPI* | ||
51 | NERDTreeAbout NERDTree.txt /*NERDTreeAbout* | ||
52 | NERDTreeAddKeyMap() NERDTree.txt /*NERDTreeAddKeyMap()* | ||
53 | NERDTreeAddMenuItem() NERDTree.txt /*NERDTreeAddMenuItem()* | ||
54 | NERDTreeAddMenuSeparator() NERDTree.txt /*NERDTreeAddMenuSeparator()* | ||
55 | NERDTreeAddPathFilter() NERDTree.txt /*NERDTreeAddPathFilter()* | ||
56 | NERDTreeAddSubmenu() NERDTree.txt /*NERDTreeAddSubmenu()* | ||
57 | NERDTreeAutoCenter NERDTree.txt /*NERDTreeAutoCenter* | ||
58 | NERDTreeAutoCenterThreshold NERDTree.txt /*NERDTreeAutoCenterThreshold* | ||
59 | NERDTreeAutoDeleteBuffer NERDTree.txt /*NERDTreeAutoDeleteBuffer* | ||
60 | NERDTreeBookmarkCommands NERDTree.txt /*NERDTreeBookmarkCommands* | ||
61 | NERDTreeBookmarkTable NERDTree.txt /*NERDTreeBookmarkTable* | ||
62 | NERDTreeBookmarks NERDTree.txt /*NERDTreeBookmarks* | ||
63 | NERDTreeBookmarksFile NERDTree.txt /*NERDTreeBookmarksFile* | ||
64 | NERDTreeBookmarksSort NERDTree.txt /*NERDTreeBookmarksSort* | ||
65 | NERDTreeCascadeOpenSingleChildDir NERDTree.txt /*NERDTreeCascadeOpenSingleChildDir* | ||
66 | NERDTreeCascadeSingleChildDir NERDTree.txt /*NERDTreeCascadeSingleChildDir* | ||
67 | NERDTreeCaseSensitiveSort NERDTree.txt /*NERDTreeCaseSensitiveSort* | ||
68 | NERDTreeChDirMode NERDTree.txt /*NERDTreeChDirMode* | ||
69 | NERDTreeCreatePrefix NERDTree.txt /*NERDTreeCreatePrefix* | ||
70 | NERDTreeCustomOpenArgs NERDTree.txt /*NERDTreeCustomOpenArgs* | ||
71 | NERDTreeDirArrowCollapsible NERDTree.txt /*NERDTreeDirArrowCollapsible* | ||
72 | NERDTreeDirArrowExpandable NERDTree.txt /*NERDTreeDirArrowExpandable* | ||
73 | NERDTreeFunctionality NERDTree.txt /*NERDTreeFunctionality* | ||
74 | NERDTreeGlobalCommands NERDTree.txt /*NERDTreeGlobalCommands* | ||
75 | NERDTreeHighlightCursorline NERDTree.txt /*NERDTreeHighlightCursorline* | ||
76 | NERDTreeHijackNetrw NERDTree.txt /*NERDTreeHijackNetrw* | ||
77 | NERDTreeIgnore NERDTree.txt /*NERDTreeIgnore* | ||
78 | NERDTreeInvalidBookmarks NERDTree.txt /*NERDTreeInvalidBookmarks* | ||
79 | NERDTreeKeymapAPI NERDTree.txt /*NERDTreeKeymapAPI* | ||
80 | NERDTreeLicense NERDTree.txt /*NERDTreeLicense* | ||
81 | NERDTreeMapCWD NERDTree.txt /*NERDTreeMapCWD* | ||
82 | NERDTreeMapChangeRoot NERDTree.txt /*NERDTreeMapChangeRoot* | ||
83 | NERDTreeMapChdir NERDTree.txt /*NERDTreeMapChdir* | ||
84 | NERDTreeMapCloseChildren NERDTree.txt /*NERDTreeMapCloseChildren* | ||
85 | NERDTreeMapCloseDir NERDTree.txt /*NERDTreeMapCloseDir* | ||
86 | NERDTreeMapCustomOpen NERDTree.txt /*NERDTreeMapCustomOpen* | ||
87 | NERDTreeMapDeleteBookmark NERDTree.txt /*NERDTreeMapDeleteBookmark* | ||
88 | NERDTreeMapHelp NERDTree.txt /*NERDTreeMapHelp* | ||
89 | NERDTreeMapJumpFirstChild NERDTree.txt /*NERDTreeMapJumpFirstChild* | ||
90 | NERDTreeMapJumpLastChild NERDTree.txt /*NERDTreeMapJumpLastChild* | ||
91 | NERDTreeMapJumpNextSibling NERDTree.txt /*NERDTreeMapJumpNextSibling* | ||
92 | NERDTreeMapJumpParent NERDTree.txt /*NERDTreeMapJumpParent* | ||
93 | NERDTreeMapJumpPrevSibling NERDTree.txt /*NERDTreeMapJumpPrevSibling* | ||
94 | NERDTreeMapJumpRoot NERDTree.txt /*NERDTreeMapJumpRoot* | ||
95 | NERDTreeMapMenu NERDTree.txt /*NERDTreeMapMenu* | ||
96 | NERDTreeMapOpenExpl NERDTree.txt /*NERDTreeMapOpenExpl* | ||
97 | NERDTreeMapOpenInTab NERDTree.txt /*NERDTreeMapOpenInTab* | ||
98 | NERDTreeMapOpenInTabSilent NERDTree.txt /*NERDTreeMapOpenInTabSilent* | ||
99 | NERDTreeMapOpenRecursively NERDTree.txt /*NERDTreeMapOpenRecursively* | ||
100 | NERDTreeMapOpenSplit NERDTree.txt /*NERDTreeMapOpenSplit* | ||
101 | NERDTreeMapOpenVSplit NERDTree.txt /*NERDTreeMapOpenVSplit* | ||
102 | NERDTreeMapPreviewSplit NERDTree.txt /*NERDTreeMapPreviewSplit* | ||
103 | NERDTreeMapPreviewVSplit NERDTree.txt /*NERDTreeMapPreviewVSplit* | ||
104 | NERDTreeMapQuit NERDTree.txt /*NERDTreeMapQuit* | ||
105 | NERDTreeMapRefresh NERDTree.txt /*NERDTreeMapRefresh* | ||
106 | NERDTreeMapRefreshRoot NERDTree.txt /*NERDTreeMapRefreshRoot* | ||
107 | NERDTreeMapToggleBookmarks NERDTree.txt /*NERDTreeMapToggleBookmarks* | ||
108 | NERDTreeMapToggleFiles NERDTree.txt /*NERDTreeMapToggleFiles* | ||
109 | NERDTreeMapToggleFilters NERDTree.txt /*NERDTreeMapToggleFilters* | ||
110 | NERDTreeMapToggleHidden NERDTree.txt /*NERDTreeMapToggleHidden* | ||
111 | NERDTreeMapToggleZoom NERDTree.txt /*NERDTreeMapToggleZoom* | ||
112 | NERDTreeMapUpdir NERDTree.txt /*NERDTreeMapUpdir* | ||
113 | NERDTreeMapUpdirKeepOpen NERDTree.txt /*NERDTreeMapUpdirKeepOpen* | ||
114 | NERDTreeMappings NERDTree.txt /*NERDTreeMappings* | ||
115 | NERDTreeMarkBookmarks NERDTree.txt /*NERDTreeMarkBookmarks* | ||
116 | NERDTreeMenu NERDTree.txt /*NERDTreeMenu* | ||
117 | NERDTreeMenu-j NERDTree.txt /*NERDTreeMenu-j* | ||
118 | NERDTreeMenu-k NERDTree.txt /*NERDTreeMenu-k* | ||
119 | NERDTreeMenuAPI NERDTree.txt /*NERDTreeMenuAPI* | ||
120 | NERDTreeMenuDown NERDTree.txt /*NERDTreeMenuDown* | ||
121 | NERDTreeMenuUp NERDTree.txt /*NERDTreeMenuUp* | ||
122 | NERDTreeMinimalMenu NERDTree.txt /*NERDTreeMinimalMenu* | ||
123 | NERDTreeMinimalUI NERDTree.txt /*NERDTreeMinimalUI* | ||
124 | NERDTreeMouseMode NERDTree.txt /*NERDTreeMouseMode* | ||
125 | NERDTreeNaturalSort NERDTree.txt /*NERDTreeNaturalSort* | ||
126 | NERDTreeNodeDelimiter NERDTree.txt /*NERDTreeNodeDelimiter* | ||
127 | NERDTreePathListenerAPI NERDTree.txt /*NERDTreePathListenerAPI* | ||
128 | NERDTreeQuitOnOpen NERDTree.txt /*NERDTreeQuitOnOpen* | ||
129 | NERDTreeRender() NERDTree.txt /*NERDTreeRender()* | ||
130 | NERDTreeRespectWildIgnore NERDTree.txt /*NERDTreeRespectWildIgnore* | ||
131 | NERDTreeSettings NERDTree.txt /*NERDTreeSettings* | ||
132 | NERDTreeSettingsDetails NERDTree.txt /*NERDTreeSettingsDetails* | ||
133 | NERDTreeSettingsSummary NERDTree.txt /*NERDTreeSettingsSummary* | ||
134 | NERDTreeShowBookmarks NERDTree.txt /*NERDTreeShowBookmarks* | ||
135 | NERDTreeShowFiles NERDTree.txt /*NERDTreeShowFiles* | ||
136 | NERDTreeShowHidden NERDTree.txt /*NERDTreeShowHidden* | ||
137 | NERDTreeShowLineNumbers NERDTree.txt /*NERDTreeShowLineNumbers* | ||
138 | NERDTreeSortOrder NERDTree.txt /*NERDTreeSortOrder* | ||
139 | NERDTreeStatusline NERDTree.txt /*NERDTreeStatusline* | ||
140 | NERDTreeUseTCD NERDTree.txt /*NERDTreeUseTCD* | ||
141 | NERDTreeWinPos NERDTree.txt /*NERDTreeWinPos* | ||
142 | NERDTreeWinSize NERDTree.txt /*NERDTreeWinSize* | ||
143 | loaded_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 | |||
11 | let s:Bookmark = {} | ||
12 | let g:NERDTreeBookmark = s:Bookmark | ||
13 | |||
14 | " FUNCTION: Bookmark.activate(nerdtree) {{{1 | ||
15 | function! s:Bookmark.activate(nerdtree, ...) | ||
16 | call self.open(a:nerdtree, a:0 ? a:1 : {}) | ||
17 | endfunction | ||
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 | ||
22 | function! 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)) | ||
30 | endfunction | ||
31 | |||
32 | " FUNCTION: Bookmark.Bookmarks() {{{1 | ||
33 | " Class method to get all bookmarks. Lazily initializes the bookmarks global | ||
34 | " variable | ||
35 | function! s:Bookmark.Bookmarks() | ||
36 | if !exists('g:NERDTreeBookmarks') | ||
37 | let g:NERDTreeBookmarks = [] | ||
38 | endif | ||
39 | return g:NERDTreeBookmarks | ||
40 | endfunction | ||
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 | ||
45 | function! 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 | ||
52 | endfunction | ||
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. | ||
57 | function! 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 | ||
69 | endfunction | ||
70 | |||
71 | " FUNCTION: Bookmark.BookmarkNames() {{{1 | ||
72 | " Class method to return an array of all bookmark names | ||
73 | function! s:Bookmark.BookmarkNames() | ||
74 | let names = [] | ||
75 | for i in s:Bookmark.Bookmarks() | ||
76 | call add(names, i.name) | ||
77 | endfor | ||
78 | return names | ||
79 | endfunction | ||
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 | ||
87 | function! 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 | ||
118 | endfunction | ||
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. | ||
124 | function! 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 | ||
140 | endfunction | ||
141 | |||
142 | " FUNCTION: Bookmark.ClearAll() {{{1 | ||
143 | " Class method to delete all bookmarks. | ||
144 | function! s:Bookmark.ClearAll() | ||
145 | for i in s:Bookmark.Bookmarks() | ||
146 | call i.delete() | ||
147 | endfor | ||
148 | call s:Bookmark.Write() | ||
149 | endfunction | ||
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 | ||
154 | function! s:Bookmark.delete() | ||
155 | call remove(s:Bookmark.Bookmarks(), index(s:Bookmark.Bookmarks(), self)) | ||
156 | call s:Bookmark.Write() | ||
157 | endfunction | ||
158 | |||
159 | " FUNCTION: s:Edit() {{{1 | ||
160 | " opens the NERDTreeBookmarks file for manual editing | ||
161 | function! s:Bookmark.Edit() | ||
162 | call nerdtree#exec('wincmd w', 1) | ||
163 | call nerdtree#exec('edit '.g:NERDTreeBookmarksFile, 1) | ||
164 | endfunction | ||
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 | ||
173 | function! 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 | ||
184 | endfunction | ||
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. | ||
191 | function! s:Bookmark.GetNodeForName(name, searchFromAbsoluteRoot, nerdtree) | ||
192 | let l:bookmark = s:Bookmark.BookmarkFor(a:name) | ||
193 | return l:bookmark.getNode(a:nerdtree, a:searchFromAbsoluteRoot) | ||
194 | endfunction | ||
195 | |||
196 | " FUNCTION: Bookmark.GetSelected() {{{1 | ||
197 | " returns the Bookmark the cursor is over, or {} | ||
198 | function! 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 {} | ||
209 | endfunction | ||
210 | |||
211 | " FUNCTION: Bookmark.InvalidBookmarks() {{{1 | ||
212 | " Class method to get all invalid bookmark strings read from the bookmarks | ||
213 | " file | ||
214 | function! s:Bookmark.InvalidBookmarks() | ||
215 | if !exists('g:NERDTreeInvalidBookmarks') | ||
216 | let g:NERDTreeInvalidBookmarks = [] | ||
217 | endif | ||
218 | return g:NERDTreeInvalidBookmarks | ||
219 | endfunction | ||
220 | |||
221 | " FUNCTION: Bookmark.mustExist() {{{1 | ||
222 | function! 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 | ||
228 | endfunction | ||
229 | |||
230 | " FUNCTION: Bookmark.New(name, path) {{{1 | ||
231 | " Create a new bookmark object with the given name and path object | ||
232 | function! 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 | ||
241 | endfunction | ||
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 | " | ||
256 | function! 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 | ||
269 | endfunction | ||
270 | |||
271 | " FUNCTION: Bookmark.openInNewTab(options) {{{1 | ||
272 | " Create a new bookmark object with the given name and path object | ||
273 | function! s:Bookmark.openInNewTab(options) | ||
274 | call nerdtree#deprecated('Bookmark.openInNewTab', 'is deprecated, use open() instead') | ||
275 | call self.open(a:options) | ||
276 | endfunction | ||
277 | |||
278 | " FUNCTION: Bookmark.setPath(path) {{{1 | ||
279 | " makes this bookmark point to the given path | ||
280 | function! s:Bookmark.setPath(path) | ||
281 | let self.path = a:path | ||
282 | endfunction | ||
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. | ||
287 | function! s:Bookmark.SortBookmarksList() | ||
288 | call sort(s:Bookmark.Bookmarks(), s:Bookmark.CompareBookmarksByName, s:Bookmark) | ||
289 | endfunction | ||
290 | |||
291 | " FUNCTION: Bookmark.str() {{{1 | ||
292 | " Get the string that should be rendered in the view for this bookmark | ||
293 | function! 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 | ||
307 | endfunction | ||
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. | ||
312 | function! 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 | ||
322 | endfunction | ||
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. | ||
327 | function! s:Bookmark.ToRoot(name, nerdtree) | ||
328 | let l:bookmark = s:Bookmark.BookmarkFor(a:name) | ||
329 | call l:bookmark.toRoot(a:nerdtree) | ||
330 | endfunction | ||
331 | |||
332 | " FUNCTION: Bookmark.validate() {{{1 | ||
333 | function! 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 | ||
341 | endfunction | ||
342 | |||
343 | " FUNCTION: Bookmark.Write() {{{1 | ||
344 | " Class method to write all bookmarks to the bookmarks file | ||
345 | function! 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 | ||
363 | endfunction | ||
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 | |||
11 | let s:Creator = {} | ||
12 | let g:NERDTreeCreator = s:Creator | ||
13 | |||
14 | " FUNCTION: s:Creator._bindMappings() {{{1 | ||
15 | function! 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() | ||
27 | endfunction | ||
28 | |||
29 | " FUNCTION: s:Creator._broadcastInitEvent() {{{1 | ||
30 | function! s:Creator._broadcastInitEvent() | ||
31 | if exists('#User#NERDTreeInit') | ||
32 | doautocmd User NERDTreeInit | ||
33 | endif | ||
34 | endfunction | ||
35 | |||
36 | " FUNCTION: s:Creator.BufNamePrefix() {{{1 | ||
37 | function! s:Creator.BufNamePrefix() | ||
38 | return 'NERD_tree_' | ||
39 | endfunction | ||
40 | |||
41 | " FUNCTION: s:Creator.CreateTabTree(a:name) {{{1 | ||
42 | function! s:Creator.CreateTabTree(name) | ||
43 | let creator = s:Creator.New() | ||
44 | call creator.createTabTree(a:name) | ||
45 | endfunction | ||
46 | |||
47 | " FUNCTION: s:Creator.createTabTree(a:name) {{{1 | ||
48 | " name: the name of a bookmark or a directory | ||
49 | function! 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() | ||
74 | endfunction | ||
75 | |||
76 | " FUNCTION: s:Creator.CreateWindowTree(dir) {{{1 | ||
77 | function! s:Creator.CreateWindowTree(dir) | ||
78 | let creator = s:Creator.New() | ||
79 | call creator.createWindowTree(a:dir) | ||
80 | endfunction | ||
81 | |||
82 | " FUNCTION: s:Creator.createWindowTree(dir) {{{1 | ||
83 | function! 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() | ||
107 | endfunction | ||
108 | |||
109 | " FUNCTION: s:Creator._createNERDTree(path) {{{1 | ||
110 | function! 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() | ||
119 | endfunction | ||
120 | |||
121 | " FUNCTION: s:Creator.CreateMirror() {{{1 | ||
122 | function! s:Creator.CreateMirror() | ||
123 | let creator = s:Creator.New() | ||
124 | call creator.createMirror() | ||
125 | endfunction | ||
126 | |||
127 | " FUNCTION: s:Creator.createMirror() {{{1 | ||
128 | function! 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 | ||
179 | endfunction | ||
180 | |||
181 | " FUNCTION: s:Creator._createTreeWin() {{{1 | ||
182 | " Initialize the NERDTree window. Open the window, size it properly, set all | ||
183 | " local options, etc. | ||
184 | function! 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 | |||
206 | endfunction | ||
207 | |||
208 | " FUNCTION: s:Creator._isBufHidden(nr) {{{1 | ||
209 | function! s:Creator._isBufHidden(nr) | ||
210 | redir => bufs | ||
211 | silent ls! | ||
212 | redir END | ||
213 | |||
214 | return bufs =~ a:nr . '..h' | ||
215 | endfunction | ||
216 | |||
217 | " FUNCTION: s:Creator.New() {{{1 | ||
218 | function! s:Creator.New() | ||
219 | let newCreator = copy(self) | ||
220 | return newCreator | ||
221 | endfunction | ||
222 | |||
223 | " FUNCTION: s:Creator._nextBufferName() {{{1 | ||
224 | " returns the buffer name for the next nerd tree | ||
225 | function! s:Creator._nextBufferName() | ||
226 | let name = s:Creator.BufNamePrefix() . self._nextBufferNumber() | ||
227 | return name | ||
228 | endfunction | ||
229 | |||
230 | " FUNCTION: s:Creator._nextBufferNumber() {{{1 | ||
231 | " the number to add to the nerd tree buffer name to make the buf name unique | ||
232 | function! 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 | ||
240 | endfunction | ||
241 | |||
242 | " FUNCTION: s:Creator._pathForString(str) {{{1 | ||
243 | " find a bookmark or adirectory for the given string | ||
244 | function! 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 | ||
273 | endfunction | ||
274 | |||
275 | " Function: s:Creator._removeTreeBufForTab() {{{1 | ||
276 | function! 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 | ||
290 | endfunction | ||
291 | |||
292 | " FUNCTION: s:Creator._setCommonBufOptions() {{{1 | ||
293 | function! 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 | ||
328 | endfunction | ||
329 | |||
330 | " FUNCTION: s:Creator._setupStatusline() {{{1 | ||
331 | function! s:Creator._setupStatusline() | ||
332 | if g:NERDTreeStatusline != -1 | ||
333 | let &l:statusline = g:NERDTreeStatusline | ||
334 | endif | ||
335 | endfunction | ||
336 | |||
337 | " FUNCTION: s:Creator._tabpagevar(tabnr, var) {{{1 | ||
338 | function! 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 | ||
356 | endfunction | ||
357 | |||
358 | " FUNCTION: s:Creator.ToggleTabTree(dir) {{{1 | ||
359 | function! s:Creator.ToggleTabTree(dir) | ||
360 | let creator = s:Creator.New() | ||
361 | call creator.toggleTabTree(a:dir) | ||
362 | endfunction | ||
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.) | ||
372 | function! 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 | ||
388 | endfunction | ||
389 | |||
390 | " Function: s:Creator._uniq(list) {{{1 | ||
391 | " returns a:list without duplicates | ||
392 | function! 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 | ||
400 | endfunction | ||
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 | "============================================================ | ||
3 | let s:Event = {} | ||
4 | let g:NERDTreeEvent = s:Event | ||
5 | |||
6 | function! 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 | ||
13 | endfunction | ||
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 | "============================================================ | ||
3 | let s:FlagSet = {} | ||
4 | let g:NERDTreeFlagSet = s:FlagSet | ||
5 | |||
6 | "FUNCTION: FlagSet.addFlag(scope, flag) {{{1 | ||
7 | function! 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 | ||
12 | endfunction | ||
13 | |||
14 | "FUNCTION: FlagSet.clearFlags(scope) {{{1 | ||
15 | function! s:FlagSet.clearFlags(scope) | ||
16 | let self._flags[a:scope] = [] | ||
17 | endfunction | ||
18 | |||
19 | "FUNCTION: FlagSet._flagsForScope(scope) {{{1 | ||
20 | function! 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] | ||
25 | endfunction | ||
26 | |||
27 | "FUNCTION: FlagSet.New() {{{1 | ||
28 | function! s:FlagSet.New() | ||
29 | let newObj = copy(self) | ||
30 | let newObj._flags = {} | ||
31 | return newObj | ||
32 | endfunction | ||
33 | |||
34 | "FUNCTION: FlagSet.removeFlag(scope, flag) {{{1 | ||
35 | function! 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 | ||
42 | endfunction | ||
43 | |||
44 | "FUNCTION: FlagSet.renderToString() {{{1 | ||
45 | function! 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 . ']' | ||
56 | endfunction | ||
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 | "============================================================ | ||
3 | let s:KeyMap = {} | ||
4 | let g:NERDTreeKeyMap = s:KeyMap | ||
5 | let s:keyMaps = {} | ||
6 | |||
7 | "FUNCTION: KeyMap.All() {{{1 | ||
8 | function! s:KeyMap.All() | ||
9 | let sortedKeyMaps = values(s:keyMaps) | ||
10 | call sort(sortedKeyMaps, s:KeyMap.Compare, s:KeyMap) | ||
11 | |||
12 | return sortedKeyMaps | ||
13 | endfunction | ||
14 | |||
15 | "FUNCTION: KeyMap.Compare(keyMap1, keyMap2) {{{1 | ||
16 | function! 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 | ||
27 | endfunction | ||
28 | |||
29 | "FUNCTION: KeyMap.FindFor(key, scope) {{{1 | ||
30 | function! s:KeyMap.FindFor(key, scope) | ||
31 | return get(s:keyMaps, a:key . a:scope, {}) | ||
32 | endfunction | ||
33 | |||
34 | "FUNCTION: KeyMap.BindAll() {{{1 | ||
35 | function! s:KeyMap.BindAll() | ||
36 | for i in values(s:keyMaps) | ||
37 | call i.bind() | ||
38 | endfor | ||
39 | endfunction | ||
40 | |||
41 | "FUNCTION: KeyMap.bind() {{{1 | ||
42 | function! 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>' | ||
59 | endfunction | ||
60 | |||
61 | "FUNCTION: KeyMap.Remove(key, scope) {{{1 | ||
62 | function! s:KeyMap.Remove(key, scope) | ||
63 | return remove(s:keyMaps, a:key . a:scope) | ||
64 | endfunction | ||
65 | |||
66 | "FUNCTION: KeyMap.invoke() {{{1 | ||
67 | "Call the KeyMaps callback function | ||
68 | function! 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 | ||
75 | endfunction | ||
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. | ||
87 | function! 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 | ||
139 | endfunction | ||
140 | |||
141 | "FUNCTION: KeyMap.Create(options) {{{1 | ||
142 | function! 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) | ||
157 | endfunction | ||
158 | |||
159 | "FUNCTION: KeyMap.Add(keymap) {{{1 | ||
160 | function! s:KeyMap.Add(keymap) | ||
161 | let s:keyMaps[a:keymap.key . a:keymap.scope] = a:keymap | ||
162 | endfunction | ||
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 | "============================================================ | ||
3 | let s:MenuController = {} | ||
4 | let g:NERDTreeMenuController = s:MenuController | ||
5 | |||
6 | "FUNCTION: MenuController.New(menuItems) {{{1 | ||
7 | "create a new menu controller that operates on the given menu items | ||
8 | function! 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 | ||
16 | endfunction | ||
17 | |||
18 | " FUNCTION: s:MenuController.isMinimal() {{{1 | ||
19 | function! s:MenuController.isMinimal() | ||
20 | return g:NERDTreeMinimalMenu | ||
21 | endfunction | ||
22 | |||
23 | " FUNCTION: MenuController.showMenu() {{{1 | ||
24 | " Enter the main loop of the NERDTree menu, prompting the user to select | ||
25 | " a menu item. | ||
26 | function! 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 | ||
57 | endfunction | ||
58 | |||
59 | "FUNCTION: MenuController._echoPrompt() {{{1 | ||
60 | function! 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 | ||
83 | endfunction | ||
84 | |||
85 | "FUNCTION: MenuController._current(key) {{{1 | ||
86 | "get the MenuItem that is currently selected | ||
87 | function! s:MenuController._current() | ||
88 | return self.menuItems[self.selection] | ||
89 | endfunction | ||
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 | ||
94 | function! 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 | ||
115 | endfunction | ||
116 | |||
117 | "FUNCTION: MenuController._allIndexesFor(shortcut) {{{1 | ||
118 | "get indexes to all menu items with the given shortcut | ||
119 | function! 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 | ||
129 | endfunction | ||
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 | ||
134 | function! 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 | ||
148 | endfunction | ||
149 | |||
150 | "FUNCTION: MenuController._setCmdheight() {{{1 | ||
151 | "sets &cmdheight to whatever is needed to display the menu | ||
152 | function! s:MenuController._setCmdheight() | ||
153 | if self.isMinimal() | ||
154 | let &cmdheight = 1 | ||
155 | else | ||
156 | let &cmdheight = len(self.menuItems) + 3 | ||
157 | endif | ||
158 | endfunction | ||
159 | |||
160 | "FUNCTION: MenuController._saveOptions() {{{1 | ||
161 | "set any vim options that are required to make the menu work (saving their old | ||
162 | "values) | ||
163 | function! s:MenuController._saveOptions() | ||
164 | let self._oldLazyredraw = &lazyredraw | ||
165 | let self._oldCmdheight = &cmdheight | ||
166 | set nolazyredraw | ||
167 | call self._setCmdheight() | ||
168 | endfunction | ||
169 | |||
170 | "FUNCTION: MenuController._restoreOptions() {{{1 | ||
171 | "restore the options we saved in _saveOptions() | ||
172 | function! s:MenuController._restoreOptions() | ||
173 | let &cmdheight = self._oldCmdheight | ||
174 | let &lazyredraw = self._oldLazyredraw | ||
175 | endfunction | ||
176 | |||
177 | "FUNCTION: MenuController._cursorDown() {{{1 | ||
178 | "move the cursor to the next menu item, skipping separators | ||
179 | function! 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 | ||
192 | endfunction | ||
193 | |||
194 | "FUNCTION: MenuController._cursorUp() {{{1 | ||
195 | "move the cursor to the previous menu item, skipping separators | ||
196 | function! 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 | ||
209 | endfunction | ||
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 | "============================================================ | ||
3 | let s:MenuItem = {} | ||
4 | let g:NERDTreeMenuItem = s:MenuItem | ||
5 | |||
6 | "FUNCTION: MenuItem.All() {{{1 | ||
7 | "get all top level menu items | ||
8 | function! s:MenuItem.All() | ||
9 | if !exists('s:menuItems') | ||
10 | let s:menuItems = [] | ||
11 | endif | ||
12 | return s:menuItems | ||
13 | endfunction | ||
14 | |||
15 | "FUNCTION: MenuItem.AllEnabled() {{{1 | ||
16 | "get all top level menu items that are currently enabled | ||
17 | function! 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 | ||
25 | endfunction | ||
26 | |||
27 | "FUNCTION: MenuItem.Create(options) {{{1 | ||
28 | "make a new menu item and add it to the global list | ||
29 | function! 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 | ||
53 | endfunction | ||
54 | |||
55 | "FUNCTION: MenuItem.CreateSeparator(options) {{{1 | ||
56 | "make a new separator menu item and add it to the global list | ||
57 | function! 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) | ||
64 | endfunction | ||
65 | |||
66 | "FUNCTION: MenuItem.CreateSubmenu(options) {{{1 | ||
67 | "make a new submenu and add it to global list | ||
68 | function! 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) | ||
73 | endfunction | ||
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 | ||
80 | function! 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 | ||
85 | endfunction | ||
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 | ||
91 | function! 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 | ||
104 | endfunction | ||
105 | |||
106 | "FUNCTION: MenuItem.isSeparator() {{{1 | ||
107 | "return 1 if this menuitem is a separator | ||
108 | function! s:MenuItem.isSeparator() | ||
109 | return self.callback == -1 && self.children == [] | ||
110 | endfunction | ||
111 | |||
112 | "FUNCTION: MenuItem.isSubmenu() {{{1 | ||
113 | "return 1 if this menuitem is a submenu | ||
114 | function! s:MenuItem.isSubmenu() | ||
115 | return self.callback == -1 && !empty(self.children) | ||
116 | endfunction | ||
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 | "============================================================ | ||
3 | let s:NERDTree = {} | ||
4 | let g:NERDTree = s:NERDTree | ||
5 | |||
6 | "FUNCTION: s:NERDTree.AddPathFilter() {{{1 | ||
7 | function! s:NERDTree.AddPathFilter(callback) | ||
8 | call add(s:NERDTree.PathFilters(), a:callback) | ||
9 | endfunction | ||
10 | |||
11 | "FUNCTION: s:NERDTree.changeRoot(node) {{{1 | ||
12 | function! 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 | ||
33 | endfunction | ||
34 | |||
35 | "FUNCTION: s:NERDTree.Close() {{{1 | ||
36 | "Closes the tab tree window for this tab | ||
37 | function! 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 | ||
66 | endfunction | ||
67 | |||
68 | "FUNCTION: s:NERDTree.CursorToBookmarkTable(){{{1 | ||
69 | "Places the cursor at the top of the bookmarks table | ||
70 | function! 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) | ||
89 | endfunction | ||
90 | |||
91 | "FUNCTION: s:NERDTree.CursorToTreeWin(){{{1 | ||
92 | "Places the cursor in the nerd tree window | ||
93 | function! s:NERDTree.CursorToTreeWin(...) | ||
94 | call g:NERDTree.MustBeOpen() | ||
95 | call nerdtree#exec(g:NERDTree.GetWinNum() . 'wincmd w', a:0 >0 ? a:1 : 1) | ||
96 | endfunction | ||
97 | |||
98 | " Function: s:NERDTree.ExistsForBuffer() {{{1 | ||
99 | " Returns 1 if a nerd tree root exists in the current buffer | ||
100 | function! s:NERDTree.ExistsForBuf() | ||
101 | return exists('b:NERDTree') | ||
102 | endfunction | ||
103 | |||
104 | " Function: s:NERDTree.ExistsForTab() {{{1 | ||
105 | " Returns 1 if a nerd tree root exists in the current tab | ||
106 | function! 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')) | ||
113 | endfunction | ||
114 | |||
115 | function! s:NERDTree.ForCurrentBuf() | ||
116 | if s:NERDTree.ExistsForBuf() | ||
117 | return b:NERDTree | ||
118 | else | ||
119 | return {} | ||
120 | endif | ||
121 | endfunction | ||
122 | |||
123 | "FUNCTION: s:NERDTree.ForCurrentTab() {{{1 | ||
124 | function! s:NERDTree.ForCurrentTab() | ||
125 | if !s:NERDTree.ExistsForTab() | ||
126 | return | ||
127 | endif | ||
128 | |||
129 | let bufnr = bufnr(t:NERDTreeBufName) | ||
130 | return getbufvar(bufnr, 'NERDTree') | ||
131 | endfunction | ||
132 | |||
133 | "FUNCTION: s:NERDTree.getRoot() {{{1 | ||
134 | function! s:NERDTree.getRoot() | ||
135 | return self.root | ||
136 | endfunction | ||
137 | |||
138 | "FUNCTION: s:NERDTree.GetWinNum() {{{1 | ||
139 | "gets the nerd tree window number for this tab | ||
140 | function! 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 | ||
153 | endfunction | ||
154 | |||
155 | "FUNCTION: s:NERDTree.IsOpen() {{{1 | ||
156 | function! s:NERDTree.IsOpen() | ||
157 | return s:NERDTree.GetWinNum() !=# -1 | ||
158 | endfunction | ||
159 | |||
160 | "FUNCTION: s:NERDTree.isTabTree() {{{1 | ||
161 | function! s:NERDTree.isTabTree() | ||
162 | return self._type ==# 'tab' | ||
163 | endfunction | ||
164 | |||
165 | "FUNCTION: s:NERDTree.isWinTree() {{{1 | ||
166 | function! s:NERDTree.isWinTree() | ||
167 | return self._type ==# 'window' | ||
168 | endfunction | ||
169 | |||
170 | "FUNCTION: s:NERDTree.MustBeOpen() {{{1 | ||
171 | function! s:NERDTree.MustBeOpen() | ||
172 | if !s:NERDTree.IsOpen() | ||
173 | throw 'NERDTree.TreeNotOpen' | ||
174 | endif | ||
175 | endfunction | ||
176 | |||
177 | "FUNCTION: s:NERDTree.New() {{{1 | ||
178 | function! 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 | ||
184 | endfunction | ||
185 | |||
186 | "FUNCTION: s:NERDTree.PathFilters() {{{1 | ||
187 | function! s:NERDTree.PathFilters() | ||
188 | if !exists('s:NERDTree._PathFilters') | ||
189 | let s:NERDTree._PathFilters = [] | ||
190 | endif | ||
191 | return s:NERDTree._PathFilters | ||
192 | endfunction | ||
193 | |||
194 | "FUNCTION: s:NERDTree.previousBuf() {{{1 | ||
195 | function! s:NERDTree.previousBuf() | ||
196 | return self._previousBuf | ||
197 | endfunction | ||
198 | |||
199 | function! s:NERDTree.setPreviousBuf(bnum) | ||
200 | let self._previousBuf = a:bnum | ||
201 | endfunction | ||
202 | |||
203 | "FUNCTION: s:NERDTree.render() {{{1 | ||
204 | "A convenience function - since this is called often | ||
205 | function! s:NERDTree.render() | ||
206 | call self.ui.render() | ||
207 | endfunction | ||
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 | "============================================================ | ||
3 | let s:Notifier = {} | ||
4 | |||
5 | function! 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) | ||
12 | endfunction | ||
13 | |||
14 | function! 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 | ||
21 | endfunction | ||
22 | |||
23 | function! s:Notifier.GetListenersMap() | ||
24 | if !exists('s:refreshListenersMap') | ||
25 | let s:refreshListenersMap = {} | ||
26 | endif | ||
27 | return s:refreshListenersMap | ||
28 | endfunction | ||
29 | |||
30 | function! s:Notifier.GetListenersForEvent(name) | ||
31 | let listenersMap = s:Notifier.GetListenersMap() | ||
32 | return get(listenersMap, a:name, []) | ||
33 | endfunction | ||
34 | |||
35 | let 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 | |||
8 | let s:Opener = {} | ||
9 | let 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 | ||
18 | function! 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 | ||
33 | endfunction | ||
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 | ||
42 | function! 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 | ||
50 | endfunction | ||
51 | |||
52 | " FUNCTION: s:Opener._firstUsableWindow() {{{1 | ||
53 | " find the window number of the first normal window | ||
54 | function! 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 | ||
67 | endfunction | ||
68 | |||
69 | " FUNCTION: Opener._gotoTargetWin() {{{1 | ||
70 | function! 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 | ||
94 | endfunction | ||
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 | ||
102 | function! 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 | ||
125 | endfunction | ||
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 | ||
138 | function! 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 | ||
151 | endfunction | ||
152 | |||
153 | " FUNCTION: Opener._newSplit() {{{1 | ||
154 | function! 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 | ||
182 | endfunction | ||
183 | |||
184 | " FUNCTION: Opener._newVSplit() {{{1 | ||
185 | function! 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 | ||
206 | endfunction | ||
207 | |||
208 | " FUNCTION: Opener.open(target) {{{1 | ||
209 | function! s:Opener.open(target) | ||
210 | if self._path.isDirectory | ||
211 | call self._openDirectory(a:target) | ||
212 | return | ||
213 | endif | ||
214 | |||
215 | call self._openFile() | ||
216 | endfunction | ||
217 | |||
218 | " FUNCTION: Opener._openFile() {{{1 | ||
219 | function! 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() | ||
237 | endfunction | ||
238 | |||
239 | " FUNCTION: Opener._openDirectory(node) {{{1 | ||
240 | function! 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 | ||
258 | endfunction | ||
259 | |||
260 | " FUNCTION: Opener._previousWindow() {{{1 | ||
261 | function! 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 | ||
278 | endfunction | ||
279 | |||
280 | " FUNCTION: Opener._restoreCursorPos() {{{1 | ||
281 | function! s:Opener._restoreCursorPos() | ||
282 | call nerdtree#exec(self._tabnr . 'tabnext', 1) | ||
283 | call nerdtree#exec(bufwinnr(self._bufnr) . 'wincmd w', 1) | ||
284 | endfunction | ||
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 | ||
290 | function! 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 | ||
318 | endfunction | ||
319 | |||
320 | " FUNCTION: Opener._saveCursorPos() {{{1 | ||
321 | function! s:Opener._saveCursorPos() | ||
322 | let self._bufnr = bufnr('') | ||
323 | let self._tabnr = tabpagenr() | ||
324 | endfunction | ||
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 | |||
10 | let s:Path = {} | ||
11 | let g:NERDTreePath = s:Path | ||
12 | |||
13 | " FUNCTION: Path.AbsolutePathFor(pathStr) {{{1 | ||
14 | function! 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 | ||
36 | endfunction | ||
37 | |||
38 | " FUNCTION: Path.bookmarkNames() {{{1 | ||
39 | function! s:Path.bookmarkNames() | ||
40 | if !exists('self._bookmarkNames') | ||
41 | call self.cacheDisplayString() | ||
42 | endif | ||
43 | return self._bookmarkNames | ||
44 | endfunction | ||
45 | |||
46 | " FUNCTION: Path.cacheDisplayString() {{{1 | ||
47 | function! 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 | ||
71 | endfunction | ||
72 | |||
73 | " FUNCTION: Path.addDelimiter() {{{1 | ||
74 | function! 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 | ||
80 | endfunction | ||
81 | |||
82 | " FUNCTION: Path.changeToDir() {{{1 | ||
83 | function! 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 | ||
100 | endfunction | ||
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 | ||
112 | function! 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) | ||
137 | endfunction | ||
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 | ||
145 | function! 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 | ||
163 | endfunction | ||
164 | |||
165 | " FUNCTION: Path.CopyingSupported() {{{1 | ||
166 | " | ||
167 | " returns 1 if copying is supported for this OS | ||
168 | function! s:Path.CopyingSupported() | ||
169 | return exists('g:NERDTreeCopyCmd') || (exists('g:NERDTreeCopyDirCmd') && exists('g:NERDTreeCopyFileCmd')) | ||
170 | endfunction | ||
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 | ||
179 | function! 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 | ||
190 | endfunction | ||
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 | ||
199 | function! 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 | ||
204 | endfunction | ||
205 | |||
206 | " FUNCTION: Path.delete() {{{1 | ||
207 | " | ||
208 | " Deletes the file or directory represented by this path. | ||
209 | " | ||
210 | " Throws NERDTree.Path.Deletion exceptions | ||
211 | function! 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 | ||
238 | endfunction | ||
239 | |||
240 | " FUNCTION: Path.displayString() {{{1 | ||
241 | " | ||
242 | " Returns a string that specifies how the path should be represented as a | ||
243 | " string | ||
244 | function! s:Path.displayString() | ||
245 | if self.cachedDisplayString ==# '' | ||
246 | call self.cacheDisplayString() | ||
247 | endif | ||
248 | |||
249 | return self.cachedDisplayString | ||
250 | endfunction | ||
251 | |||
252 | " FUNCTION: Path.edit() {{{1 | ||
253 | function! s:Path.edit() | ||
254 | let l:bufname = self.str({'format': 'Edit'}) | ||
255 | if bufname('%') !=# l:bufname | ||
256 | exec 'edit ' . l:bufname | ||
257 | endif | ||
258 | endfunction | ||
259 | |||
260 | " FUNCTION: Path.extractDriveLetter(fullpath) {{{1 | ||
261 | " | ||
262 | " If running windows, cache the drive letter for this path | ||
263 | function! 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 | |||
276 | endfunction | ||
277 | |||
278 | " FUNCTION: Path.exists() {{{1 | ||
279 | " return 1 if this path points to a location that is readable or is a directory | ||
280 | function! s:Path.exists() | ||
281 | let p = self.str() | ||
282 | return filereadable(p) || isdirectory(p) | ||
283 | endfunction | ||
284 | |||
285 | " FUNCTION: Path._escChars() {{{1 | ||
286 | function! s:Path._escChars() | ||
287 | if nerdtree#runningWindows() | ||
288 | return " `\|\"#%&,?()\*^<>$" | ||
289 | endif | ||
290 | |||
291 | return " \\`\|\"#%&,?()\*^<>[]{}$" | ||
292 | endfunction | ||
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 | ||
300 | function! s:Path.getDir() | ||
301 | if self.isDirectory | ||
302 | return self | ||
303 | else | ||
304 | return self.getParent() | ||
305 | endif | ||
306 | endfunction | ||
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 | ||
314 | function! 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) | ||
322 | endfunction | ||
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. | ||
331 | function! 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 | ||
340 | endfunction | ||
341 | |||
342 | " FUNCTION: Path.getSortOrderIndex() {{{1 | ||
343 | " returns the index of the pattern in g:NERDTreeSortOrder that this path matches | ||
344 | function! 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, '*') | ||
355 | endfunction | ||
356 | |||
357 | " FUNCTION: Path._splitChunks(path) {{{1 | ||
358 | " returns a list of path chunks | ||
359 | function! 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 | ||
370 | endfunction | ||
371 | |||
372 | " FUNCTION: Path.getSortKey() {{{1 | ||
373 | " returns a key used in compare function for sorting | ||
374 | function! 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 | ||
408 | endfunction | ||
409 | |||
410 | " FUNCTION: Path.isHiddenUnder(path) {{{1 | ||
411 | function! 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 | ||
428 | endfunction | ||
429 | |||
430 | " FUNCTION: Path.isUnixHiddenFile() {{{1 | ||
431 | " check for unix hidden files | ||
432 | function! s:Path.isUnixHiddenFile() | ||
433 | return self.getLastPathComponent(0) =~# '^\.' | ||
434 | endfunction | ||
435 | |||
436 | " FUNCTION: Path.isUnixHiddenPath() {{{1 | ||
437 | " check for unix path with hidden components | ||
438 | function! 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 | ||
449 | endfunction | ||
450 | |||
451 | " FUNCTION: Path.ignore(nerdtree) {{{1 | ||
452 | " returns true if this path should be ignored | ||
453 | function! 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 | ||
480 | endfunction | ||
481 | |||
482 | " FUNCTION: Path._ignorePatternMatches(pattern) {{{1 | ||
483 | " returns true if this path matches the given ignore pattern | ||
484 | function! 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 | ||
502 | endfunction | ||
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 | ||
508 | function! s:Path.isAncestor(child) | ||
509 | return a:child.isUnder(self) | ||
510 | endfunction | ||
511 | |||
512 | " FUNCTION: Path.isUnder(path) {{{1 | ||
513 | " return 1 if this path is somewhere under the given path in the filesystem. | ||
514 | function! 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 | ||
538 | endfunction | ||
539 | |||
540 | " FUNCTION: Path.JoinPathStrings(...) {{{1 | ||
541 | function! 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, '/') | ||
547 | endfunction | ||
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 | ||
556 | function! 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 | ||
562 | endfunction | ||
563 | |||
564 | " FUNCTION: Path.New(pathStr) {{{1 | ||
565 | function! 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 | ||
574 | endfunction | ||
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 | ||
581 | function! s:Path.Resolve(path) | ||
582 | let tmp = resolve(a:path) | ||
583 | return tmp =~# '.\+/$' ? substitute(tmp, '/$', '', '') : tmp | ||
584 | endfunction | ||
585 | |||
586 | " FUNCTION: Path.readInfoFromDisk(fullpath) {{{1 | ||
587 | " | ||
588 | " | ||
589 | " Throws NERDTree.Path.InvalidArguments exception. | ||
590 | function! 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 | ||
638 | endfunction | ||
639 | |||
640 | " FUNCTION: Path.refresh(nerdtree) {{{1 | ||
641 | function! s:Path.refresh(nerdtree) | ||
642 | call self.readInfoFromDisk(self.str()) | ||
643 | call g:NERDTreePathNotifier.NotifyListeners('refresh', self, a:nerdtree, {}) | ||
644 | call self.cacheDisplayString() | ||
645 | endfunction | ||
646 | |||
647 | " FUNCTION: Path.refreshFlags(nerdtree) {{{1 | ||
648 | function! s:Path.refreshFlags(nerdtree) | ||
649 | call g:NERDTreePathNotifier.NotifyListeners('refreshFlags', self, a:nerdtree, {}) | ||
650 | call self.cacheDisplayString() | ||
651 | endfunction | ||
652 | |||
653 | " FUNCTION: Path.rename() {{{1 | ||
654 | " | ||
655 | " Renames this node on the filesystem | ||
656 | function! 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() | ||
674 | endfunction | ||
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. | ||
698 | function! 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 | ||
732 | endfunction | ||
733 | |||
734 | " FUNCTION: Path._strForUI() {{{1 | ||
735 | function! s:Path._strForUI() | ||
736 | let toReturn = '/' . join(self.pathSegments, '/') | ||
737 | if self.isDirectory && toReturn !=# '/' | ||
738 | let toReturn = toReturn . '/' | ||
739 | endif | ||
740 | return toReturn | ||
741 | endfunction | ||
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. | ||
746 | function! s:Path._strForCd() | ||
747 | return fnameescape(self.str()) | ||
748 | endfunction | ||
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. | ||
753 | function! 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 | ||
771 | endfunction | ||
772 | |||
773 | " FUNCTION: Path._strForGlob() {{{1 | ||
774 | function! 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 | ||
788 | endfunction | ||
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. | ||
793 | function! 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) | ||
802 | endfunction | ||
803 | |||
804 | " FUNCTION: Path.strTrunk() {{{1 | ||
805 | " Gets the path without the last segment on the end. | ||
806 | function! s:Path.strTrunk() | ||
807 | return self.drive . '/' . join(self.pathSegments[0:-2], '/') | ||
808 | endfunction | ||
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 | ||
814 | function! 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 | ||
824 | endfunction | ||
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 | ||
833 | function! 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 | ||
850 | endfunction | ||
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 | |||
10 | let s:TreeDirNode = copy(g:NERDTreeFileNode) | ||
11 | let g:NERDTreeDirNode = s:TreeDirNode | ||
12 | |||
13 | " FUNCTION: TreeDirNode.AbsoluteTreeRoot(){{{1 | ||
14 | " Class method that returns the highest cached ancestor of the current root. | ||
15 | function! s:TreeDirNode.AbsoluteTreeRoot() | ||
16 | let currentNode = b:NERDTree.root | ||
17 | while currentNode.parent !=# {} | ||
18 | let currentNode = currentNode.parent | ||
19 | endwhile | ||
20 | return currentNode | ||
21 | endfunction | ||
22 | |||
23 | " FUNCTION: TreeDirNode.activate([options]) {{{1 | ||
24 | function! 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 | ||
37 | endfunction | ||
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 | ||
45 | function! 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 | ||
52 | endfunction | ||
53 | |||
54 | " FUNCTION: TreeDirNode.close() {{{1 | ||
55 | " Mark this TreeDirNode as closed. | ||
56 | function! 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 | ||
63 | endfunction | ||
64 | |||
65 | " FUNCTION: TreeDirNode.closeChildren() {{{1 | ||
66 | " Recursively close any directory nodes that are descendants of this node. | ||
67 | function! 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 | ||
74 | endfunction | ||
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 | ||
86 | function! 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 | ||
90 | endfunction | ||
91 | |||
92 | " FUNCTION: TreeDirNode.displayString() {{{1 | ||
93 | " Assemble and return a string that can represent this TreeDirNode object in | ||
94 | " the NERDTree window. | ||
95 | function! 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 | ||
112 | endfunction | ||
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 | ||
119 | unlet s:TreeDirNode.findNode | ||
120 | function! 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 {} | ||
137 | endfunction | ||
138 | |||
139 | " FUNCTION: TreeDirNode.getCascade() {{{1 | ||
140 | " Return an array of dir nodes (starting from self) that can be cascade opened. | ||
141 | function! 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() | ||
150 | endfunction | ||
151 | |||
152 | " FUNCTION: TreeDirNode.getCascadeRoot() {{{1 | ||
153 | " Return the first directory node in the cascade in which this directory node | ||
154 | " is rendered. | ||
155 | function! 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 | ||
176 | endfunction | ||
177 | |||
178 | " FUNCTION: TreeDirNode.getChildCount() {{{1 | ||
179 | " Returns the number of children this node has | ||
180 | function! s:TreeDirNode.getChildCount() | ||
181 | return len(self.children) | ||
182 | endfunction | ||
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 | ||
192 | function! 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 | |||
204 | endfunction | ||
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. | ||
213 | function! 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] | ||
219 | endfunction | ||
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 | ||
229 | function! 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 | ||
250 | endfunction | ||
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. | ||
255 | function! s:TreeDirNode.getDirChildren() | ||
256 | return filter(copy(self.children), 'v:val.path.isDirectory ==# 1') | ||
257 | endfunction | ||
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. | ||
272 | function! 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 | ||
331 | endfunction | ||
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 | ||
336 | unlet s:TreeDirNode.GetSelected | ||
337 | function! 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 | ||
345 | endfunction | ||
346 | |||
347 | " FUNCTION: TreeDirNode.getVisibleChildCount() {{{1 | ||
348 | " Returns the number of visible children this node has | ||
349 | function! s:TreeDirNode.getVisibleChildCount() | ||
350 | return len(self.getVisibleChildren()) | ||
351 | endfunction | ||
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 | ||
358 | function! 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 | ||
366 | endfunction | ||
367 | |||
368 | " FUNCTION: TreeDirNode.hasVisibleChildren() {{{1 | ||
369 | " returns 1 if this node has any childre, 0 otherwise.. | ||
370 | function! s:TreeDirNode.hasVisibleChildren() | ||
371 | return self.getVisibleChildCount() !=# 0 | ||
372 | endfunction | ||
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. | ||
382 | function! 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 | ||
403 | endfunction | ||
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 | ||
413 | function! 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() | ||
443 | endfunction | ||
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 | ||
451 | function! 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 | ||
466 | endfunction | ||
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. | ||
472 | function! 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 | ||
501 | endfunction | ||
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. | ||
507 | function! 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 | ||
522 | endfunction | ||
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. | ||
527 | function! s:TreeDirNode.openExplorer() | ||
528 | execute 'wincmd p' | ||
529 | execute 'edit '.self.path.str({'format':'Edit'}) | ||
530 | endfunction | ||
531 | |||
532 | " FUNCTION: TreeDirNode.openInNewTab(options) {{{1 | ||
533 | unlet s:TreeDirNode.openInNewTab | ||
534 | function! s:TreeDirNode.openInNewTab(options) | ||
535 | call nerdtree#deprecated('TreeDirNode.openInNewTab', 'is deprecated, use open() instead') | ||
536 | call self.open({'where': 't'}) | ||
537 | endfunction | ||
538 | |||
539 | " FUNCTION: TreeDirNode._openInNewTab() {{{1 | ||
540 | function! s:TreeDirNode._openInNewTab() | ||
541 | tabnew | ||
542 | call g:NERDTreeCreator.CreateTabTree(self.path.str()) | ||
543 | endfunction | ||
544 | |||
545 | " FUNCTION: TreeDirNode.openRecursively() {{{1 | ||
546 | " Open this directory node and any descendant directory nodes whose pathnames | ||
547 | " are not ignored. | ||
548 | function! 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 | ||
556 | endfunction | ||
557 | |||
558 | " FUNCTION: TreeDirNode.refresh() {{{1 | ||
559 | function! 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 | ||
595 | endfunction | ||
596 | |||
597 | " FUNCTION: TreeDirNode.refreshFlags() {{{1 | ||
598 | unlet s:TreeDirNode.refreshFlags | ||
599 | function! s:TreeDirNode.refreshFlags() | ||
600 | call self.path.refreshFlags(self.getNerdtree()) | ||
601 | for i in self.children | ||
602 | call i.refreshFlags() | ||
603 | endfor | ||
604 | endfunction | ||
605 | |||
606 | " FUNCTION: TreeDirNode.refreshDirFlags() {{{1 | ||
607 | function! s:TreeDirNode.refreshDirFlags() | ||
608 | call self.path.refreshFlags(self.getNerdtree()) | ||
609 | endfunction | ||
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 | ||
615 | function! 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) | ||
644 | endfunction | ||
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 | ||
652 | function! 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' | ||
661 | endfunction | ||
662 | |||
663 | " FUNCTION: TreeDirNode.sortChildren() {{{1 | ||
664 | " Sort self.children by alphabetical order and directory priority. | ||
665 | function! 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 | ||
672 | endfunction | ||
673 | |||
674 | " FUNCTION: TreeDirNode.toggleOpen([options]) {{{1 | ||
675 | " Opens this directory if it is closed and vice versa | ||
676 | function! 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 | ||
687 | endfunction | ||
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 | ||
696 | function! 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 | ||
704 | endfunction | ||
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 | |||
9 | let s:TreeFileNode = {} | ||
10 | let g:NERDTreeFileNode = s:TreeFileNode | ||
11 | |||
12 | " FUNCTION: TreeFileNode.activate(...) {{{1 | ||
13 | function! s:TreeFileNode.activate(...) | ||
14 | call self.open(a:0 ? a:1 : {}) | ||
15 | endfunction | ||
16 | |||
17 | " FUNCTION: TreeFileNode.bookmark(name) {{{1 | ||
18 | " bookmark this node with a:name | ||
19 | function! 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 | ||
37 | endfunction | ||
38 | |||
39 | " FUNCTION: TreeFileNode.cacheParent() {{{1 | ||
40 | " initializes self.parent if it isnt already | ||
41 | function! 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 | ||
49 | endfunction | ||
50 | |||
51 | " FUNCTION: TreeFileNode.clearBookmarks() {{{1 | ||
52 | function! 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() | ||
59 | endfunction | ||
60 | |||
61 | " FUNCTION: TreeFileNode.copy(dest) {{{1 | ||
62 | function! 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 | ||
72 | endfunction | ||
73 | |||
74 | " FUNCTION: TreeFileNode.delete {{{1 | ||
75 | " Removes this node from the tree and calls the Delete method for its path obj | ||
76 | function! s:TreeFileNode.delete() | ||
77 | call self.path.delete() | ||
78 | call self.parent.removeChild(self) | ||
79 | endfunction | ||
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 | ||
88 | function! s:TreeFileNode.displayString() | ||
89 | return self.path.flagSet.renderToString() . self.path.displayString() | ||
90 | endfunction | ||
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 | ||
102 | function! s:TreeFileNode.equals(treenode) | ||
103 | return self.path.str() ==# a:treenode.path.str() | ||
104 | endfunction | ||
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 | ||
112 | function! s:TreeFileNode.findNode(path) | ||
113 | if a:path.equals(self.path) | ||
114 | return self | ||
115 | endif | ||
116 | return {} | ||
117 | endfunction | ||
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. | ||
127 | function! 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 {} | ||
154 | endfunction | ||
155 | |||
156 | " FUNCTION: TreeFileNode.getNerdtree(){{{1 | ||
157 | function! s:TreeFileNode.getNerdtree() | ||
158 | return self._nerdtree | ||
159 | endfunction | ||
160 | |||
161 | " FUNCTION: TreeFileNode.GetRootForTab(){{{1 | ||
162 | " get the root node for this tab | ||
163 | function! s:TreeFileNode.GetRootForTab() | ||
164 | if g:NERDTree.ExistsForTab() | ||
165 | return getbufvar(t:NERDTreeBufName, 'NERDTree').root | ||
166 | end | ||
167 | return {} | ||
168 | endfunction | ||
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. | ||
173 | function! 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 | ||
186 | endfunction | ||
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) | ||
191 | function! s:TreeFileNode.isVisible() | ||
192 | return !self.path.ignore(self.getNerdtree()) | ||
193 | endfunction | ||
194 | |||
195 | " FUNCTION: TreeFileNode.isRoot() {{{1 | ||
196 | function! 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) | ||
202 | endfunction | ||
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 | ||
210 | function! 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 | ||
220 | endfunction | ||
221 | |||
222 | " FUNCTION: TreeFileNode.open() {{{1 | ||
223 | function! s:TreeFileNode.open(...) | ||
224 | let opts = a:0 ? a:1 : {} | ||
225 | let opener = g:NERDTreeOpener.New(self.path, opts) | ||
226 | call opener.open(self) | ||
227 | endfunction | ||
228 | |||
229 | " FUNCTION: TreeFileNode.openSplit() {{{1 | ||
230 | " Open this node in a new window | ||
231 | function! s:TreeFileNode.openSplit() | ||
232 | call nerdtree#deprecated('TreeFileNode.openSplit', 'is deprecated, use .open() instead.') | ||
233 | call self.open({'where': 'h'}) | ||
234 | endfunction | ||
235 | |||
236 | " FUNCTION: TreeFileNode.openVSplit() {{{1 | ||
237 | " Open this node in a new vertical window | ||
238 | function! s:TreeFileNode.openVSplit() | ||
239 | call nerdtree#deprecated('TreeFileNode.openVSplit', 'is deprecated, use .open() instead.') | ||
240 | call self.open({'where': 'v'}) | ||
241 | endfunction | ||
242 | |||
243 | " FUNCTION: TreeFileNode.openInNewTab(options) {{{1 | ||
244 | function! s:TreeFileNode.openInNewTab(options) | ||
245 | call nerdtree#deprecated('TreeFileNode.openinNewTab', 'is deprecated, use .open() instead.') | ||
246 | call self.open(extend({'where': 't'}, a:options)) | ||
247 | endfunction | ||
248 | |||
249 | " FUNCTION: TreeFileNode.openExplorer() | ||
250 | function! s:TreeFileNode.openExplorer() | ||
251 | execute 'wincmd p' | ||
252 | execute 'edit '.self.path.getParent().str({'format':'Edit'}) | ||
253 | endfunction | ||
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 | ||
262 | function! 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 | ||
280 | endfunction | ||
281 | |||
282 | " FUNCTION: TreeFileNode.refresh() {{{1 | ||
283 | function! s:TreeFileNode.refresh() | ||
284 | call self.path.refresh(self.getNerdtree()) | ||
285 | endfunction | ||
286 | |||
287 | " FUNCTION: TreeFileNode.refreshFlags() {{{1 | ||
288 | function! s:TreeFileNode.refreshFlags() | ||
289 | call self.path.refreshFlags(self.getNerdtree()) | ||
290 | endfunction | ||
291 | |||
292 | " FUNCTION: TreeFileNode.rename() {{{1 | ||
293 | " Calls the rename method for this nodes path obj | ||
294 | function! 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 | ||
306 | endfunction | ||
307 | |||
308 | " FUNCTION: TreeFileNode.renderToString {{{1 | ||
309 | " returns a string representation for this tree to be rendered in the view | ||
310 | function! s:TreeFileNode.renderToString() | ||
311 | return self._renderToString(0, 0) | ||
312 | endfunction | ||
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 | ||
319 | function! 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 | ||
347 | endfunction | ||
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 | |||
6 | let s:UI = {} | ||
7 | let 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) | ||
12 | function! 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 | ||
21 | endfunction | ||
22 | |||
23 | " FUNCTION: s:UI._dumpHelp {{{1 | ||
24 | " prints out the quick help | ||
25 | function! 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 | ||
138 | endfunction | ||
139 | |||
140 | |||
141 | " FUNCTION: s:UI.new(nerdtree) {{{1 | ||
142 | function! 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 | ||
152 | endfunction | ||
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. | ||
159 | function! 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 | ||
206 | endfunction | ||
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. | ||
211 | function! 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 | ||
255 | endfunction | ||
256 | |||
257 | " FUNCTION: s:UI.getRootLineNum(){{{1 | ||
258 | " gets the line number of the root node | ||
259 | function! s:UI.getRootLineNum() | ||
260 | let rootLine = 1 | ||
261 | while rootLine <= line('$') && getline(rootLine) !~# '^\(/\|<\)' | ||
262 | let rootLine = rootLine + 1 | ||
263 | endwhile | ||
264 | return rootLine | ||
265 | endfunction | ||
266 | |||
267 | " FUNCTION: s:UI.getShowBookmarks() {{{1 | ||
268 | function! s:UI.getShowBookmarks() | ||
269 | return self._showBookmarks | ||
270 | endfunction | ||
271 | |||
272 | " FUNCTION: s:UI.getShowFiles() {{{1 | ||
273 | function! s:UI.getShowFiles() | ||
274 | return self._showFiles | ||
275 | endfunction | ||
276 | |||
277 | " FUNCTION: s:UI.getShowHelp() {{{1 | ||
278 | function! s:UI.getShowHelp() | ||
279 | return self._showHelp | ||
280 | endfunction | ||
281 | |||
282 | " FUNCTION: s:UI.getShowHidden() {{{1 | ||
283 | function! s:UI.getShowHidden() | ||
284 | return self._showHidden | ||
285 | endfunction | ||
286 | |||
287 | " FUNCTION: s:UI._indentLevelFor(line) {{{1 | ||
288 | function! 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() | ||
298 | endfunction | ||
299 | |||
300 | " FUNCTION: s:UI.IndentWid() {{{1 | ||
301 | function! s:UI.IndentWid() | ||
302 | return 2 | ||
303 | endfunction | ||
304 | |||
305 | " FUNCTION: s:UI.isIgnoreFilterEnabled() {{{1 | ||
306 | function! s:UI.isIgnoreFilterEnabled() | ||
307 | return self._ignoreEnabled ==# 1 | ||
308 | endfunction | ||
309 | |||
310 | " FUNCTION: s:UI.isMinimal() {{{1 | ||
311 | function! s:UI.isMinimal() | ||
312 | return g:NERDTreeMinimalUI | ||
313 | endfunction | ||
314 | |||
315 | " FUNCTION: s:UI.MarkupReg() {{{1 | ||
316 | function! s:UI.MarkupReg() | ||
317 | return '^ *['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']\? ' | ||
318 | endfunction | ||
319 | |||
320 | " FUNCTION: s:UI._renderBookmarks {{{1 | ||
321 | function! 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('.')) | ||
339 | endfunction | ||
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 | ||
347 | function! 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 | ||
359 | endfunction | ||
360 | |||
361 | " FUNCTION: s:UI.saveScreenState() {{{1 | ||
362 | " Saves the current cursor position in the current buffer and the window | ||
363 | " scroll position | ||
364 | function! 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 | ||
375 | endfunction | ||
376 | |||
377 | " FUNCTION: s:UI.setShowHidden(val) {{{1 | ||
378 | function! s:UI.setShowHidden(val) | ||
379 | let self._showHidden = a:val | ||
380 | endfunction | ||
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 | ||
387 | function! s:UI._stripMarkup(line) | ||
388 | let l:line = substitute(a:line, '^.\{-}' . g:NERDTreeNodeDelimiter, '', '') | ||
389 | return substitute(l:line, g:NERDTreeNodeDelimiter.'.*$', '', '') | ||
390 | endfunction | ||
391 | |||
392 | " FUNCTION: s:UI.render() {{{1 | ||
393 | function! 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 | ||
443 | endfunction | ||
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 | ||
449 | function! 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 | ||
463 | endfunction | ||
464 | |||
465 | " FUNCTION: s:UI.toggleHelp() {{{1 | ||
466 | function! s:UI.toggleHelp() | ||
467 | let self._showHelp = !self._showHelp | ||
468 | endfunction | ||
469 | |||
470 | " FUNCTION: s:UI.toggleIgnoreFilter() {{{1 | ||
471 | " toggles the use of the NERDTreeIgnore option | ||
472 | function! s:UI.toggleIgnoreFilter() | ||
473 | let self._ignoreEnabled = !self._ignoreEnabled | ||
474 | call self.renderViewSavingPosition() | ||
475 | call self.centerView() | ||
476 | endfunction | ||
477 | |||
478 | " FUNCTION: s:UI.toggleShowBookmarks() {{{1 | ||
479 | " Toggle the visibility of the Bookmark table. | ||
480 | function! 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() | ||
497 | endfunction | ||
498 | |||
499 | " FUNCTION: s:UI.toggleShowFiles() {{{1 | ||
500 | " toggles the display of hidden files | ||
501 | function! s:UI.toggleShowFiles() | ||
502 | let self._showFiles = !self._showFiles | ||
503 | call self.renderViewSavingPosition() | ||
504 | call self.centerView() | ||
505 | endfunction | ||
506 | |||
507 | " FUNCTION: s:UI.toggleShowHidden() {{{1 | ||
508 | " toggles the display of hidden files | ||
509 | function! s:UI.toggleShowHidden() | ||
510 | let self._showHidden = !self._showHidden | ||
511 | call self.renderViewSavingPosition() | ||
512 | call self.centerView() | ||
513 | endfunction | ||
514 | |||
515 | " FUNCTION: s:UI.toggleZoom() {{{1 | ||
516 | " zoom (maximize/minimize) the NERDTree window | ||
517 | function! 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 | ||
525 | endfunction | ||
526 | |||
527 | " FUNCTION: s:UI.UpDirLine() {{{1 | ||
528 | function! s:UI.UpDirLine() | ||
529 | return '.. (up a dir)' | ||
530 | endfunction | ||
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 | " ============================================================================ | ||
12 | if exists('g:loaded_nerdtree_exec_menuitem') | ||
13 | finish | ||
14 | endif | ||
15 | let g:loaded_nerdtree_exec_menuitem = 1 | ||
16 | |||
17 | call NERDTreeAddMenuItem({ | ||
18 | \ 'text': '(!)Execute file', | ||
19 | \ 'shortcut': '!', | ||
20 | \ 'callback': 'NERDTreeExecFile', | ||
21 | \ 'isActiveCallback': 'NERDTreeExecFileActive' }) | ||
22 | |||
23 | function! NERDTreeExecFileActive() | ||
24 | let node = g:NERDTreeFileNode.GetSelected() | ||
25 | return !node.path.isDirectory && node.path.isExecutable | ||
26 | endfunction | ||
27 | |||
28 | function! 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 | ||
40 | endfunction | ||
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 | " ============================================================================ | ||
12 | if exists('g:loaded_nerdtree_fs_menu') | ||
13 | finish | ||
14 | endif | ||
15 | let g:loaded_nerdtree_fs_menu = 1 | ||
16 | |||
17 | "Automatically delete the buffer after deleting or renaming a file | ||
18 | if !exists('g:NERDTreeAutoDeleteBuffer') | ||
19 | let g:NERDTreeAutoDeleteBuffer = 0 | ||
20 | endif | ||
21 | |||
22 | call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callback': 'NERDTreeAddNode'}) | ||
23 | call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'}) | ||
24 | call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'}) | ||
25 | |||
26 | if 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'}) | ||
30 | endif | ||
31 | |||
32 | if 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'}) | ||
35 | endif | ||
36 | |||
37 | if nerdtree#runningWindows() | ||
38 | call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileWindows'}) | ||
39 | endif | ||
40 | |||
41 | if g:NERDTreePath.CopyingSupported() | ||
42 | call NERDTreeAddMenuItem({'text': '(c)opy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'}) | ||
43 | endif | ||
44 | call NERDTreeAddMenuItem({'text': (has('clipboard')?'copy (p)ath to clipboard':'print (p)ath to screen'), 'shortcut': 'p', 'callback': 'NERDTreeCopyPath'}) | ||
45 | |||
46 | if has('unix') || has('osx') | ||
47 | call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNode'}) | ||
48 | else | ||
49 | call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNodeWin32'}) | ||
50 | endif | ||
51 | |||
52 | if exists('*system') | ||
53 | call NERDTreeAddMenuItem({'text': 'Run (s)ystem command in this directory', 'shortcut':'s', 'callback': 'NERDTreeSystemCommand'}) | ||
54 | endif | ||
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' | ||
61 | function! 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 | ||
95 | endfunction | ||
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 | ||
105 | function! 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 | ||
134 | endfunction | ||
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 | ||
143 | function! 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 | ||
166 | endfunction | ||
167 | |||
168 | "FUNCTION: NERDTreeAddNode(){{{1 | ||
169 | function! 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 | ||
200 | endfunction | ||
201 | |||
202 | "FUNCTION: NERDTreeMoveNode(){{{1 | ||
203 | function! 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 | ||
255 | endfunction | ||
256 | |||
257 | " FUNCTION: NERDTreeDeleteNode() {{{1 | ||
258 | function! 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 | ||
294 | endfunction | ||
295 | |||
296 | " FUNCTION: NERDTreeListNode() {{{1 | ||
297 | function! 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 | ||
316 | endfunction | ||
317 | |||
318 | " FUNCTION: NERDTreeListNodeWin32() {{{1 | ||
319 | function! 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') | ||
334 | endfunction | ||
335 | |||
336 | " FUNCTION: NERDTreeCopyNode() {{{1 | ||
337 | function! 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! | ||
374 | endfunction | ||
375 | |||
376 | " FUNCTION: NERDTreeCopyPath() {{{1 | ||
377 | function! 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 | ||
389 | endfunction | ||
390 | |||
391 | " FUNCTION: NERDTreeQuickLook() {{{1 | ||
392 | function! 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())) | ||
400 | endfunction | ||
401 | |||
402 | " FUNCTION: NERDTreeRevealInFinder() {{{1 | ||
403 | function! 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())) | ||
411 | endfunction | ||
412 | |||
413 | " FUNCTION: NERDTreeExecuteFile() {{{1 | ||
414 | function! 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())) | ||
422 | endfunction | ||
423 | |||
424 | " FUNCTION: NERDTreeRevealFileLinux() {{{1 | ||
425 | function! 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())) | ||
443 | endfunction | ||
444 | |||
445 | " FUNCTION: NERDTreeExecuteFileLinux() {{{1 | ||
446 | function! 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())) | ||
454 | endfunction | ||
455 | |||
456 | " FUNCTION: NERDTreeExecuteFileWindows() {{{1 | ||
457 | function! 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())) | ||
465 | endfunction | ||
466 | |||
467 | " FUNCTION: NERDTreeSystemCommand() {{{1 | ||
468 | function! 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 | ||
482 | endfunction | ||
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 | " ============================================================================ | ||
13 | command! -n=? -complete=dir -bar NERDTreeVCS :call <SID>CreateTabTreeVCS('<args>') | ||
14 | command! -n=? -complete=dir -bar NERDTreeToggleVCS :call <SID>ToggleTabTreeVCS('<args>') | ||
15 | |||
16 | " FUNCTION: s:CreateTabTreeVCS(a:name) {{{1 | ||
17 | function! 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()) | ||
21 | endfunction | ||
22 | |||
23 | " FUNCTION: s:ToggleTabTreeVCS(a:name) {{{1 | ||
24 | " Behaves the same as ToggleTabTree except roots directory at VCS root | ||
25 | function! 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()) | ||
29 | endfunction | ||
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. | ||
34 | function! 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 | ||
46 | endfunction | ||
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 | "============================================================ | ||
14 | scriptencoding utf-8 | ||
15 | |||
16 | if exists('loaded_nerd_tree') | ||
17 | finish | ||
18 | endif | ||
19 | if v:version < 703 | ||
20 | echoerr "NERDTree: this plugin requires vim >= 7.3. DOWNLOAD IT! You'll thank me later!" | ||
21 | finish | ||
22 | endif | ||
23 | let loaded_nerd_tree = 1 | ||
24 | |||
25 | "for line continuation - i.e dont want C in &cpoptions | ||
26 | let s:old_cpo = &cpoptions | ||
27 | set cpoptions&vim | ||
28 | |||
29 | "SECTION: Initialize variable calls and other random constants {{{2 | ||
30 | let g:NERDTreeAutoCenter = get(g:, 'NERDTreeAutoCenter', 1) | ||
31 | let g:NERDTreeAutoCenterThreshold = get(g:, 'NERDTreeAutoCenterThreshold', 3) | ||
32 | let g:NERDTreeCaseSensitiveSort = get(g:, 'NERDTreeCaseSensitiveSort', 0) | ||
33 | let g:NERDTreeNaturalSort = get(g:, 'NERDTreeNaturalSort', 0) | ||
34 | let g:NERDTreeSortHiddenFirst = get(g:, 'NERDTreeSortHiddenFirst', 1) | ||
35 | let g:NERDTreeUseTCD = get(g:, 'NERDTreeUseTCD', 0) | ||
36 | let g:NERDTreeChDirMode = get(g:, 'NERDTreeChDirMode', 0) | ||
37 | let g:NERDTreeCreatePrefix = get(g:, 'NERDTreeCreatePrefix', 'silent') | ||
38 | let g:NERDTreeMinimalUI = get(g:, 'NERDTreeMinimalUI', 0) | ||
39 | let g:NERDTreeMinimalMenu = get(g:, 'NERDTreeMinimalMenu', 0) | ||
40 | let g:NERDTreeIgnore = get(g:, 'NERDTreeIgnore', ['\~$']) | ||
41 | let g:NERDTreeBookmarksFile = get(g:, 'NERDTreeBookmarksFile', expand('$HOME') . '/.NERDTreeBookmarks') | ||
42 | let g:NERDTreeBookmarksSort = get(g:, 'NERDTreeBookmarksSort', 1) | ||
43 | let g:NERDTreeHighlightCursorline = get(g:, 'NERDTreeHighlightCursorline', 1) | ||
44 | let g:NERDTreeHijackNetrw = get(g:, 'NERDTreeHijackNetrw', 1) | ||
45 | let g:NERDTreeMarkBookmarks = get(g:, 'NERDTreeMarkBookmarks', 1) | ||
46 | let g:NERDTreeMouseMode = get(g:, 'NERDTreeMouseMode', 1) | ||
47 | let g:NERDTreeNotificationThreshold = get(g:, 'NERDTreeNotificationThreshold', 100) | ||
48 | let g:NERDTreeQuitOnOpen = get(g:, 'NERDTreeQuitOnOpen', 0) | ||
49 | let g:NERDTreeRespectWildIgnore = get(g:, 'NERDTreeRespectWildIgnore', 0) | ||
50 | let g:NERDTreeShowBookmarks = get(g:, 'NERDTreeShowBookmarks', 0) | ||
51 | let g:NERDTreeShowFiles = get(g:, 'NERDTreeShowFiles', 1) | ||
52 | let g:NERDTreeShowHidden = get(g:, 'NERDTreeShowHidden', 0) | ||
53 | let g:NERDTreeShowLineNumbers = get(g:, 'NERDTreeShowLineNumbers', 0) | ||
54 | let g:NERDTreeSortDirs = get(g:, 'NERDTreeSortDirs', 1) | ||
55 | |||
56 | if !nerdtree#runningWindows() && !nerdtree#runningCygwin() | ||
57 | let g:NERDTreeDirArrowExpandable = get(g:, 'NERDTreeDirArrowExpandable', '▸') | ||
58 | let g:NERDTreeDirArrowCollapsible = get(g:, 'NERDTreeDirArrowCollapsible', '▾') | ||
59 | else | ||
60 | let g:NERDTreeDirArrowExpandable = get(g:, 'NERDTreeDirArrowExpandable', '+') | ||
61 | let g:NERDTreeDirArrowCollapsible = get(g:, 'NERDTreeDirArrowCollapsible', '~') | ||
62 | endif | ||
63 | |||
64 | let g:NERDTreeCascadeOpenSingleChildDir = get(g:, 'NERDTreeCascadeOpenSingleChildDir', 1) | ||
65 | let g:NERDTreeCascadeSingleChildDir = get(g:, 'NERDTreeCascadeSingleChildDir', 1) | ||
66 | |||
67 | let g:NERDTreeSortOrder = get(g:, 'NERDTreeSortOrder', ['\/$', '*', '\.swp$', '\.bak$', '\~$']) | ||
68 | let g:NERDTreeOldSortOrder = [] | ||
69 | |||
70 | let g:NERDTreeGlyphReadOnly = get(g:, 'NERDTreeGlyphReadOnly', 'RO') | ||
71 | |||
72 | if has('conceal') | ||
73 | let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\x07") | ||
74 | elseif (g:NERDTreeDirArrowExpandable ==# "\u00a0" || g:NERDTreeDirArrowCollapsible ==# "\u00a0") | ||
75 | let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\u00b7") | ||
76 | else | ||
77 | let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\u00a0") | ||
78 | endif | ||
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) | ||
83 | let g:NERDTreeStatusline = get(g:, 'NERDTreeStatusline', "%{exists('b:NERDTree')?b:NERDTree.root.path.str():''}") | ||
84 | |||
85 | let g:NERDTreeWinPos = get(g:, 'NERDTreeWinPos', 'left') | ||
86 | let 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 | ||
90 | if 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 ') | ||
94 | else | ||
95 | let g:NERDTreeRemoveDirCmd = get(g:, 'NERDTreeRemoveDirCmd', 'rm -rf ') | ||
96 | let g:NERDTreeCopyCmd = get(g:, 'NERDTreeCopyCmd', 'cp -r ') | ||
97 | endif | ||
98 | |||
99 | "SECTION: Init variable calls for key mappings {{{2 | ||
100 | let g:NERDTreeMapCustomOpen = get(g:, 'NERDTreeMapCustomOpen', '<CR>') | ||
101 | let g:NERDTreeMapActivateNode = get(g:, 'NERDTreeMapActivateNode', 'o') | ||
102 | let g:NERDTreeMapChangeRoot = get(g:, 'NERDTreeMapChangeRoot', 'C') | ||
103 | let g:NERDTreeMapChdir = get(g:, 'NERDTreeMapChdir', 'cd') | ||
104 | let g:NERDTreeMapCloseChildren = get(g:, 'NERDTreeMapCloseChildren', 'X') | ||
105 | let g:NERDTreeMapCloseDir = get(g:, 'NERDTreeMapCloseDir', 'x') | ||
106 | let g:NERDTreeMapDeleteBookmark = get(g:, 'NERDTreeMapDeleteBookmark', 'D') | ||
107 | let g:NERDTreeMapMenu = get(g:, 'NERDTreeMapMenu', 'm') | ||
108 | let g:NERDTreeMapHelp = get(g:, 'NERDTreeMapHelp', '?') | ||
109 | let g:NERDTreeMapJumpFirstChild = get(g:, 'NERDTreeMapJumpFirstChild', 'K') | ||
110 | let g:NERDTreeMapJumpLastChild = get(g:, 'NERDTreeMapJumpLastChild', 'J') | ||
111 | let g:NERDTreeMapJumpNextSibling = get(g:, 'NERDTreeMapJumpNextSibling', '<C-j>') | ||
112 | let g:NERDTreeMapJumpParent = get(g:, 'NERDTreeMapJumpParent', 'p') | ||
113 | let g:NERDTreeMapJumpPrevSibling = get(g:, 'NERDTreeMapJumpPrevSibling', '<C-k>') | ||
114 | let g:NERDTreeMapJumpRoot = get(g:, 'NERDTreeMapJumpRoot', 'P') | ||
115 | let g:NERDTreeMapOpenExpl = get(g:, 'NERDTreeMapOpenExpl', 'e') | ||
116 | let g:NERDTreeMapOpenInTab = get(g:, 'NERDTreeMapOpenInTab', 't') | ||
117 | let g:NERDTreeMapOpenInTabSilent = get(g:, 'NERDTreeMapOpenInTabSilent', 'T') | ||
118 | let g:NERDTreeMapOpenRecursively = get(g:, 'NERDTreeMapOpenRecursively', 'O') | ||
119 | let g:NERDTreeMapOpenSplit = get(g:, 'NERDTreeMapOpenSplit', 'i') | ||
120 | let g:NERDTreeMapOpenVSplit = get(g:, 'NERDTreeMapOpenVSplit', 's') | ||
121 | let g:NERDTreeMapPreview = get(g:, 'NERDTreeMapPreview', 'g'.NERDTreeMapActivateNode) | ||
122 | let g:NERDTreeMapPreviewSplit = get(g:, 'NERDTreeMapPreviewSplit', 'g'.NERDTreeMapOpenSplit) | ||
123 | let g:NERDTreeMapPreviewVSplit = get(g:, 'NERDTreeMapPreviewVSplit', 'g'.NERDTreeMapOpenVSplit) | ||
124 | let g:NERDTreeMapQuit = get(g:, 'NERDTreeMapQuit', 'q') | ||
125 | let g:NERDTreeMapRefresh = get(g:, 'NERDTreeMapRefresh', 'r') | ||
126 | let g:NERDTreeMapRefreshRoot = get(g:, 'NERDTreeMapRefreshRoot', 'R') | ||
127 | let g:NERDTreeMapToggleBookmarks = get(g:, 'NERDTreeMapToggleBookmarks', 'B') | ||
128 | let g:NERDTreeMapToggleFiles = get(g:, 'NERDTreeMapToggleFiles', 'F') | ||
129 | let g:NERDTreeMapToggleFilters = get(g:, 'NERDTreeMapToggleFilters', 'f') | ||
130 | let g:NERDTreeMapToggleHidden = get(g:, 'NERDTreeMapToggleHidden', 'I') | ||
131 | let g:NERDTreeMapToggleZoom = get(g:, 'NERDTreeMapToggleZoom', 'A') | ||
132 | let g:NERDTreeMapUpdir = get(g:, 'NERDTreeMapUpdir', 'u') | ||
133 | let g:NERDTreeMapUpdirKeepOpen = get(g:, 'NERDTreeMapUpdirKeepOpen', 'U') | ||
134 | let g:NERDTreeMapCWD = get(g:, 'NERDTreeMapCWD', 'CD') | ||
135 | let g:NERDTreeMenuDown = get(g:, 'NERDTreeMenuDown', 'j') | ||
136 | let g:NERDTreeMenuUp = get(g:, 'NERDTreeMenuUp', 'k') | ||
137 | |||
138 | "SECTION: Load class files{{{2 | ||
139 | call nerdtree#loadClassFiles() | ||
140 | |||
141 | " SECTION: Commands {{{1 | ||
142 | "============================================================ | ||
143 | call nerdtree#ui_glue#setupCommands() | ||
144 | |||
145 | " SECTION: Auto commands {{{1 | ||
146 | "============================================================ | ||
147 | augroup 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' | ||
153 | augroup END | ||
154 | |||
155 | if g:NERDTreeHijackNetrw | ||
156 | augroup NERDTreeHijackNetrw | ||
157 | autocmd VimEnter * silent! autocmd! FileExplorer | ||
158 | au BufEnter,VimEnter * call nerdtree#checkForBrowse(expand('<amatch>')) | ||
159 | augroup END | ||
160 | endif | ||
161 | |||
162 | if g:NERDTreeChDirMode ==# 3 | ||
163 | augroup NERDTreeChDirOnTabSwitch | ||
164 | autocmd TabEnter * if g:NERDTree.ExistsForTab()|call g:NERDTree.ForCurrentTab().getRoot().path.changeToDir()|endif | ||
165 | augroup END | ||
166 | endif | ||
167 | |||
168 | " SECTION: Public API {{{1 | ||
169 | "============================================================ | ||
170 | function! NERDTreeAddMenuItem(options) | ||
171 | call g:NERDTreeMenuItem.Create(a:options) | ||
172 | endfunction | ||
173 | |||
174 | function! NERDTreeAddMenuSeparator(...) | ||
175 | let opts = a:0 ? a:1 : {} | ||
176 | call g:NERDTreeMenuItem.CreateSeparator(opts) | ||
177 | endfunction | ||
178 | |||
179 | function! NERDTreeAddSubmenu(options) | ||
180 | return g:NERDTreeMenuItem.Create(a:options) | ||
181 | endfunction | ||
182 | |||
183 | function! NERDTreeAddKeyMap(options) | ||
184 | call g:NERDTreeKeyMap.Create(a:options) | ||
185 | endfunction | ||
186 | |||
187 | function! NERDTreeRender() | ||
188 | call nerdtree#renderView() | ||
189 | endfunction | ||
190 | |||
191 | function! NERDTreeFocus() | ||
192 | if g:NERDTree.IsOpen() | ||
193 | call g:NERDTree.CursorToTreeWin(0) | ||
194 | else | ||
195 | call g:NERDTreeCreator.ToggleTabTree('') | ||
196 | endif | ||
197 | endfunction | ||
198 | |||
199 | function! 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! ^ | ||
222 | endfunction | ||
223 | |||
224 | function! NERDTreeAddPathFilter(callback) | ||
225 | call g:NERDTree.AddPathFilter(a:callback) | ||
226 | endfunction | ||
227 | |||
228 | " SECTION: Post Source Actions {{{1 | ||
229 | call nerdtree#postSourceActions() | ||
230 | |||
231 | "reset &cpoptions back to users setting | ||
232 | let &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 @@ | |||
1 | let s:tree_up_dir_line = '.. (up a dir)' | ||
2 | syn match NERDTreeIgnore #\~# | ||
3 | exec 'syn match NERDTreeIgnore #\['.g:NERDTreeGlyphReadOnly.'\]#' | ||
4 | |||
5 | "highlighting for the .. (up dir) line at the top of the tree | ||
6 | execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line .'#' | ||
7 | |||
8 | "quickhelp syntax elements | ||
9 | syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#ms=s+2,me=e-1 | ||
10 | syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#ms=s+2,me=e-1 | ||
11 | syn match NERDTreeHelpTitle #" .*\~$#ms=s+2,me=e-1 | ||
12 | syn match NERDTreeToggleOn #(on)#ms=s+1,he=e-1 | ||
13 | syn match NERDTreeToggleOff #(off)#ms=e-3,me=e-1 | ||
14 | syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3 | ||
15 | syn match NERDTreeHelp #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeIgnore,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand | ||
16 | |||
17 | "highlighting for sym links | ||
18 | syn match NERDTreeLinkTarget #->.*# containedin=NERDTreeDir,NERDTreeFile | ||
19 | syn match NERDTreeLinkFile #.* ->#me=e-3 containedin=NERDTreeFile | ||
20 | syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir | ||
21 | |||
22 | "highlighting to conceal the delimiter around the file/dir name | ||
23 | if has('conceal') | ||
24 | exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# conceal containedin=ALL' | ||
25 | setlocal conceallevel=2 concealcursor=nvic | ||
26 | else | ||
27 | exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# containedin=ALL' | ||
28 | hi! link NERDTreeNodeDelimiters Ignore | ||
29 | endif | ||
30 | |||
31 | "highlighing for directory nodes and file nodes | ||
32 | syn match NERDTreeDirSlash #/# containedin=NERDTreeDir | ||
33 | |||
34 | if 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' | ||
41 | else | ||
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' | ||
45 | endif | ||
46 | |||
47 | "highlighting for readonly files | ||
48 | exec 'syn match NERDTreeRO #.*'.g:NERDTreeNodeDelimiter.'\zs.*\ze'.g:NERDTreeNodeDelimiter.'.*\['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmarkName,NERDTreeFile' | ||
49 | |||
50 | exec 'syn match NERDTreeFlags #\[[^\]]*\]\ze'.g:NERDTreeNodeDelimiter.'# containedin=NERDTreeFile,NERDTreeExecFile,NERDTreeLinkFile,NERDTreeRO,NERDTreeDir' | ||
51 | |||
52 | syn match NERDTreeCWD #^[</].*$# | ||
53 | |||
54 | "highlighting for bookmarks | ||
55 | syn match NERDTreeBookmarkName # {.*}#hs=s+2,he=e-1 | ||
56 | |||
57 | "highlighting for the bookmarks table | ||
58 | syn match NERDTreeBookmarksLeader #^># | ||
59 | syn match NERDTreeBookmarksHeader #^>-\+Bookmarks-\+$# contains=NERDTreeBookmarksLeader | ||
60 | syn match NERDTreeBookmarkName #^>.\{-} #he=e-1 contains=NERDTreeBookmarksLeader | ||
61 | syn match NERDTreeBookmark #^>.*$# contains=NERDTreeBookmarksLeader,NERDTreeBookmarkName,NERDTreeBookmarksHeader | ||
62 | |||
63 | hi def link NERDTreePart Special | ||
64 | hi def link NERDTreePartFile Type | ||
65 | hi def link NERDTreeExecFile Title | ||
66 | hi def link NERDTreeDirSlash Identifier | ||
67 | |||
68 | hi def link NERDTreeBookmarksHeader statement | ||
69 | hi def link NERDTreeBookmarksLeader ignore | ||
70 | hi def link NERDTreeBookmarkName Identifier | ||
71 | hi def link NERDTreeBookmark normal | ||
72 | |||
73 | hi def link NERDTreeHelp String | ||
74 | hi def link NERDTreeHelpKey Identifier | ||
75 | hi def link NERDTreeHelpCommand Identifier | ||
76 | hi def link NERDTreeHelpTitle Macro | ||
77 | hi def link NERDTreeToggleOn Question | ||
78 | hi def link NERDTreeToggleOff WarningMsg | ||
79 | |||
80 | hi def link NERDTreeLinkTarget Type | ||
81 | hi def link NERDTreeLinkFile Macro | ||
82 | hi def link NERDTreeLinkDir Macro | ||
83 | |||
84 | hi def link NERDTreeDir Directory | ||
85 | hi def link NERDTreeUp Directory | ||
86 | hi def link NERDTreeFile Normal | ||
87 | hi def link NERDTreeCWD Statement | ||
88 | hi def link NERDTreeOpenable Directory | ||
89 | hi def link NERDTreeClosable Directory | ||
90 | hi def link NERDTreeIgnore ignore | ||
91 | hi def link NERDTreeRO WarningMsg | ||
92 | hi def link NERDTreeBookmark Statement | ||
93 | hi def link NERDTreeFlags Number | ||
94 | |||
95 | hi def link NERDTreeCurrentNode Search | ||
96 | |||
97 | hi NERDTreeFile ctermbg=NONE guibg=NONE | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/autoload/airline/extensions/tabline/formatters/webdevicons.vim b/.vim/pack/vendor/start/vim-devicons/autoload/airline/extensions/tabline/formatters/webdevicons.vim new file mode 100644 index 0000000..c298025 --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/autoload/airline/extensions/tabline/formatters/webdevicons.vim | |||
@@ -0,0 +1,14 @@ | |||
1 | " Version: 0.11.0 | ||
2 | " Webpage: https://github.com/ryanoasis/vim-devicons | ||
3 | " Maintainer: Ryan McIntyre <ryanoasis@gmail.com> | ||
4 | " License: see LICENSE | ||
5 | |||
6 | function! airline#extensions#tabline#formatters#webdevicons#format(bufnr, buffers) abort | ||
7 | " Call original formatter. | ||
8 | let originalFormatter = airline#extensions#tabline#formatters#{g:_webdevicons_airline_orig_formatter}#format(a:bufnr, a:buffers) | ||
9 | return originalFormatter . g:WebDevIconsTabAirLineBeforeGlyphPadding . | ||
10 | \ WebDevIconsGetFileTypeSymbol(bufname(a:bufnr)) . g:WebDevIconsTabAirLineAfterGlyphPadding | ||
11 | endfunction | ||
12 | |||
13 | " modeline syntax: | ||
14 | " vim: fdm=marker tabstop=2 softtabstop=2 shiftwidth=2 expandtab: | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/ctrlp.vim b/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/ctrlp.vim new file mode 100644 index 0000000..1ea4898 --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/ctrlp.vim | |||
@@ -0,0 +1,30 @@ | |||
1 | " Initialize for up to date ctrlp fork: ctrlpvim/ctrlp.vim | ||
2 | " Support for kien/ctrlp.vim deprecated since v0.7.0 | ||
3 | " @TODO implementation for CtrlP buffer and find file mode | ||
4 | |||
5 | function! devicons#plugins#ctrlp#init() abort | ||
6 | let l:ctrlp_warning_message = 'vim-devicons: https://github.com/kien/ctrlp.vim is deprecated since v0.7.0, please use https://github.com/ctrlpvim/ctrlp.vim' | ||
7 | let l:ctrlp_warned_file = webdevicons#pluginHome() . '/status_warned_ctrlp' | ||
8 | |||
9 | if exists('g:loaded_ctrlp') && g:webdevicons_enable_ctrlp | ||
10 | let l:forkedCtrlp = exists('g:ctrlp_mruf_map_string') | ||
11 | |||
12 | if l:forkedCtrlp | ||
13 | if !exists('g:ctrlp_formatline_func') | ||
14 | " logic for ctrlpvim/ctrlp.vim: | ||
15 | let g:ctrlp_formatline_func = 's:formatline(s:curtype() == "buf" ? v:val : WebDevIconsGetFileTypeSymbol(v:val) . " " . v:val) ' | ||
16 | endif | ||
17 | elseif empty(glob(l:ctrlp_warned_file)) | ||
18 | " logic for kien/ctrlp.vim: | ||
19 | echohl WarningMsg | | ||
20 | \ echomsg l:ctrlp_warning_message | ||
21 | " only warn first time, do not warn again: | ||
22 | try | ||
23 | execute writefile(['File automatically generated after warning about CtrlP once', l:ctrlp_warning_message], l:ctrlp_warned_file) | ||
24 | catch | ||
25 | endtry | ||
26 | endif | ||
27 | endif | ||
28 | endfunction | ||
29 | |||
30 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab: | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/denite.vim b/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/denite.vim new file mode 100644 index 0000000..5884644 --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/denite.vim | |||
@@ -0,0 +1,10 @@ | |||
1 | function! devicons#plugins#denite#init() abort | ||
2 | let s:denite_ver = (exists('*denite#get_status_mode') ? 2 : 3) | ||
3 | if s:denite_ver == 3 | ||
4 | call denite#custom#source('file,file/rec,file_mru,file/old,buffer,directory/rec,directory_mru', 'converters', ['devicons_denite_converter']) | ||
5 | else | ||
6 | call denite#custom#source('file,file_rec,file_mru,file_old,buffer,directory_rec,directory_mru', 'converters', ['devicons_denite_converter']) | ||
7 | endif | ||
8 | endfunction | ||
9 | |||
10 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab: | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/flagship.vim b/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/flagship.vim new file mode 100644 index 0000000..f67103c --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/flagship.vim | |||
@@ -0,0 +1,15 @@ | |||
1 | function! devicons#plugins#flagship#init() abort | ||
2 | if g:webdevicons_enable_flagship_statusline | ||
3 | augroup webdevicons_flagship_filetype | ||
4 | autocmd User Flags call Hoist('buffer', 'WebDevIconsGetFileTypeSymbol') | ||
5 | augroup END | ||
6 | endif | ||
7 | |||
8 | if g:webdevicons_enable_flagship_statusline_fileformat_symbols | ||
9 | augroup webdevicons_flagship_filesymbol | ||
10 | autocmd User Flags call Hoist('buffer', 'WebDevIconsGetFileFormatSymbol') | ||
11 | augroup END | ||
12 | endif | ||
13 | endfunction | ||
14 | |||
15 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab: | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/startify.vim b/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/startify.vim new file mode 100644 index 0000000..f3c2d12 --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/startify.vim | |||
@@ -0,0 +1,6 @@ | |||
1 | |||
2 | function! devicons#plugins#startify#init() abort | ||
3 | exec ":function! StartifyEntryFormat() abort \n return 'WebDevIconsGetFileTypeSymbol(absolute_path) .\" \". entry_path' \n endfunction" | ||
4 | endfunction | ||
5 | |||
6 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab: | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/unite.vim b/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/unite.vim new file mode 100644 index 0000000..c40924a --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/unite.vim | |||
@@ -0,0 +1,37 @@ | |||
1 | function! devicons#plugins#unite#init() abort | ||
2 | let s:filters = { | ||
3 | \ 'name': 'devicons_unite_converter' | ||
4 | \ } | ||
5 | |||
6 | function! s:filters.filter(candidates, context) abort | ||
7 | for candidate in a:candidates | ||
8 | |||
9 | if has_key(candidate, 'action__buffer_nr') | ||
10 | let bufname = bufname(candidate.action__buffer_nr) | ||
11 | let filename = fnamemodify(bufname, ':p:t') | ||
12 | let path = fnamemodify(bufname, ':p:h') | ||
13 | elseif has_key(candidate, 'word') && has_key(candidate, 'action__path') | ||
14 | let path = candidate.action__path | ||
15 | let filename = candidate.word | ||
16 | endif | ||
17 | |||
18 | let icon = WebDevIconsGetFileTypeSymbol(filename, isdirectory(filename)) | ||
19 | |||
20 | " prevent filenames of buffers getting 'lost' | ||
21 | if filename != path | ||
22 | let path = printf('%s', filename) | ||
23 | endif | ||
24 | |||
25 | " Customize output format. | ||
26 | let candidate.abbr = printf('%s %s', icon, path) | ||
27 | endfor | ||
28 | return a:candidates | ||
29 | endfunction | ||
30 | |||
31 | call unite#define_filter(s:filters) | ||
32 | unlet s:filters | ||
33 | |||
34 | call unite#custom#source('file,file_rec,buffer,file_rec/async,file_rec/neovim,file_rec/neovim2,file_rec/git', 'converters', 'devicons_unite_converter') | ||
35 | endfunction | ||
36 | |||
37 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab: | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/vimfiler.vim b/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/vimfiler.vim new file mode 100644 index 0000000..62e6c3d --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/autoload/devicons/plugins/vimfiler.vim | |||
@@ -0,0 +1,8 @@ | |||
1 | function! devicons#plugins#vimfiler#init() abort | ||
2 | call vimfiler#custom#profile('default', 'context', { | ||
3 | \ 'columns': 'devicons:size:time', | ||
4 | \ 'explorer_columns': 'devicons' | ||
5 | \ }) | ||
6 | endfunction | ||
7 | |||
8 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab: | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/autoload/vimfiler/columns/devicons.vim b/.vim/pack/vendor/start/vim-devicons/autoload/vimfiler/columns/devicons.vim new file mode 100644 index 0000000..d11ee22 --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/autoload/vimfiler/columns/devicons.vim | |||
@@ -0,0 +1,80 @@ | |||
1 | "============================================================================= | ||
2 | " FILE: devicons.vim | ||
3 | " Version: 0.11.0 | ||
4 | " Webpage: https://github.com/ryanoasis/vim-devicons | ||
5 | " Maintainer: Ryan McIntyre <ryanoasis@gmail.com> | ||
6 | " License: MIT license {{{ | ||
7 | " Permission is hereby granted, free of charge, to any person obtaining | ||
8 | " a copy of this software and associated documentation files (the | ||
9 | " "Software"), to deal in the Software without restriction, including | ||
10 | " without limitation the rights to use, copy, modify, merge, publish, | ||
11 | " distribute, sublicense, and/or sell copies of the Software, and to | ||
12 | " permit persons to whom the Software is furnished to do so, subject to | ||
13 | " the following conditions: | ||
14 | " | ||
15 | " The above copyright notice and this permission notice shall be included | ||
16 | " in all copies or substantial portions of the Software. | ||
17 | " | ||
18 | " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
19 | " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
20 | " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
21 | " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
22 | " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
23 | " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
24 | " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
25 | " }}} | ||
26 | "============================================================================= | ||
27 | |||
28 | let s:save_cpo = &cpo | ||
29 | set cpo&vim | ||
30 | |||
31 | function! vimfiler#columns#devicons#define() abort | ||
32 | return s:column | ||
33 | endfunction | ||
34 | |||
35 | let s:column = { | ||
36 | \ 'name' : 'devicons', | ||
37 | \ 'description' : 'get devicon glyph', | ||
38 | \ 'syntax' : 'vimfilerColumn__devicons', | ||
39 | \ } | ||
40 | |||
41 | function! s:column.length(files, context) abort | ||
42 | return 3 | ||
43 | endfunction | ||
44 | |||
45 | function! s:column.define_syntax(context) abort "{{{ | ||
46 | syntax match vimfilerColumn__TypeText '\[T\]' | ||
47 | \ contained containedin=vimfilerColumn__Type | ||
48 | syntax match vimfilerColumn__TypeImage '\[I\]' | ||
49 | \ contained containedin=vimfilerColumn__Type | ||
50 | syntax match vimfilerColumn__TypeArchive '\[A\]' | ||
51 | \ contained containedin=vimfilerColumn__Type | ||
52 | syntax match vimfilerColumn__TypeExecute '\[X\]' | ||
53 | \ contained containedin=vimfilerColumn__Type | ||
54 | syntax match vimfilerColumn__TypeMultimedia '\[M\]' | ||
55 | \ contained containedin=vimfilerColumn__Type | ||
56 | syntax match vimfilerColumn__TypeDirectory '\[do\]' | ||
57 | \ contained containedin=vimfilerColumn__Type | ||
58 | syntax match vimfilerColumn__TypeSystem '\[S\]' | ||
59 | \ contained containedin=vimfilerColumn__Type | ||
60 | syntax match vimfilerColumn__TypeLink '\[L\]' | ||
61 | \ contained containedin=vimfilerColumn__Type | ||
62 | |||
63 | highlight def link vimfilerColumn__TypeText Constant | ||
64 | highlight def link vimfilerColumn__TypeImage Type | ||
65 | highlight def link vimfilerColumn__TypeArchive Special | ||
66 | highlight def link vimfilerColumn__TypeExecute Statement | ||
67 | highlight def link vimfilerColumn__TypeMultimedia Identifier | ||
68 | highlight def link vimfilerColumn__TypeDirectory Preproc | ||
69 | highlight def link vimfilerColumn__TypeSystem Comment | ||
70 | highlight def link vimfilerColumn__TypeLink Comment | ||
71 | endfunction"}}} | ||
72 | |||
73 | function! s:column.get(file, context) abort | ||
74 | return WebDevIconsGetFileTypeSymbol(strpart(a:file.action__path, strridx(a:file.action__path, '/')), a:file.vimfiler__is_directory) | ||
75 | endfunction | ||
76 | |||
77 | let &cpo = s:save_cpo | ||
78 | unlet s:save_cpo | ||
79 | |||
80 | " vim: foldmethod=marker | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/doc/webdevicons.txt b/.vim/pack/vendor/start/vim-devicons/doc/webdevicons.txt new file mode 100644 index 0000000..c1f5db1 --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/doc/webdevicons.txt | |||
@@ -0,0 +1,1078 @@ | |||
1 | *devicons* | ||
2 | |||
3 | =============================================================================== | ||
4 | Contents ~ | ||
5 | |||
6 | 1. Introduction |devicons-introduction| | ||
7 | 2. Features |devicons-features| | ||
8 | 3. Installation |devicons-installation| | ||
9 | 4. Developers |devicons-developers| | ||
10 | 5. Troubleshooting |devicons-troubleshooting| | ||
11 | 6. Contributing |devicons-contributing| | ||
12 | 1. Code of Conduct [22] |devicons-code-of-conduct-22| | ||
13 | 2. Contributing Guide [23] |devicons-contributing-guide-23| | ||
14 | 3. Promotion |devicons-promotion| | ||
15 | 7. Acknowledgments |devicons-acknowledgments| | ||
16 | 8. License |devicons-license| | ||
17 | 9. Detailed Installation |devicons-detailed-installation| | ||
18 | 1. Step 1 'Nerd Font' |Nerd-Font| | ||
19 | 2. Step 2 'VimDevIcons Plugin' |VimDevIcons-Plugin| | ||
20 | 1. Pathogen [38] |devicons-pathogen-38| | ||
21 | 2. NeoBundle [39] |devicons-neobundle-39| | ||
22 | 3. Vundle [40] |devicons-vundle-40| | ||
23 | 4. Manual |devicons-manual| | ||
24 | 3. Step 3 'Configure Vim' |Configure-Vim| | ||
25 | 1. Set Encoding |devicons-set-encoding| | ||
26 | 2. Set Font |devicons-set-font| | ||
27 | 3. vim-airline |devicons-vim-airline| | ||
28 | 4. vimrc examples |devicons-vimrc-examples| | ||
29 | 4. That's it! You're done. |devicons-thats-it-youre-done.| | ||
30 | 10. Usage |devicons-usage| | ||
31 | 1. NERDTree |devicons-nerdtree| | ||
32 | 2. Unite |devicons-unite| | ||
33 | 3. Denite |devicons-denite| | ||
34 | 4. Vimfiler |devicons-vimfiler| | ||
35 | 5. CtrlP |devicons-ctrlp| | ||
36 | 6. Airline |devicons-airline| | ||
37 | 7. Startify |devicons-startify| | ||
38 | 8. Lightline Setup |devicons-lightline-setup| | ||
39 | 9. Powerline Setup |devicons-powerline-setup| | ||
40 | 10. Flagship |devicons-flagship| | ||
41 | 11. Detailed Features |devicons-detailed-features| | ||
42 | 12. Extra Configuration |devicons-extra-configuration| | ||
43 | 1. Character Mappings |devicons-character-mappings| | ||
44 | 2. API |devicons-api| | ||
45 | 1. Public Methods |devicons-public-methods| | ||
46 | 2. API Examples |devicons-api-examples| | ||
47 | 1. Status line |devicons-status-line| | ||
48 | 2. Simple function call |devicons-simple-function-call| | ||
49 | 3. Integration with other plugins |devicons-integration-with-other-plugins| | ||
50 | 1. vim-startify |devicons-vim-startify| | ||
51 | 13. FAQ |devicons-faq| | ||
52 | 1. Why isn't it working? How come I don't see any icons? |devicons-why-isnt-it-working-how-come-i-dont-see-any-icons| | ||
53 | 2. How did you get color matching based on file type in NERDtree? |devicons-how-did-you-get-color-matching-based-on-file-type-in-nerdtree| | ||
54 | 3. How did you get color matching on just the glyph/icon in NERDtree? |devicons-how-did-you-get-color-matching-on-just-glyph-icon-in-nerdtree| | ||
55 | 4. How do I solve issues after re-sourcing my |vimrc|? | ||
56 | 5. Why do I have artifacts after (or instead) of icons? |devicons-why-do-i-have-artifacts-after-of-icons| | ||
57 | 6. Square brackets around icons |devicons-square-brackets-around-icons| | ||
58 | 1. from terminal |devicons-from-terminal| | ||
59 | 7. Do I have to use a patched font such as Nerd Fonts? |devicons-do-i-have-to-use-patched-font-such-as-nerd-fonts| | ||
60 | 8. Rationale: Why does this exist? How did this start? |devicons-rationale-why-does-this-exist-how-did-this-start| | ||
61 | 14. References |devicons-references| | ||
62 | |||
63 | =============================================================================== | ||
64 | *devicons-introduction* | ||
65 | Introduction ~ | ||
66 | > | ||
67 | _ ___ ____ ____ | ||
68 | | | / (_____ ___ / __ \___ _ __/ _/________ ____ _____ | ||
69 | | | / / / __ `__ \/ / / / _ | | / // // ___/ __ \/ __ \/ ___/ | ||
70 | | |/ / / / / / / / /_/ / __| |/ _/ // /__/ /_/ / / / (__ ) | ||
71 | |___/_/_/ /_/ /_/_____/\___/|___/___/\___/\____/_/ /_/____/ | ||
72 | < | ||
73 | **VimDevIcons** | ||
74 | |||
75 | Adds Icons to Your Plugins | ||
76 | |||
77 | Supports plugins such as NERDTree [1], vim-airline [2], CtrlP [3], powerline | ||
78 | [4], denite [5], unite [6], lightline.vim [7], vim-startify [8], vimfiler [9], | ||
79 | vim-workspace [10] and flagship [11]. | ||
80 | |||
81 | See Screenshots [12] for more. | ||
82 | |||
83 | =============================================================================== | ||
84 | *devicons-features* | ||
85 | Features ~ | ||
86 | |||
87 | - Adds filetype glyphs (icons) to various vim plugins. | ||
88 | - Supports byte order marker (BOM). | ||
89 | - Customizable and extendable glyphs settings. | ||
90 | - Supports a wide range of file type extensions. | ||
91 | - Supports popular full filenames, like '.gitignore', 'node_modules', | ||
92 | '.vimrc'. | ||
93 | - Works with patched fonts, especially Nerd Fonts [13]. | ||
94 | |||
95 | See Detailed Features [14] for more. | ||
96 | |||
97 | See Configuration [15] for a list of configuration and customization options. | ||
98 | |||
99 | =============================================================================== | ||
100 | *devicons-installation* | ||
101 | Installation ~ | ||
102 | |||
103 | 1. Install a Nerd Font compatible font [16] or patch your own [17]. Then set | ||
104 | your terminal font (or 'guifont' if you are using GUI version of Vim). | ||
105 | |||
106 | 2. Install the Vim plugin with your favorite plugin manager, e.g. vim-plug | ||
107 | [18]: | ||
108 | |||
109 | "vim Plug 'ryanoasis/vim-devicons'" | ||
110 | |||
111 | Always load the vim-devicons as the very last one. | ||
112 | |||
113 | 3. Configure Vim | ||
114 | |||
115 | 'vim set encoding=UTF-8' | ||
116 | |||
117 | No need to set explicitly under Neovim: always uses UTF-8 as the default | ||
118 | encoding. | ||
119 | |||
120 | See Installation [19] for detailed setup instructions | ||
121 | |||
122 | Use ':help devicons' for further configuration. | ||
123 | |||
124 | =============================================================================== | ||
125 | *devicons-developers* | ||
126 | Developers ~ | ||
127 | |||
128 | See DEVELOPER [20] for how to use the API. | ||
129 | |||
130 | =============================================================================== | ||
131 | *devicons-troubleshooting* | ||
132 | Troubleshooting ~ | ||
133 | |||
134 | See FAQ [21]. | ||
135 | |||
136 | =============================================================================== | ||
137 | *devicons-contributing* | ||
138 | Contributing ~ | ||
139 | |||
140 | ------------------------------------------------------------------------------- | ||
141 | *devicons-code-of-conduct-22* | ||
142 | Code of Conduct [22] ~ | ||
143 | |||
144 | This project has adopted a Code of Conduct that we expect project participants | ||
145 | to adhere to. Check out code of conduct [22] for further details. | ||
146 | |||
147 | ------------------------------------------------------------------------------- | ||
148 | *devicons-contributing-guide-23* | ||
149 | Contributing Guide [23] ~ | ||
150 | |||
151 | Read our contributing [23] guide to learn about how to send pull requests, | ||
152 | creating issues properly. | ||
153 | |||
154 | ------------------------------------------------------------------------------- | ||
155 | *devicons-promotion* | ||
156 | Promotion ~ | ||
157 | |||
158 | You can help us by simply giving a star or voting on vim.org. It will ensure | ||
159 | continued development going forward. | ||
160 | |||
161 | - Star this repository on GitHub [24]. | ||
162 | - Vote for it on vim.org [25]. | ||
163 | |||
164 | =============================================================================== | ||
165 | *devicons-acknowledgments* | ||
166 | Acknowledgments ~ | ||
167 | |||
168 | Thanks goes to these people for inspiration and helping with sending PRs. | ||
169 | |||
170 | - vim-airline [2] | ||
171 | - nerdtree [1] | ||
172 | - nerdtree-git-plugin [26] by @Xuyuanp [27] | ||
173 | - seti-ui [28] by @jesseweed [29] | ||
174 | - devicons [30] by @vorillaz [31] | ||
175 | - development.svg.icons [32] by @benatespina [33] | ||
176 | - Learn Vimscript the Hard Way [34] book by Steve Losh [35] | ||
177 | - All contributors [36] | ||
178 | |||
179 | =============================================================================== | ||
180 | *devicons-license* | ||
181 | License ~ | ||
182 | |||
183 | MIT [37] | ||
184 | |||
185 | =============================================================================== | ||
186 | *devicons-detailed-installation* | ||
187 | Detailed Installation ~ | ||
188 | |||
189 | ------------------------------------------------------------------------------- | ||
190 | *Nerd-Font* | ||
191 | Step 1 'Nerd Font' ~ | ||
192 | |||
193 | Get a **Nerd Font!** [16] or patch your own. [17] Without this, things break | ||
194 | |||
195 | ------------------------------------------------------------------------------- | ||
196 | *VimDevIcons-Plugin* | ||
197 | Step 2 'VimDevIcons Plugin' ~ | ||
198 | |||
199 | **Set VimDevIcons to load _after_ these plugins!** | ||
200 | |||
201 | NERDTree [1] | vim-airline [2] | CtrlP [3] | powerline [4] | Denite [5] | unite | ||
202 | [6] | lightline.vim [7] | vim-startify [8] | vimfiler [9] | flagship [11] | ||
203 | |||
204 | Choose your favorite plugin manager | ||
205 | |||
206 | ------------------------------------------------------------------------------- | ||
207 | *devicons-pathogen-38* | ||
208 | Pathogen [38] ~ | ||
209 | |||
210 | - 'git clone https://github.com/ryanoasis/vim-devicons ~/.vim/bundle/vim- | ||
211 | devicons' | ||
212 | |||
213 | ------------------------------------------------------------------------------- | ||
214 | *devicons-neobundle-39* | ||
215 | NeoBundle [39] ~ | ||
216 | |||
217 | - Add to vimrc: | ||
218 | |||
219 | "vim NeoBundle 'ryanoasis/vim-devicons'" * And install it: | ||
220 | |||
221 | 'vim :so ~/.vimrc :NeoBundleInstall' | ||
222 | |||
223 | ------------------------------------------------------------------------------- | ||
224 | *devicons-vundle-40* | ||
225 | Vundle [40] ~ | ||
226 | |||
227 | - Add to vimrc: | ||
228 | |||
229 | "vim Plugin 'ryanoasis/vim-devicons'" * And install it: | ||
230 | |||
231 | 'vim :so ~/.vimrc :PlugInstall' | ||
232 | |||
233 | ------------------------------------------------------------------------------- | ||
234 | *devicons-manual* | ||
235 | Manual ~ | ||
236 | |||
237 | - copy all of the files into your '~/.vim' directory | ||
238 | |||
239 | ------------------------------------------------------------------------------- | ||
240 | *Configure-Vim* | ||
241 | Step 3 'Configure Vim' ~ | ||
242 | |||
243 | Add the following in your '.vimrc' or '.gvimrc': | ||
244 | |||
245 | ------------------------------------------------------------------------------- | ||
246 | *devicons-set-encoding* | ||
247 | Set Encoding ~ | ||
248 | |||
249 | **Set encoding to UTF-8 to show glyphs** | ||
250 | |||
251 | 'vim set encoding=utf8' | ||
252 | |||
253 | ------------------------------------------------------------------------------- | ||
254 | *devicons-set-font* | ||
255 | Set Font ~ | ||
256 | |||
257 | **Set Vim font to a Nerd Font** | ||
258 | |||
259 | Linux 'vim set guifont=' | ||
260 | > | ||
261 | set guifont=DroidSansMono\ Nerd\ Font\ 11 | ||
262 | < | ||
263 | macOS (OS X) and Windows | ||
264 | > | ||
265 | set guifont=:h | ||
266 | < | ||
267 | |||
268 | > | ||
269 | set guifont=DroidSansMono\ Nerd\ Font:h11 | ||
270 | " or: | ||
271 | set guifont=DroidSansMono_Nerd_Font:h11 | ||
272 | < | ||
273 | **Note:** if you don't set 'guifont' then you'll have to set your terminal's | ||
274 | font, else things break! | ||
275 | |||
276 | ------------------------------------------------------------------------------- | ||
277 | *devicons-vim-airline* | ||
278 | vim-airline ~ | ||
279 | |||
280 | **If you use vim-airline you need this:** | ||
281 | |||
282 | 'vim let g:airline_powerline_fonts = 1' | ||
283 | |||
284 | ------------------------------------------------------------------------------- | ||
285 | *devicons-vimrc-examples* | ||
286 | vimrc examples ~ | ||
287 | |||
288 | - Sample Windows vimrc configuration 1 [41] | ||
289 | - Sample Linux vimrc configuration 1 [42] | ||
290 | |||
291 | ------------------------------------------------------------------------------- | ||
292 | *devicons-thats-it-youre-done.* | ||
293 | That's it! You're done. ~ | ||
294 | |||
295 | =============================================================================== | ||
296 | *devicons-usage* | ||
297 | Usage ~ | ||
298 | |||
299 | If you installed and setup things correctly you should now see icons in the | ||
300 | supported plugins! | ||
301 | |||
302 | **Notes on include order:** _for support of these plugins: NERDTree [1], vim- | ||
303 | airline [2], CtrlP [3], powerline [4], Denite [5], unite [6], vimfiler [9], | ||
304 | flagship [11] you **must** configure vim to load those plugins__before_ vim- | ||
305 | devicons loads. for better nerdtree-git-plugin [26] support, you _should_ | ||
306 | configure vim to load nerdtree-git-plugin **_before_** VimDevIcons loads. * if | ||
307 | you are lazy loading Denite [5] using the Dein plugin manager, you will need to | ||
308 | source VimDevIcons before Denite loads. | ||
309 | |||
310 | Lightline Setup and Powerline Setup require some extra setup as shown below: | ||
311 | |||
312 | ------------------------------------------------------------------------------- | ||
313 | *devicons-nerdtree* | ||
314 | NERDTree ~ | ||
315 | |||
316 | Should work "out of the box", no particular configuration should be needed. | ||
317 | > | ||
318 | " Can be enabled or disabled | ||
319 | let g:webdevicons_enable_nerdtree = 1 | ||
320 | < | ||
321 | |||
322 | > | ||
323 | " whether or not to show the nerdtree brackets around flags | ||
324 | let g:webdevicons_conceal_nerdtree_brackets = 1 | ||
325 | < | ||
326 | ------------------------------------------------------------------------------- | ||
327 | *devicons-unite* | ||
328 | Unite ~ | ||
329 | |||
330 | Should work "out of the box", no particular configuration should be needed. | ||
331 | > | ||
332 | " Can be enabled or disabled | ||
333 | " adding the custom source to unite | ||
334 | let g:webdevicons_enable_unite = 1 | ||
335 | < | ||
336 | ------------------------------------------------------------------------------- | ||
337 | *devicons-denite* | ||
338 | Denite ~ | ||
339 | |||
340 | Should work "out of the box", no particular configuration should be needed. | ||
341 | > | ||
342 | " Can be enabled or disabled | ||
343 | " Adding the custom source to denite | ||
344 | let g:webdevicons_enable_denite = 1 | ||
345 | < | ||
346 | ------------------------------------------------------------------------------- | ||
347 | *devicons-vimfiler* | ||
348 | Vimfiler ~ | ||
349 | |||
350 | Should work "out of the box", no particular configuration should be needed. | ||
351 | > | ||
352 | " Can be enabled or disabled | ||
353 | " adding the column to vimfiler | ||
354 | let g:webdevicons_enable_vimfiler = 1 | ||
355 | < | ||
356 | ------------------------------------------------------------------------------- | ||
357 | *devicons-ctrlp* | ||
358 | CtrlP ~ | ||
359 | |||
360 | Should work "out of the box", no particular configuration should be needed. | ||
361 | > | ||
362 | " Can be enabled or disabled | ||
363 | " add glyphs to all modes | ||
364 | let g:webdevicons_enable_ctrlp = 1 | ||
365 | < | ||
366 | ------------------------------------------------------------------------------- | ||
367 | *devicons-airline* | ||
368 | Airline ~ | ||
369 | |||
370 | Should work "out of the box", no particular configuration should be needed. | ||
371 | > | ||
372 | " adding to vim-airline's tabline | ||
373 | let g:webdevicons_enable_airline_tabline = 1 | ||
374 | < | ||
375 | |||
376 | > | ||
377 | " adding to vim-airline's statusline | ||
378 | let g:webdevicons_enable_airline_statusline = 1 | ||
379 | < | ||
380 | ------------------------------------------------------------------------------- | ||
381 | *devicons-startify* | ||
382 | Startify ~ | ||
383 | |||
384 | Should work "out of the box", no particular configuration should be needed. | ||
385 | > | ||
386 | " Can be enabled or disabled | ||
387 | " adding to vim-startify screen | ||
388 | let g:webdevicons_enable_startify = 1 | ||
389 | < | ||
390 | ------------------------------------------------------------------------------- | ||
391 | *devicons-lightline-setup* | ||
392 | Lightline Setup ~ | ||
393 | |||
394 | To add the appropriate icon to lightline [7], call the function | ||
395 | 'WebDevIconsGetFileTypeSymbol()' and/or 'WebDevIconsGetFileFormatSymbol()' in | ||
396 | your '.vimrc'. For example, you could set your sections to: | ||
397 | > | ||
398 | let g:lightline = { | ||
399 | \ 'component_function': { | ||
400 | \ 'filetype': 'MyFiletype', | ||
401 | \ 'fileformat': 'MyFileformat', | ||
402 | \ } | ||
403 | \ } | ||
404 | |||
405 | function! MyFiletype() | ||
406 | return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : '' | ||
407 | endfunction | ||
408 | |||
409 | function! MyFileformat() | ||
410 | return winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : '' | ||
411 | endfunction | ||
412 | < | ||
413 | ------------------------------------------------------------------------------- | ||
414 | *devicons-powerline-setup* | ||
415 | Powerline Setup ~ | ||
416 | |||
417 | - _Note this is for the current Powerline [4] not the deprecated vim- | ||
418 | powerline [43]_ | ||
419 | |||
420 | To enable for Powerline [4] some |vimrc| and powerline configuration changes | ||
421 | are needed: | ||
422 | |||
423 | |vimrc| changes (only required if you don't already have powerline setup for | ||
424 | vim): | ||
425 | > | ||
426 | set rtp+=$HOME/.local/lib/python2.7/site-packages/powerline/bindings/vim/ | ||
427 | |||
428 | " Always show statusline | ||
429 | set laststatus=2 | ||
430 | |||
431 | " Use 256 colours (Use this setting only if your terminal supports 256 colours) | ||
432 | set t_Co=256 | ||
433 | < | ||
434 | powerline configuration changes: | ||
435 | |||
436 | file type segment | ||
437 | > | ||
438 | { | ||
439 | "function": "vim_devicons.powerline.segments.webdevicons", | ||
440 | "priority": 10, | ||
441 | "draw_soft_divider": false, | ||
442 | "after": " " | ||
443 | } | ||
444 | < | ||
445 | file format segment | ||
446 | > | ||
447 | { | ||
448 | "function": "vim_devicons.powerline.segments.webdevicons_file_format", | ||
449 | "draw_soft_divider": false, | ||
450 | "exclude_modes": ["nc"], | ||
451 | "priority": 90 | ||
452 | } | ||
453 | < | ||
454 | for full example see sample file [44] | ||
455 | |||
456 | ------------------------------------------------------------------------------- | ||
457 | *devicons-flagship* | ||
458 | Flagship ~ | ||
459 | |||
460 | Should work "out of the box", no particular configuration should be needed. | ||
461 | > | ||
462 | " Can be enabled or disabled | ||
463 | " adding to flagship's statusline | ||
464 | let g:webdevicons_enable_flagship_statusline = 1 | ||
465 | < | ||
466 | =============================================================================== | ||
467 | *devicons-detailed-features* | ||
468 | Detailed Features ~ | ||
469 | |||
470 | - Adds filetype glyphs (icons) to various vim plugins, currently supports: | ||
471 | |||
472 | - NERDTree [1] | ||
473 | |||
474 | - Using the version hosted on vimscripts [45] in favor of GitHub will | ||
475 | lead to a outdated message, and icons will fail to show. | ||
476 | |||
477 | - vim-airline [2] (statusline and tabline) | ||
478 | |||
479 | - CtrlP [3] (All modes now supported) | ||
480 | |||
481 | - Using the version hosted on vimscripts [46] in favor of GitHub will | ||
482 | lead to a outdated message, and icons will fail to show. | ||
483 | |||
484 | - powerline [4] (statusline) | ||
485 | |||
486 | - see: powerline setup | ||
487 | |||
488 | - Denite [5] | ||
489 | |||
490 | - Currently supports 'file_rec', 'file_old', 'buffer', and | ||
491 | 'directory_rec' | ||
492 | |||
493 | - unite [6] | ||
494 | |||
495 | - Currently supports 'file', 'file_rec', 'buffer', 'file_rec/async', and | ||
496 | 'file_rec/neovim' | ||
497 | |||
498 | - lightline.vim [7] (statusline) | ||
499 | |||
500 | - see: lightline setup | ||
501 | |||
502 | - vim-startify [8] | ||
503 | |||
504 | - vimfiler [9] | ||
505 | |||
506 | - flagship [11] | ||
507 | |||
508 | - Support is **experimental** because the API may be changing [47] | ||
509 | |||
510 | - vim-workspace [10] | ||
511 | |||
512 | - Supports byte order marker (BOM) | ||
513 | |||
514 | - Customizable and extendable glyphs (icons) settings | ||
515 | |||
516 | - ability to override defaults and use your own characters or glyphs | ||
517 | |||
518 | - Supports a wide range of file type extensions by default: | ||
519 | |||
520 | - 'styl, sass, scss, htm, html, slim, ejs, css, less, md, rmd, json, js, jsx, | ||
521 | rb, php, py, pyc, pyd, pyo, coffee, mustache, hbs, conf, ini, yml, yaml, | ||
522 | bat, jpg, jpeg, bmp, png, gif, twig, cpp, c++, cxx, cc, cp, c, h, hpp, hxx, | ||
523 | hs, lhs, lua, java, sh, bash, zsh, ksh, csh, awk, ps1, fish, diff, db, clj, | ||
524 | cljs, edn, scala, go, dart, xul, sln, suo, pl, pm, t, rss, f#, fsscript, | ||
525 | fsx, fs, fsi, rs, rlib, d, erl, hrl, vim, ai, psd, psb, ts, jl, pp, vue, | ||
526 | swift, eex, ex, exs' | ||
527 | |||
528 | - Supports a few full filename matches, by default: | ||
529 | |||
530 | - 'gruntfile.coffee, gruntfile.js, gruntfile.ls, gulpfile.coffee, | ||
531 | gulpfile.js, gulpfile.ls, dropbox, .ds_store, .gitconfig, .gitignore, | ||
532 | .bashrc, .zshrc, .vimrc, .bashprofile, favicon.ico, license, node_modules, | ||
533 | react.jsx, procfile' | ||
534 | |||
535 | - Supports a few library pattern matches, by default: | ||
536 | |||
537 | - 'jquery, angular, backbone, requirejs, materialize, mootools, Vagrantfile' | ||
538 | |||
539 | - Works with patched fonts, especially Nerd Fonts [13] | ||
540 | |||
541 | =============================================================================== | ||
542 | *devicons-extra-configuration* | ||
543 | Extra Configuration ~ | ||
544 | |||
545 | - These options can be defined in your |vimrc| or 'gvimrc' | ||
546 | |||
547 | - Most options are enabled **'1'** by default but can be disabled with | ||
548 | **'0'** | ||
549 | |||
550 | - You _should_**not** need to configure anything, however, the following | ||
551 | options are provided for customizing or changing the defaults: | ||
552 | > | ||
553 | " loading the plugin | ||
554 | let g:webdevicons_enable = 1 | ||
555 | < | ||
556 | |||
557 | > | ||
558 | " adding the flags to NERDTree | ||
559 | let g:webdevicons_enable_nerdtree = 1 | ||
560 | < | ||
561 | |||
562 | > | ||
563 | " adding the custom source to unite | ||
564 | let g:webdevicons_enable_unite = 1 | ||
565 | < | ||
566 | |||
567 | > | ||
568 | " adding the column to vimfiler | ||
569 | let g:webdevicons_enable_vimfiler = 1 | ||
570 | < | ||
571 | |||
572 | > | ||
573 | " adding to vim-airline's tabline | ||
574 | let g:webdevicons_enable_airline_tabline = 1 | ||
575 | < | ||
576 | |||
577 | > | ||
578 | " adding to vim-airline's statusline | ||
579 | let g:webdevicons_enable_airline_statusline = 1 | ||
580 | < | ||
581 | |||
582 | > | ||
583 | " ctrlp glyphs | ||
584 | let g:webdevicons_enable_ctrlp = 1 | ||
585 | < | ||
586 | |||
587 | > | ||
588 | " adding to vim-startify screen | ||
589 | let g:webdevicons_enable_startify = 1 | ||
590 | < | ||
591 | |||
592 | > | ||
593 | " adding to flagship's statusline | ||
594 | let g:webdevicons_enable_flagship_statusline = 1 | ||
595 | < | ||
596 | |||
597 | > | ||
598 | " turn on/off file node glyph decorations (not particularly useful) | ||
599 | let g:WebDevIconsUnicodeDecorateFileNodes = 1 | ||
600 | < | ||
601 | |||
602 | > | ||
603 | " use double-width(1) or single-width(0) glyphs | ||
604 | " only manipulates padding, has no effect on terminal or set(guifont) font | ||
605 | let g:WebDevIconsUnicodeGlyphDoubleWidth = 1 | ||
606 | < | ||
607 | |||
608 | > | ||
609 | " whether or not to show the nerdtree brackets around flags | ||
610 | let g:webdevicons_conceal_nerdtree_brackets = 1 | ||
611 | < | ||
612 | |||
613 | > | ||
614 | " the amount of space to use after the glyph character (default ' ') | ||
615 | let g:WebDevIconsNerdTreeAfterGlyphPadding = ' ' | ||
616 | < | ||
617 | |||
618 | > | ||
619 | " Force extra padding in NERDTree so that the filetype icons line up vertically | ||
620 | let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1 | ||
621 | < | ||
622 | |||
623 | > | ||
624 | " Adding the custom source to denite | ||
625 | let g:webdevicons_enable_denite = 1 | ||
626 | |||
627 | |||
628 | |||
629 | " the amount of space to use after the glyph character in vim-airline | ||
630 | tabline(default '') | ||
631 | let g:WebDevIconsTabAirLineAfterGlyphPadding = ' ' | ||
632 | |||
633 | |||
634 | |||
635 | " the amount of space to use before the glyph character in vim-airline | ||
636 | tabline(default ' ') | ||
637 | let g:WebDevIconsTabAirLineBeforeGlyphPadding = ' ' | ||
638 | < | ||
639 | ------------------------------------------------------------------------------- | ||
640 | *devicons-character-mappings* | ||
641 | Character Mappings ~ | ||
642 | |||
643 | - 'ƛ' is used as an example below, substitute for the glyph you **actually** | ||
644 | want to use | ||
645 | > | ||
646 | " change the default character when no match found | ||
647 | let g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol = 'ƛ' | ||
648 | < | ||
649 | |||
650 | > | ||
651 | " set a byte character marker (BOM) utf-8 symbol when retrieving file encoding | ||
652 | " disabled by default with no value | ||
653 | let g:WebDevIconsUnicodeByteOrderMarkerDefaultSymbol = '' | ||
654 | < | ||
655 | |||
656 | > | ||
657 | " enable folder/directory glyph flag (disabled by default with 0) | ||
658 | let g:WebDevIconsUnicodeDecorateFolderNodes = 1 | ||
659 | < | ||
660 | |||
661 | > | ||
662 | " enable open and close folder/directory glyph flags (disabled by default with 0) | ||
663 | let g:DevIconsEnableFoldersOpenClose = 1 | ||
664 | < | ||
665 | |||
666 | > | ||
667 | " enable pattern matching glyphs on folder/directory (enabled by default with 1) | ||
668 | let g:DevIconsEnableFolderPatternMatching = 1 | ||
669 | < | ||
670 | |||
671 | > | ||
672 | " enable file extension pattern matching glyphs on folder/directory (disabled by default with 0) | ||
673 | let g:DevIconsEnableFolderExtensionPatternMatching = 0 | ||
674 | < | ||
675 | |||
676 | > | ||
677 | " disable showing the distribution for unix file encoding (enabled by default with 1) | ||
678 | let g:DevIconsEnableDistro = 0 | ||
679 | < | ||
680 | |||
681 | > | ||
682 | " enable custom folder/directory glyph exact matching | ||
683 | " (enabled by default when g:WebDevIconsUnicodeDecorateFolderNodes is set to 1) | ||
684 | let WebDevIconsUnicodeDecorateFolderNodesExactMatches = 1 | ||
685 | < | ||
686 | |||
687 | > | ||
688 | " change the default folder/directory glyph/icon | ||
689 | let g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol = 'ƛ' | ||
690 | < | ||
691 | |||
692 | > | ||
693 | " change the default open folder/directory glyph/icon (default is '') | ||
694 | let g:DevIconsDefaultFolderOpenSymbol = 'ƛ' | ||
695 | < | ||
696 | |||
697 | > | ||
698 | " change the default dictionary mappings for file extension matches | ||
699 | |||
700 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} " needed | ||
701 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['js'] = 'ƛ' | ||
702 | < | ||
703 | |||
704 | > | ||
705 | " change the default dictionary mappings for exact file node matches | ||
706 | |||
707 | let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols = {} " needed | ||
708 | let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols['MyReallyCoolFile.okay'] = 'ƛ' | ||
709 | < | ||
710 | |||
711 | > | ||
712 | " add or override individual additional filetypes | ||
713 | |||
714 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} " needed | ||
715 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['myext'] = 'ƛ' | ||
716 | < | ||
717 | |||
718 | > | ||
719 | " add or override pattern matches for filetypes | ||
720 | " these take precedence over the file extensions | ||
721 | |||
722 | let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols = {} " needed | ||
723 | let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols['.*jquery.*\.js$'] = 'ƛ' | ||
724 | < | ||
725 | specify OS to decide an icon for unix fileformat (_not_ defined by default) - | ||
726 | this is useful for avoiding unnecessary 'system()' call. see #135 [48] for | ||
727 | further details. | ||
728 | > | ||
729 | let g:WebDevIconsOS = 'Darwin' | ||
730 | < | ||
731 | ------------------------------------------------------------------------------- | ||
732 | *devicons-api* | ||
733 | API ~ | ||
734 | > | ||
735 | " returns the font character that represents the icon | ||
736 | " parameters: a:1 (filename), a:2 (isDirectory) | ||
737 | " both parameters optional | ||
738 | " by default without parameters uses buffer name | ||
739 | WebDevIconsGetFileTypeSymbol(...) | ||
740 | |||
741 | " returns the font character that represents | ||
742 | " the file format as an icon (windows, linux, mac) | ||
743 | WebDevIconsGetFileFormatSymbol() | ||
744 | < | ||
745 | ------------------------------------------------------------------------------- | ||
746 | *devicons-public-methods* | ||
747 | Public Methods ~ | ||
748 | > | ||
749 | " Returns the current version of the plugin | ||
750 | webdevicons#version() | ||
751 | < | ||
752 | |||
753 | > | ||
754 | " Calls webdevicons#softRefresh() | ||
755 | " basically a backwards compatibility convenience | ||
756 | webdevicons#refresh() | ||
757 | < | ||
758 | |||
759 | > | ||
760 | " Does a 'hard' refresh of NERDTree | ||
761 | " resets vim-devicons syntax and closes and reopens NERDTree | ||
762 | webdevicons#hardRefresh() | ||
763 | < | ||
764 | |||
765 | > | ||
766 | " Does a 'soft' refresh of NERDTree | ||
767 | " resets vim-devicons syntax and toggles NERDTree to the same state | ||
768 | webdevicons#softRefresh() | ||
769 | < | ||
770 | ------------------------------------------------------------------------------- | ||
771 | *devicons-api-examples* | ||
772 | API Examples ~ | ||
773 | |||
774 | ------------------------------------------------------------------------------- | ||
775 | *devicons-status-line* | ||
776 | Status line ~ | ||
777 | |||
778 | Custom vim status line (not relying on vim-airline or lightline): | ||
779 | > | ||
780 | set statusline=%f\ %{WebDevIconsGetFileTypeSymbol()}\ %h%w%m%r\ %=%(%l,%c%V\ %Y\ %=\ %P%) | ||
781 | < | ||
782 | ------------------------------------------------------------------------------- | ||
783 | *devicons-simple-function-call* | ||
784 | Simple function call ~ | ||
785 | > | ||
786 | echo WebDevIconsGetFileFormatSymbol() | ||
787 | < | ||
788 | ------------------------------------------------------------------------------- | ||
789 | *devicons-integration-with-other-plugins* | ||
790 | Integration with other plugins ~ | ||
791 | |||
792 | ------------------------------------------------------------------------------- | ||
793 | *devicons-vim-startify* | ||
794 | vim-startify ~ | ||
795 | > | ||
796 | let entry_format = "' ['. index .']'. repeat(' ', (3 - strlen(index)))" | ||
797 | |||
798 | if exists('*WebDevIconsGetFileTypeSymbol') " support for vim-devicons | ||
799 | let entry_format .= ". WebDevIconsGetFileTypeSymbol(entry_path) .' '. entry_path" | ||
800 | else | ||
801 | let entry_format .= '. entry_path' | ||
802 | endif | ||
803 | < | ||
804 | =============================================================================== | ||
805 | *devicons-faq* | ||
806 | FAQ ~ | ||
807 | |||
808 | **Table of Contents:** | ||
809 | |||
810 | **It's not working at all:** | ||
811 | |||
812 | - **Why isn't it working? How come I don't see any icons?** | ||
813 | |||
814 | **Syntax or color highlighting:** | ||
815 | |||
816 | - **How did you get color matching based on file type in NERDtree?** | ||
817 | - **How did you get color matching on just the glyph/icon in NERDtree?** | ||
818 | |||
819 | **Re-sourcing |vimrc|:** | ||
820 | |||
821 | - **How do I solve issues after re-sourcing my |vimrc|?** | ||
822 | |||
823 | **Weird artifacts after/on the glyphs:** | ||
824 | |||
825 | - **Why do I have artifacts after (or instead) of icons?** | ||
826 | - **Square brackets around icons?** | ||
827 | |||
828 | **Fonts:** | ||
829 | |||
830 | - **Do I have to use a patched font such as Nerd Fonts?** | ||
831 | |||
832 | **Why does this exist? How did this start?** | ||
833 | |||
834 | ------------------------------------------------------------------------------- | ||
835 | *devicons-why-isnt-it-working-how-come-i-dont-see-any-icons* | ||
836 | Why isn't it working? How come I don't see any icons? ~ | ||
837 | |||
838 | - Are you using the patched font provided in the separate repo (Nerd Fonts | ||
839 | [13]) or are you patching your own? | ||
840 | |||
841 | - _NOTE:_ if running vim and no font set it will default to the terminal font | ||
842 | that is set | ||
843 | |||
844 | - check what the vim/gvim font is set to, from ex mode: | ||
845 | |||
846 | 'vim :set guifont?' | ||
847 | |||
848 | - check if the plugin is loaded (should give '1'), from ex mode: | ||
849 | |||
850 | 'vim :echo loaded_webdevicons' | ||
851 | |||
852 | - check if the plugin is enabled (should give '1'), from ex mode: | ||
853 | |||
854 | 'vim :echo g:webdevicons_enable' | ||
855 | |||
856 | - check if the plugin is enabled for NERDTree (should give '1'), from ex | ||
857 | mode: | ||
858 | |||
859 | - this should _NOT_ need to be set under normal circumstances | ||
860 | |||
861 | 'vim :echo g:webdevicons_enable_nerdtree' | ||
862 | |||
863 | - check if you are able to see the characters, from ex mode: | ||
864 | |||
865 | 'vim :echo g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol' | ||
866 | |||
867 | - if all this looks correct you may try this to see if any files show flags | ||
868 | |||
869 | - last resort, see if you can even set the default symbol and have it | ||
870 | display anywhere (NERDTree, vim-airline's statusline, vim-airlines's | ||
871 | tabline), from ex mode: | ||
872 | |||
873 | "vim :let g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol='x'" | ||
874 | |||
875 | ------------------------------------------------------------------------------- | ||
876 | *devicons-how-did-you-get-color-matching-based-on-file-type-in-nerdtree* | ||
877 | How did you get color matching based on file type in NERDtree? ~ | ||
878 | |||
879 | - You can either use this additional plugin: vim-nerdtree-syntax-highlight | ||
880 | [49] created by @tiagofumo [50] | ||
881 | |||
882 | - Or you can use my current settings from: | ||
883 | https://github.com/scrooloose/nerdtree/issues/201#issuecomment-9954740 | ||
884 | |||
885 | ```vim " NERDTress File highlighting function! | ||
886 | NERDTreeHighlightFile(extension, fg, bg, guifg, guibg) exec 'autocmd | ||
887 | FileType nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' | ||
888 | ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg exec 'autocmd | ||
889 | FileType nerdtree syn match ' . a:extension .' #^\s+.*'. a:extension .'$#' | ||
890 | endfunction | ||
891 | |||
892 | call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515') | ||
893 | call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515') | ||
894 | call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515') call | ||
895 | NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515') call | ||
896 | NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515') call | ||
897 | NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515') call | ||
898 | NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515') call | ||
899 | NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515') call | ||
900 | NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515') call | ||
901 | NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515') call | ||
902 | NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515') call | ||
903 | NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515') call | ||
904 | NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515') call | ||
905 | NERDTreeHighlightFile('ds_store', 'Gray', 'none', '#686868', '#151515') | ||
906 | call NERDTreeHighlightFile('gitconfig', 'Gray', 'none', '#686868', | ||
907 | '#151515') call NERDTreeHighlightFile('gitignore', 'Gray', 'none', | ||
908 | '#686868', '#151515') call NERDTreeHighlightFile('bashrc', 'Gray', 'none', | ||
909 | '#686868', '#151515') call NERDTreeHighlightFile('bashprofile', 'Gray', | ||
910 | 'none', '#686868', '#151515') 'Note: If the colors still are not | ||
911 | highlighting, try invoking such as:' autocmd VimEnter * call | ||
912 | NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515') ``` per: | ||
913 | https://github.com/ryanoasis/vim-devicons/issues/49#issuecomment-101753558 | ||
914 | |||
915 | ------------------------------------------------------------------------------- | ||
916 | *devicons-how-did-you-get-color-matching-on-just-glyph-icon-in-nerdtree* | ||
917 | How did you get color matching on just the glyph/icon in NERDtree? ~ | ||
918 | |||
919 | - You can add something like this to your |vimrc| | ||
920 | |||
921 | ```vim " NERDTress File highlighting only the glyph/icon " test highlight | ||
922 | just the glyph (icons) in nerdtree: autocmd filetype nerdtree highlight | ||
923 | haskell_icon ctermbg=none ctermfg=Red guifg=#ffa500 autocmd filetype | ||
924 | nerdtree highlight html_icon ctermbg=none ctermfg=Red guifg=#ffa500 autocmd | ||
925 | filetype nerdtree highlight go_icon ctermbg=none ctermfg=Red guifg=#ffa500 | ||
926 | |||
927 | autocmd filetype nerdtree syn match haskell_icon ## | ||
928 | containedin=NERDTreeFile " if you are using another syn highlight for a | ||
929 | given line (e.g. " NERDTreeHighlightFile) need to give that name in the | ||
930 | 'containedin' for this " other highlight to work with it autocmd filetype | ||
931 | nerdtree syn match html_icon ## containedin=NERDTreeFile,html autocmd | ||
932 | filetype nerdtree syn match go_icon ## containedin=NERDTreeFile ``` | ||
933 | |||
934 | ------------------------------------------------------------------------------- | ||
935 | How do I solve issues after re-sourcing my *vimrc*? | ||
936 | |||
937 | - Try adding this to the bottom of your |vimrc| | ||
938 | |||
939 | 'vim if exists("g:loaded_webdevicons") call webdevicons#refresh() endif' | ||
940 | |||
941 | ------------------------------------------------------------------------------- | ||
942 | *devicons-why-do-i-have-artifacts-after-of-icons* | ||
943 | Why do I have artifacts after (or instead) of icons? ~ | ||
944 | |||
945 | - Dots after icons in NERDTree (on GVim), try: | ||
946 | |||
947 | 'vim autocmd FileType nerdtree setlocal nolist' | ||
948 | |||
949 | source: Issue #110 [51] | ||
950 | |||
951 | - Newly created files in NERDTree are slow to show the glyph (icon) | ||
952 | - check your current setting of ':updatetime?' | ||
953 | - try setting 'updatetime' in your |vimrc| to a lower value like '250', for | ||
954 | more info see: Issue #153 [52] | ||
955 | |||
956 | ------------------------------------------------------------------------------- | ||
957 | *devicons-square-brackets-around-icons* | ||
958 | Square brackets around icons ~ | ||
959 | |||
960 | - By default if your Vim supports conceal you should not see these, debug | ||
961 | steps: | ||
962 | |||
963 | - Check if the plugin feature is set (should be '1'): | ||
964 | |||
965 | 'vim echo g:webdevicons_conceal_nerdtree_brackets' | ||
966 | |||
967 | - Check that your vim was compiled with the 'conceal' feature (should be | ||
968 | '+conceal'): | ||
969 | |||
970 | ```shell | ||
971 | |||
972 | ------------------------------------------------------------------------------- | ||
973 | *devicons-from-terminal* | ||
974 | from terminal ~ | ||
975 | |||
976 | vim --version | grep conceal ``` | ||
977 | |||
978 | - Check the 'conceallevel' (should be '3'): | ||
979 | |||
980 | 'vim set conceallevel?' | ||
981 | |||
982 | ------------------------------------------------------------------------------- | ||
983 | *devicons-do-i-have-to-use-patched-font-such-as-nerd-fonts* | ||
984 | Do I have to use a patched font such as Nerd Fonts? ~ | ||
985 | |||
986 | VimDevIcons was desired to work with Nerd Fonts [13], however you do _not_ have | ||
987 | to use a patched font or even Nerd Fonts specified glyphs. You have 2 main | ||
988 | options: | ||
989 | |||
990 | fontconfig fallback | ||
991 | |||
992 | 1. Install the NERD Font symbol fonts: | ||
993 | |||
994 | 2. Symbols Nerd Font:style=1000-em [53] | ||
995 | |||
996 | 3. Symbols Nerd Font:style=2048-em [54] | ||
997 | |||
998 | 4. Install 10-nerd-font-symbols.conf [55] for Fontconfig | ||
999 | |||
1000 | 5. for additional information see: Issue #124 [56] and [Nerd Fonts | ||
1001 | 'fontconfig'] | ||
1002 | |||
1003 | Use your own glyph codepoints | ||
1004 | |||
1005 | - specify your own glyphs and/or use your own font (see: Character Mappings | ||
1006 | [57]) | ||
1007 | |||
1008 | ------------------------------------------------------------------------------- | ||
1009 | *devicons-rationale-why-does-this-exist-how-did-this-start* | ||
1010 | Rationale: Why does this exist? How did this start? ~ | ||
1011 | |||
1012 | After seeing the awesome theme for Atom (seti-ui) and the awesome plugins work | ||
1013 | done for NERDTree and vim-airline and wanting something like this for Vim I | ||
1014 | decided to create my first plugin. | ||
1015 | |||
1016 | =============================================================================== | ||
1017 | *devicons-references* | ||
1018 | References ~ | ||
1019 | |||
1020 | [1] https://github.com/scrooloose/nerdtree | ||
1021 | [2] https://github.com/vim-airline/vim-airline | ||
1022 | [3] https://github.com/ctrlpvim/ctrlp.vim | ||
1023 | [4] https://github.com/powerline/powerline | ||
1024 | [5] https://github.com/Shougo/denite.nvim | ||
1025 | [6] https://github.com/Shougo/unite.vim | ||
1026 | [7] https://github.com/itchyny/lightline.vim | ||
1027 | [8] https://github.com/mhinz/vim-startify | ||
1028 | [9] https://github.com/Shougo/vimfiler.vim | ||
1029 | [10] https://github.com/bagrat/vim-workspace | ||
1030 | [11] https://github.com/tpope/vim-flagship | ||
1031 | [12] https://github.com/ryanoasis/vim-devicons/wiki/screenshots | ||
1032 | [13] https://github.com/ryanoasis/nerd-fonts | ||
1033 | [14] https://github.com/ryanoasis/vim-devicons/wiki/Detailed-Features | ||
1034 | [15] https://github.com/ryanoasis/vim-devicons/wiki/Extra-Configuration | ||
1035 | [16] https://github.com/ryanoasis/nerd-fonts#font-installation | ||
1036 | [17] https://github.com/ryanoasis/nerd-fonts#font-patcher | ||
1037 | [18] https://github.com/junegunn/vim-plug | ||
1038 | [19] https://github.com/ryanoasis/vim-devicons/wiki/Installation | ||
1039 | [20] DEVELOPER.md | ||
1040 | [21] https://github.com/ryanoasis/vim-devicons/wiki/FAQ-&-Troubleshooting | ||
1041 | [22] CODE_OF_CONDUCT.md | ||
1042 | [23] CONTRIBUTING.md | ||
1043 | [24] https://github.com/ryanoasis/vim-devicons | ||
1044 | [25] http://www.vim.org/scripts/script.php?script_id=5114 | ||
1045 | [26] https://github.com/Xuyuanp/nerdtree-git-plugin | ||
1046 | [27] https://github.com/Xuyuanp | ||
1047 | [28] https://atom.io/themes/seti-ui | ||
1048 | [29] https://github.com/jesseweed | ||
1049 | [30] http://vorillaz.github.io/devicons | ||
1050 | [31] https://github.com/vorillaz | ||
1051 | [32] https://github.com/benatespina/development.svg.icons | ||
1052 | [33] https://github.com/benatespina | ||
1053 | [34] http://learnvimscriptthehardway.stevelosh.com/ | ||
1054 | [35] http://stevelosh.com/ | ||
1055 | [36] https://github.com/ryanoasis/vim-devicons/graphs/contributors | ||
1056 | [37] LICENSE | ||
1057 | [38] https://github.com/tpope/vim-pathogen | ||
1058 | [39] https://github.com/Shougo/neobundle.vim | ||
1059 | [40] https://github.com/gmarik/vundle | ||
1060 | [41] https://github.com/ryanoasis/vim-devicons/wiki/samples/v0.10.x/.vimrc-windows-1 | ||
1061 | [42] https://github.com/ryanoasis/vim-devicons/wiki/samples/v0.10.x/.vimrc-linux-1 | ||
1062 | [43] https://github.com/Lokaltog/vim-powerline | ||
1063 | [44] https://github.com/ryanoasis/vim-devicons/wiki/samples/v0.10.x/powerline/themes/vim/default.json | ||
1064 | [45] http://www.vim.org/scripts/script.php?script_id=1658 | ||
1065 | [46] http://www.vim.org/scripts/script.php?script_id=3736 | ||
1066 | [47] https://github.com/tpope/vim-flagship/issues/6#issuecomment-116121220 | ||
1067 | [48] https://github.com/ryanoasis/vim-devicons/pull/135 | ||
1068 | [49] https://github.com/tiagofumo/vim-nerdtree-syntax-highlight | ||
1069 | [50] https://github.com/tiagofumo | ||
1070 | [51] https://github.com/ryanoasis/vim-devicons/issues/110#issue-103801335 | ||
1071 | [52] https://github.com/ryanoasis/vim-devicons/issues/153 | ||
1072 | [53] https://github.com/ryanoasis/nerd-fonts/blob/master/src/glyphs/Symbols-1000-em%20Nerd%20Font%20Complete.ttf | ||
1073 | [54] https://github.com/ryanoasis/nerd-fonts/blob/master/src/glyphs/Symbols-2048-em%20Nerd%20Font%20Complete.ttf | ||
1074 | [55] https://github.com/ryanoasis/nerd-fonts/blob/master/10-nerd-font-symbols.conf | ||
1075 | [56] https://github.com/ryanoasis/vim-devicons/issues/124 | ||
1076 | [57] https://github.com/ryanoasis/vim-devicons#character-mappings | ||
1077 | |||
1078 | vim: ft=help | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/nerdtree_plugin/webdevicons.vim b/.vim/pack/vendor/start/vim-devicons/nerdtree_plugin/webdevicons.vim new file mode 100644 index 0000000..7c1f9f7 --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/nerdtree_plugin/webdevicons.vim | |||
@@ -0,0 +1,389 @@ | |||
1 | " Version: 0.11.0 | ||
2 | " Webpage: https://github.com/ryanoasis/vim-devicons | ||
3 | " Maintainer: Ryan McIntyre <ryanoasis@gmail.com> | ||
4 | " License: see LICENSE | ||
5 | |||
6 | " @todo fix duplicate global variable initialize here: | ||
7 | if !exists('g:webdevicons_enable') | ||
8 | let g:webdevicons_enable = 1 | ||
9 | endif | ||
10 | |||
11 | if !exists('g:webdevicons_enable_nerdtree') | ||
12 | let g:webdevicons_enable_nerdtree = 1 | ||
13 | endif | ||
14 | |||
15 | if !exists('g:DevIconsEnableFoldersOpenClose') | ||
16 | let g:DevIconsEnableFoldersOpenClose = 0 | ||
17 | endif | ||
18 | |||
19 | if !exists('g:DevIconsEnableFolderPatternMatching') | ||
20 | let g:DevIconsEnableFolderPatternMatching = 1 | ||
21 | endif | ||
22 | |||
23 | if !exists('g:DevIconsEnableFolderExtensionPatternMatching') | ||
24 | let g:DevIconsEnableFolderExtensionPatternMatching = 0 | ||
25 | endif | ||
26 | |||
27 | " end @todo duplicate global variables | ||
28 | |||
29 | " Temporary (hopefully) fix for glyph issues in gvim (proper fix is with the | ||
30 | " actual font patcher) | ||
31 | if !exists('g:webdevicons_gui_glyph_fix') | ||
32 | if has('gui_running') | ||
33 | let g:webdevicons_gui_glyph_fix = 1 | ||
34 | else | ||
35 | let g:webdevicons_gui_glyph_fix = 0 | ||
36 | endif | ||
37 | endif | ||
38 | |||
39 | if !exists('g:DevIconsEnableNERDTreeRedraw') | ||
40 | if has('gui_running') | ||
41 | let g:DevIconsEnableNERDTreeRedraw = 1 | ||
42 | else | ||
43 | let g:DevIconsEnableNERDTreeRedraw = 0 | ||
44 | endif | ||
45 | endif | ||
46 | |||
47 | if g:webdevicons_enable_nerdtree == 1 | ||
48 | if !exists('g:loaded_nerd_tree') | ||
49 | echohl WarningMsg | | ||
50 | \ echomsg 'vim-webdevicons requires NERDTree to be loaded before vim-webdevicons.' | ||
51 | endif | ||
52 | |||
53 | if exists('g:loaded_nerd_tree') && g:loaded_nerd_tree == 1 && !exists('g:NERDTreePathNotifier') | ||
54 | let g:webdevicons_enable_nerdtree = 0 | ||
55 | echohl WarningMsg | | ||
56 | \ echomsg 'vim-webdevicons requires a newer version of NERDTree to show glyphs in NERDTree - consider updating NERDTree.' | ||
57 | endif | ||
58 | |||
59 | " @todo I don't even want this to execute UNLESS the user has the | ||
60 | " 'nerdtree-git-plugin' INSTALLED (not LOADED) | ||
61 | " As it currently functions this warning will display even if the user does | ||
62 | " not have nerdtree-git-plugin not just if it isn't loaded yet | ||
63 | " (not what we want) | ||
64 | "if !exists('g:loaded_nerdtree_git_status') | ||
65 | " echohl WarningMsg | | ||
66 | " \ echomsg 'vim-webdevicons works better when 'nerdtree-git-plugin' is loaded before vim-webdevicons (small refresh issues otherwise).' | ||
67 | "endif | ||
68 | endif | ||
69 | |||
70 | if !exists('g:webdevicons_enable_airline_tabline') | ||
71 | let g:webdevicons_enable_airline_tabline = 1 | ||
72 | endif | ||
73 | |||
74 | if !exists('g:webdevicons_enable_airline_statusline') | ||
75 | let g:webdevicons_enable_airline_statusline = 1 | ||
76 | endif | ||
77 | |||
78 | function! s:SetupListeners() | ||
79 | call g:NERDTreePathNotifier.AddListener('init', 'NERDTreeWebDevIconsRefreshListener') | ||
80 | call g:NERDTreePathNotifier.AddListener('refresh', 'NERDTreeWebDevIconsRefreshListener') | ||
81 | call g:NERDTreePathNotifier.AddListener('refreshFlags', 'NERDTreeWebDevIconsRefreshListener') | ||
82 | endfunction | ||
83 | |||
84 | " util like helpers | ||
85 | " scope: local | ||
86 | function! s:Refresh() | ||
87 | call b:NERDTree.root.refreshFlags() | ||
88 | call NERDTreeRender() | ||
89 | endfunction | ||
90 | |||
91 | " Temporary (hopefully) fix for glyph issues in gvim (proper fix is with the | ||
92 | " actual font patcher) | ||
93 | |||
94 | " NERDTree-C | ||
95 | " scope: global | ||
96 | function! WebDevIconsNERDTreeChangeRootHandler(node) | ||
97 | call b:NERDTree.changeRoot(a:node) | ||
98 | call NERDTreeRender() | ||
99 | call a:node.putCursorHere(0, 0) | ||
100 | if g:DevIconsEnableNERDTreeRedraw ==# 1 | ||
101 | redraw! | ||
102 | endif | ||
103 | endfunction | ||
104 | |||
105 | " NERDTree-u | ||
106 | " scope: global | ||
107 | function! WebDevIconsNERDTreeUpDirCurrentRootClosedHandler() | ||
108 | call nerdtree#ui_glue#upDir(0) | ||
109 | if g:DevIconsEnableNERDTreeRedraw ==# 1 | ||
110 | redraw! | ||
111 | endif | ||
112 | endfunction | ||
113 | |||
114 | function! WebDevIconsNERDTreeDirUpdateFlags(node, glyph) | ||
115 | let path = a:node.path | ||
116 | let isOpen = a:node.isOpen | ||
117 | let postPadding = g:WebDevIconsNerdTreeAfterGlyphPadding | ||
118 | let prePadding = g:WebDevIconsNerdTreeBeforeGlyphPadding | ||
119 | let hasGitFlags = (len(path.flagSet._flagsForScope('git')) > 0) | ||
120 | let hasGitNerdTreePlugin = (exists('g:loaded_nerdtree_git_status') == 1) | ||
121 | let collapsesToSameLine = (exists('g:NERDTreeCascadeSingleChildDir') == 1) | ||
122 | let dirHasOnlyOneChildDir = 0 | ||
123 | |||
124 | if collapsesToSameLine | ||
125 | " need to call to determin children: | ||
126 | call a:node._initChildren(1) | ||
127 | let dirHasOnlyOneChildDir = (a:node.getChildCount() ==# 1 && a:node.children[0].path.isDirectory) | ||
128 | endif | ||
129 | |||
130 | " properly set collapsed/combined directory display to opened glyph | ||
131 | if collapsesToSameLine && dirHasOnlyOneChildDir | ||
132 | call WebDevIconsNERDTreeDirOpen(a:node.children[0]) | ||
133 | endif | ||
134 | |||
135 | " align vertically at the same level: non git-flag nodes with git-flag nodes | ||
136 | if g:WebDevIconsNerdTreeGitPluginForceVAlign && !hasGitFlags && hasGitNerdTreePlugin | ||
137 | let prePadding .= ' ' | ||
138 | endif | ||
139 | |||
140 | let flag = prePadding . a:glyph . postPadding | ||
141 | |||
142 | call a:node.path.flagSet.clearFlags('webdevicons') | ||
143 | |||
144 | if flag !=? '' | ||
145 | call a:node.path.flagSet.addFlag('webdevicons', flag) | ||
146 | "echom "added flag of " . flag | ||
147 | call a:node.path.refreshFlags(b:NERDTree) | ||
148 | "echom "flagset is now " . string(a:node.path.flagSet) | ||
149 | endif | ||
150 | endfunction | ||
151 | |||
152 | function! WebDevIconsNERDTreeDirClose(node) | ||
153 | let a:node.path.isOpen = 0 | ||
154 | let glyph = g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol | ||
155 | call WebDevIconsNERDTreeDirUpdateFlags(a:node, glyph) | ||
156 | endfunction | ||
157 | |||
158 | function! WebDevIconsNERDTreeDirOpen(node) | ||
159 | let a:node.path.isOpen = 1 | ||
160 | let glyph = g:DevIconsDefaultFolderOpenSymbol | ||
161 | call WebDevIconsNERDTreeDirUpdateFlags(a:node, glyph) | ||
162 | endfunction | ||
163 | |||
164 | function! WebDevIconsNERDTreeDirOpenRecursively(node) | ||
165 | call WebDevIconsNERDTreeDirOpen(a:node) | ||
166 | for i in a:node.children | ||
167 | if i.path.isDirectory ==# 1 | ||
168 | call WebDevIconsNERDTreeDirOpenRecursively(i) | ||
169 | endif | ||
170 | endfor | ||
171 | endfunction | ||
172 | |||
173 | function! WebDevIconsNERDTreeDirCloseRecursively(node) | ||
174 | call WebDevIconsNERDTreeDirClose(a:node) | ||
175 | for i in a:node.children | ||
176 | if i.path.isDirectory ==# 1 | ||
177 | call WebDevIconsNERDTreeDirCloseRecursively(i) | ||
178 | endif | ||
179 | endfor | ||
180 | endfunction | ||
181 | |||
182 | function! WebDevIconsNERDTreeDirCloseChildren(node) | ||
183 | for i in a:node.children | ||
184 | if i.path.isDirectory ==# 1 | ||
185 | call WebDevIconsNERDTreeDirClose(i) | ||
186 | endif | ||
187 | endfor | ||
188 | endfunction | ||
189 | |||
190 | " NERDTreeMapActivateNode and <2-LeftMouse> | ||
191 | " handle the user activating a tree node | ||
192 | " scope: global | ||
193 | function! WebDevIconsNERDTreeMapActivateNode(node) | ||
194 | let isOpen = a:node.isOpen | ||
195 | if isOpen | ||
196 | let glyph = g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol | ||
197 | else | ||
198 | let glyph = g:DevIconsDefaultFolderOpenSymbol | ||
199 | endif | ||
200 | let a:node.path.isOpen = !isOpen | ||
201 | call WebDevIconsNERDTreeDirUpdateFlags(a:node, glyph) | ||
202 | " continue with normal activate logic | ||
203 | call a:node.activate() | ||
204 | " glyph change possible artifact clean-up | ||
205 | if g:DevIconsEnableNERDTreeRedraw ==# 1 | ||
206 | redraw! | ||
207 | endif | ||
208 | endfunction | ||
209 | |||
210 | " NERDTreeMapActivateNodeSingleMode | ||
211 | " handle the user activating a tree node if NERDTreeMouseMode is setted to 3 | ||
212 | " scope: global | ||
213 | function! WebDevIconsNERDTreeMapActivateNodeSingleMode(node) | ||
214 | if g:NERDTreeMouseMode == 3 | ||
215 | let isOpen = a:node.isOpen | ||
216 | if isOpen | ||
217 | let glyph = g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol | ||
218 | else | ||
219 | let glyph = g:DevIconsDefaultFolderOpenSymbol | ||
220 | endif | ||
221 | let a:node.path.isOpen = !isOpen | ||
222 | call WebDevIconsNERDTreeDirUpdateFlags(a:node, glyph) | ||
223 | " continue with normal activate logic | ||
224 | call a:node.activate() | ||
225 | " glyph change possible artifact clean-up | ||
226 | if g:DevIconsEnableNERDTreeRedraw ==# 1 | ||
227 | redraw! | ||
228 | endif | ||
229 | endif | ||
230 | endfunction | ||
231 | |||
232 | function! WebDevIconsNERDTreeMapOpenRecursively(node) | ||
233 | " normal original logic: | ||
234 | call nerdtree#echo('Recursively opening node. Please wait...') | ||
235 | call WebDevIconsNERDTreeDirOpenRecursively(a:node) | ||
236 | call a:node.openRecursively() | ||
237 | " continue with normal original logic: | ||
238 | call b:NERDTree.render() | ||
239 | " glyph change possible artifact clean-up | ||
240 | if g:DevIconsEnableNERDTreeRedraw ==# 1 | ||
241 | redraw! | ||
242 | endif | ||
243 | call nerdtree#echo('Recursively opening node. Please wait... DONE') | ||
244 | endfunction | ||
245 | |||
246 | function! WebDevIconsNERDTreeMapCloseChildren(node) | ||
247 | " close children but not current node: | ||
248 | call WebDevIconsNERDTreeDirCloseChildren(a:node) | ||
249 | " continue with normal original logic: | ||
250 | call a:node.closeChildren() | ||
251 | call b:NERDTree.render() | ||
252 | call a:node.putCursorHere(0, 0) | ||
253 | " glyph change possible artifact clean-up | ||
254 | if g:DevIconsEnableNERDTreeRedraw ==# 1 | ||
255 | redraw! | ||
256 | endif | ||
257 | endfunction | ||
258 | |||
259 | function! WebDevIconsNERDTreeMapCloseDir(node) | ||
260 | " continue with normal original logic: | ||
261 | let parent = a:node.parent | ||
262 | while g:NERDTreeCascadeOpenSingleChildDir && !parent.isRoot() | ||
263 | let childNodes = parent.getVisibleChildren() | ||
264 | if len(childNodes) == 1 && childNodes[0].path.isDirectory | ||
265 | let parent = parent.parent | ||
266 | else | ||
267 | break | ||
268 | endif | ||
269 | endwhile | ||
270 | if parent ==# {} || parent.isRoot() | ||
271 | call nerdtree#echo('cannot close tree root') | ||
272 | else | ||
273 | call parent.close() | ||
274 | " update the glyph | ||
275 | call WebDevIconsNERDTreeDirClose(parent) | ||
276 | call b:NERDTree.render() | ||
277 | call parent.putCursorHere(0, 0) | ||
278 | " glyph change possible artifact clean-up | ||
279 | if g:DevIconsEnableNERDTreeRedraw ==# 1 | ||
280 | redraw! | ||
281 | endif | ||
282 | endif | ||
283 | endfunction | ||
284 | |||
285 | function! WebDevIconsNERDTreeMapUpdirKeepOpen() | ||
286 | call WebDevIconsNERDTreeDirOpen(b:NERDTree.root) | ||
287 | " continue with normal logic: | ||
288 | call nerdtree#ui_glue#upDir(1) | ||
289 | call s:Refresh() | ||
290 | " glyph change possible artifact clean-up | ||
291 | if g:DevIconsEnableNERDTreeRedraw ==# 1 | ||
292 | redraw! | ||
293 | endif | ||
294 | endfunction | ||
295 | |||
296 | if g:webdevicons_enable == 1 && g:webdevicons_enable_nerdtree == 1 | ||
297 | call s:SetupListeners() | ||
298 | |||
299 | if g:DevIconsEnableFoldersOpenClose | ||
300 | |||
301 | " These overrides are needed because we cannot | ||
302 | " simply use AddListener for reliably updating | ||
303 | " the folder open/close glyphs because the event | ||
304 | " path has no access to the 'isOpen' property | ||
305 | " some of these are a little more brittle/fragile | ||
306 | " than others | ||
307 | " TODO FIXME better way to reliably update | ||
308 | " open/close glyphs in NERDTreeWebDevIconsRefreshListener | ||
309 | |||
310 | " NERDTreeMapActivateNode | ||
311 | call NERDTreeAddKeyMap({ | ||
312 | \ 'key': g:NERDTreeMapActivateNode, | ||
313 | \ 'callback': 'WebDevIconsNERDTreeMapActivateNode', | ||
314 | \ 'override': 1, | ||
315 | \ 'scope': 'DirNode' }) | ||
316 | |||
317 | " NERDTreeMapCustomOpen | ||
318 | call NERDTreeAddKeyMap({ | ||
319 | \ 'key': g:NERDTreeMapCustomOpen, | ||
320 | \ 'callback': 'WebDevIconsNERDTreeMapActivateNode', | ||
321 | \ 'override': 1, | ||
322 | \ 'scope': 'DirNode' }) | ||
323 | |||
324 | " NERDTreeMapOpenRecursively | ||
325 | call NERDTreeAddKeyMap({ | ||
326 | \ 'key': g:NERDTreeMapOpenRecursively, | ||
327 | \ 'callback': 'WebDevIconsNERDTreeMapOpenRecursively', | ||
328 | \ 'override': 1, | ||
329 | \ 'scope': 'DirNode' }) | ||
330 | |||
331 | " NERDTreeMapCloseChildren | ||
332 | call NERDTreeAddKeyMap({ | ||
333 | \ 'key': g:NERDTreeMapCloseChildren, | ||
334 | \ 'callback': 'WebDevIconsNERDTreeMapCloseChildren', | ||
335 | \ 'override': 1, | ||
336 | \ 'scope': 'DirNode' }) | ||
337 | |||
338 | " NERDTreeMapCloseChildren | ||
339 | call NERDTreeAddKeyMap({ | ||
340 | \ 'key': g:NERDTreeMapCloseDir, | ||
341 | \ 'callback': 'WebDevIconsNERDTreeMapCloseDir', | ||
342 | \ 'override': 1, | ||
343 | \ 'scope': 'Node' }) | ||
344 | |||
345 | " <2-LeftMouse> | ||
346 | call NERDTreeAddKeyMap({ | ||
347 | \ 'key': '<2-LeftMouse>', | ||
348 | \ 'callback': 'WebDevIconsNERDTreeMapActivateNode', | ||
349 | \ 'override': 1, | ||
350 | \ 'scope': 'DirNode' }) | ||
351 | |||
352 | " <LeftRelease> | ||
353 | call NERDTreeAddKeyMap({ | ||
354 | \ 'key': '<LeftRelease>', | ||
355 | \ 'callback': 'WebDevIconsNERDTreeMapActivateNodeSingleMode', | ||
356 | \ 'override': 1, | ||
357 | \ 'scope': 'DirNode' }) | ||
358 | |||
359 | " NERDTreeMapUpdirKeepOpen | ||
360 | call NERDTreeAddKeyMap({ | ||
361 | \ 'key': g:NERDTreeMapUpdirKeepOpen, | ||
362 | \ 'callback': 'WebDevIconsNERDTreeMapUpdirKeepOpen', | ||
363 | \ 'override': 1, | ||
364 | \ 'scope': 'all' }) | ||
365 | |||
366 | endif | ||
367 | |||
368 | " Temporary (hopefully) fix for glyph issues in gvim (proper fix is with the | ||
369 | " actual font patcher) | ||
370 | if g:webdevicons_gui_glyph_fix ==# 1 | ||
371 | call NERDTreeAddKeyMap({ | ||
372 | \ 'key': g:NERDTreeMapChangeRoot, | ||
373 | \ 'callback': 'WebDevIconsNERDTreeChangeRootHandler', | ||
374 | \ 'override': 1, | ||
375 | \ 'quickhelpText': "change tree root to the\n\" selected dir\n\" plus devicons redraw\n\" hack fix", | ||
376 | \ 'scope': 'Node' }) | ||
377 | |||
378 | call NERDTreeAddKeyMap({ | ||
379 | \ 'key': g:NERDTreeMapUpdir, | ||
380 | \ 'callback': 'WebDevIconsNERDTreeUpDirCurrentRootClosedHandler', | ||
381 | \ 'override': 1, | ||
382 | \ 'quickhelpText': "move tree root up a dir\n\" plus devicons redraw\n\" hack fix", | ||
383 | \ 'scope': 'all' }) | ||
384 | endif | ||
385 | |||
386 | endif | ||
387 | |||
388 | " modeline syntax: | ||
389 | " vim: fdm=marker tabstop=2 softtabstop=2 shiftwidth=2 expandtab: | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/plugin/webdevicons.vim b/.vim/pack/vendor/start/vim-devicons/plugin/webdevicons.vim new file mode 100644 index 0000000..596ec68 --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/plugin/webdevicons.vim | |||
@@ -0,0 +1,703 @@ | |||
1 | " Version: 0.11.0 | ||
2 | " Webpage: https://github.com/ryanoasis/vim-devicons | ||
3 | " Maintainer: Ryan McIntyre <ryanoasis@gmail.com> | ||
4 | " License: see LICENSE | ||
5 | |||
6 | let s:version = '0.11.0' | ||
7 | let s:plugin_home = expand('<sfile>:p:h:h') | ||
8 | |||
9 | " set scriptencoding after 'encoding' and when using multibyte chars | ||
10 | scriptencoding utf-8 | ||
11 | |||
12 | " standard fix/safety: line continuation (avoiding side effects) {{{1 | ||
13 | "======================================================================== | ||
14 | let s:save_cpo = &cpo | ||
15 | set cpo&vim | ||
16 | |||
17 | " standard loading / not loading {{{1 | ||
18 | "======================================================================== | ||
19 | |||
20 | if exists('g:loaded_webdevicons') | ||
21 | finish | ||
22 | endif | ||
23 | |||
24 | let g:loaded_webdevicons = 1 | ||
25 | |||
26 | " config enable / disable settings {{{1 | ||
27 | "======================================================================== | ||
28 | |||
29 | "" | ||
30 | " Set the variable to the default value, only if variable is not defined. | ||
31 | " | ||
32 | " @param {string} var Variable name with its scope. | ||
33 | " @param {*} default Default value for variable. | ||
34 | "" | ||
35 | function! s:set(var, default) abort | ||
36 | if !exists(a:var) | ||
37 | if type(a:default) | ||
38 | execute 'let' a:var '=' string(a:default) | ||
39 | else | ||
40 | execute 'let' a:var '=' a:default | ||
41 | endif | ||
42 | endif | ||
43 | endfunction | ||
44 | |||
45 | call s:set('g:webdevicons_enable', 1) | ||
46 | call s:set('g:webdevicons_enable_nerdtree', 1) | ||
47 | call s:set('g:webdevicons_enable_unite ', 1) | ||
48 | call s:set('g:webdevicons_enable_denite', 1) | ||
49 | call s:set('g:webdevicons_enable_vimfiler', 1) | ||
50 | call s:set('g:webdevicons_enable_ctrlp', 1) | ||
51 | call s:set('g:webdevicons_enable_airline_tabline', 1) | ||
52 | call s:set('g:webdevicons_enable_airline_statusline', 1) | ||
53 | call s:set('g:webdevicons_enable_airline_statusline_fileformat_symbols', 1) | ||
54 | call s:set('g:webdevicons_enable_flagship_statusline', 1) | ||
55 | call s:set('g:webdevicons_enable_flagship_statusline_fileformat_symbols', 1) | ||
56 | call s:set('g:webdevicons_enable_startify', 1) | ||
57 | call s:set('g:webdevicons_conceal_nerdtree_brackets', 1) | ||
58 | call s:set('g:DevIconsAppendArtifactFix', has('gui_running') ? 1 : 0) | ||
59 | call s:set('g:DevIconsArtifactFixChar', ' ') | ||
60 | |||
61 | " config options {{{1 | ||
62 | "======================================================================== | ||
63 | |||
64 | call s:set('g:WebDevIconsUnicodeDecorateFileNodes', 1) | ||
65 | call s:set('g:WebDevIconsUnicodeDecorateFolderNodes', 1) | ||
66 | call s:set('g:DevIconsEnableFoldersOpenClose', 0) | ||
67 | call s:set('g:DevIconsEnableFolderPatternMatching', 1) | ||
68 | call s:set('g:DevIconsEnableFolderExtensionPatternMatching', 0) | ||
69 | call s:set('g:DevIconsEnableDistro', 1) | ||
70 | call s:set('g:WebDevIconsUnicodeDecorateFolderNodesExactMatches', 1) | ||
71 | call s:set('g:WebDevIconsUnicodeGlyphDoubleWidth', 1) | ||
72 | call s:set('g:WebDevIconsNerdTreeBeforeGlyphPadding', ' ') | ||
73 | call s:set('g:WebDevIconsNerdTreeAfterGlyphPadding', ' ') | ||
74 | call s:set('g:WebDevIconsNerdTreeGitPluginForceVAlign', 1) | ||
75 | call s:set('g:NERDTreeUpdateOnCursorHold', 1) " Obsolete: For backward compatibility | ||
76 | call s:set('g:NERDTreeGitStatusUpdateOnCursorHold', 1) | ||
77 | call s:set('g:WebDevIconsTabAirLineBeforeGlyphPadding', ' ') | ||
78 | call s:set('g:WebDevIconsTabAirLineAfterGlyphPadding', '') | ||
79 | |||
80 | " config defaults {{{1 | ||
81 | "======================================================================== | ||
82 | |||
83 | call s:set('g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol', '') | ||
84 | call s:set('g:WebDevIconsUnicodeByteOrderMarkerDefaultSymbol', '') | ||
85 | call s:set('g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol', g:DevIconsEnableFoldersOpenClose ? '' : '') | ||
86 | call s:set('g:WebDevIconsUnicodeDecorateFolderNodesSymlinkSymbol', '') | ||
87 | call s:set('g:DevIconsDefaultFolderOpenSymbol', '') | ||
88 | |||
89 | " functions {{{1 | ||
90 | "======================================================================== | ||
91 | |||
92 | " local functions {{{2 | ||
93 | "======================================================================== | ||
94 | |||
95 | " scope: local | ||
96 | function s:getDistro() | ||
97 | if exists('s:distro') | ||
98 | return s:distro | ||
99 | endif | ||
100 | |||
101 | if has('bsd') | ||
102 | let s:distro = '' | ||
103 | return s:distro | ||
104 | endif | ||
105 | |||
106 | if g:DevIconsEnableDistro && executable('lsb_release') | ||
107 | let s:lsb = system('lsb_release -i') | ||
108 | if s:lsb =~# 'Arch' | ||
109 | let s:distro = '' | ||
110 | elseif s:lsb =~# 'Gentoo' | ||
111 | let s:distro = '' | ||
112 | elseif s:lsb =~# 'Ubuntu' | ||
113 | let s:distro = '' | ||
114 | elseif s:lsb =~# 'Cent' | ||
115 | let s:distro = '' | ||
116 | elseif s:lsb =~# 'Debian' | ||
117 | let s:distro = '' | ||
118 | elseif s:lsb =~# 'Dock' | ||
119 | let s:distro = '' | ||
120 | else | ||
121 | let s:distro = '' | ||
122 | endif | ||
123 | return s:distro | ||
124 | endif | ||
125 | |||
126 | let s:distro = '' | ||
127 | return s:distro | ||
128 | endfunction | ||
129 | |||
130 | " scope: local | ||
131 | function s:isDarwin() | ||
132 | if exists('s:is_darwin') | ||
133 | return s:is_darwin | ||
134 | endif | ||
135 | |||
136 | if exists('g:WebDevIconsOS') | ||
137 | let s:is_darwin = g:WebDevIconsOS ==? 'Darwin' | ||
138 | return s:is_darwin | ||
139 | endif | ||
140 | |||
141 | if has('macunix') | ||
142 | let s:is_darwin = 1 | ||
143 | return s:is_darwin | ||
144 | endif | ||
145 | |||
146 | if ! has('unix') | ||
147 | let s:is_darwin = 0 | ||
148 | return s:is_darwin | ||
149 | endif | ||
150 | |||
151 | if system('uname -s') ==# "Darwin\n" | ||
152 | let s:is_darwin = 1 | ||
153 | else | ||
154 | let s:is_darwin = 0 | ||
155 | endif | ||
156 | |||
157 | return s:is_darwin | ||
158 | endfunction | ||
159 | |||
160 | " scope: local | ||
161 | function! s:strip(input) | ||
162 | return substitute(a:input, '^\s*\(.\{-}\)\s*$', '\1', '') | ||
163 | endfunction | ||
164 | |||
165 | " scope: local | ||
166 | function! s:setDictionaries() | ||
167 | |||
168 | let s:file_node_extensions = { | ||
169 | \ 'styl' : '', | ||
170 | \ 'sass' : '', | ||
171 | \ 'scss' : '', | ||
172 | \ 'htm' : '', | ||
173 | \ 'html' : '', | ||
174 | \ 'slim' : '', | ||
175 | \ 'haml' : '', | ||
176 | \ 'ejs' : '', | ||
177 | \ 'css' : '', | ||
178 | \ 'less' : '', | ||
179 | \ 'md' : '', | ||
180 | \ 'mdx' : '', | ||
181 | \ 'markdown' : '', | ||
182 | \ 'rmd' : '', | ||
183 | \ 'json' : '', | ||
184 | \ 'webmanifest' : '', | ||
185 | \ 'js' : '', | ||
186 | \ 'mjs' : '', | ||
187 | \ 'jsx' : '', | ||
188 | \ 'rb' : '', | ||
189 | \ 'gemspec' : '', | ||
190 | \ 'rake' : '', | ||
191 | \ 'php' : '', | ||
192 | \ 'py' : '', | ||
193 | \ 'pyc' : '', | ||
194 | \ 'pyo' : '', | ||
195 | \ 'pyd' : '', | ||
196 | \ 'coffee' : '', | ||
197 | \ 'mustache' : '', | ||
198 | \ 'hbs' : '', | ||
199 | \ 'conf' : '', | ||
200 | \ 'ini' : '', | ||
201 | \ 'yml' : '', | ||
202 | \ 'yaml' : '', | ||
203 | \ 'toml' : '', | ||
204 | \ 'bat' : '', | ||
205 | \ 'mk' : '', | ||
206 | \ 'jpg' : '', | ||
207 | \ 'jpeg' : '', | ||
208 | \ 'bmp' : '', | ||
209 | \ 'png' : '', | ||
210 | \ 'webp' : '', | ||
211 | \ 'gif' : '', | ||
212 | \ 'ico' : '', | ||
213 | \ 'twig' : '', | ||
214 | \ 'cpp' : '', | ||
215 | \ 'c++' : '', | ||
216 | \ 'cxx' : '', | ||
217 | \ 'cc' : '', | ||
218 | \ 'cp' : '', | ||
219 | \ 'c' : '', | ||
220 | \ 'cs' : '', | ||
221 | \ 'h' : '', | ||
222 | \ 'hh' : '', | ||
223 | \ 'hpp' : '', | ||
224 | \ 'hxx' : '', | ||
225 | \ 'hs' : '', | ||
226 | \ 'lhs' : '', | ||
227 | \ 'nix' : '', | ||
228 | \ 'lua' : '', | ||
229 | \ 'java' : '', | ||
230 | \ 'sh' : '', | ||
231 | \ 'fish' : '', | ||
232 | \ 'bash' : '', | ||
233 | \ 'zsh' : '', | ||
234 | \ 'ksh' : '', | ||
235 | \ 'csh' : '', | ||
236 | \ 'awk' : '', | ||
237 | \ 'ps1' : '', | ||
238 | \ 'ml' : 'λ', | ||
239 | \ 'mli' : 'λ', | ||
240 | \ 'diff' : '', | ||
241 | \ 'db' : '', | ||
242 | \ 'sql' : '', | ||
243 | \ 'dump' : '', | ||
244 | \ 'clj' : '', | ||
245 | \ 'cljc' : '', | ||
246 | \ 'cljs' : '', | ||
247 | \ 'edn' : '', | ||
248 | \ 'scala' : '', | ||
249 | \ 'go' : '', | ||
250 | \ 'dart' : '', | ||
251 | \ 'xul' : '', | ||
252 | \ 'sln' : '', | ||
253 | \ 'suo' : '', | ||
254 | \ 'pl' : '', | ||
255 | \ 'pm' : '', | ||
256 | \ 't' : '', | ||
257 | \ 'rss' : '', | ||
258 | \ 'f#' : '', | ||
259 | \ 'fsscript' : '', | ||
260 | \ 'fsx' : '', | ||
261 | \ 'fs' : '', | ||
262 | \ 'fsi' : '', | ||
263 | \ 'rs' : '', | ||
264 | \ 'rlib' : '', | ||
265 | \ 'd' : '', | ||
266 | \ 'erl' : '', | ||
267 | \ 'hrl' : '', | ||
268 | \ 'ex' : '', | ||
269 | \ 'exs' : '', | ||
270 | \ 'eex' : '', | ||
271 | \ 'leex' : '', | ||
272 | \ 'heex' : '', | ||
273 | \ 'vim' : '', | ||
274 | \ 'ai' : '', | ||
275 | \ 'psd' : '', | ||
276 | \ 'psb' : '', | ||
277 | \ 'ts' : '', | ||
278 | \ 'tsx' : '', | ||
279 | \ 'jl' : '', | ||
280 | \ 'pp' : '', | ||
281 | \ 'vue' : '﵂', | ||
282 | \ 'elm' : '', | ||
283 | \ 'swift' : '', | ||
284 | \ 'xcplayground' : '', | ||
285 | \ 'tex' : 'ﭨ', | ||
286 | \ 'r' : 'ﳒ', | ||
287 | \ 'rproj' : '鉶', | ||
288 | \ 'sol' : 'ﲹ', | ||
289 | \ 'pem' : '' | ||
290 | \} | ||
291 | |||
292 | let s:file_node_exact_matches = { | ||
293 | \ 'exact-match-case-sensitive-1.txt' : '1', | ||
294 | \ 'exact-match-case-sensitive-2' : '2', | ||
295 | \ 'gruntfile.coffee' : '', | ||
296 | \ 'gruntfile.js' : '', | ||
297 | \ 'gruntfile.ls' : '', | ||
298 | \ 'gulpfile.coffee' : '', | ||
299 | \ 'gulpfile.js' : '', | ||
300 | \ 'gulpfile.ls' : '', | ||
301 | \ 'mix.lock' : '', | ||
302 | \ 'dropbox' : '', | ||
303 | \ '.ds_store' : '', | ||
304 | \ '.gitconfig' : '', | ||
305 | \ '.gitignore' : '', | ||
306 | \ '.gitattributes' : '', | ||
307 | \ '.gitlab-ci.yml' : '', | ||
308 | \ '.bashrc' : '', | ||
309 | \ '.zshrc' : '', | ||
310 | \ '.zshenv' : '', | ||
311 | \ '.zprofile' : '', | ||
312 | \ '.vimrc' : '', | ||
313 | \ '.gvimrc' : '', | ||
314 | \ '_vimrc' : '', | ||
315 | \ '_gvimrc' : '', | ||
316 | \ '.bashprofile' : '', | ||
317 | \ 'favicon.ico' : '', | ||
318 | \ 'license' : '', | ||
319 | \ 'node_modules' : '', | ||
320 | \ 'react.jsx' : '', | ||
321 | \ 'procfile' : '', | ||
322 | \ 'dockerfile' : '', | ||
323 | \ 'docker-compose.yml' : '', | ||
324 | \ 'rakefile' : '', | ||
325 | \ 'config.ru' : '', | ||
326 | \ 'gemfile' : '', | ||
327 | \ 'makefile' : '', | ||
328 | \ 'cmakelists.txt' : '', | ||
329 | \ 'robots.txt' : 'ﮧ' | ||
330 | \} | ||
331 | |||
332 | let s:file_node_pattern_matches = { | ||
333 | \ '.*jquery.*\.js$' : '', | ||
334 | \ '.*angular.*\.js$' : '', | ||
335 | \ '.*backbone.*\.js$' : '', | ||
336 | \ '.*require.*\.js$' : '', | ||
337 | \ '.*materialize.*\.js$' : '', | ||
338 | \ '.*materialize.*\.css$' : '', | ||
339 | \ '.*mootools.*\.js$' : '', | ||
340 | \ '.*vimrc.*' : '', | ||
341 | \ 'Vagrantfile$' : '' | ||
342 | \} | ||
343 | |||
344 | if !exists('g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols') | ||
345 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} | ||
346 | endif | ||
347 | |||
348 | if !exists('g:WebDevIconsUnicodeDecorateFileNodesExactSymbols') | ||
349 | " do not remove: exact-match-case-sensitive-* | ||
350 | let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols = {} | ||
351 | endif | ||
352 | |||
353 | if !exists('g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols') | ||
354 | let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols = {} | ||
355 | endif | ||
356 | |||
357 | " iterate to fix allow user overriding of specific individual keys in vimrc (only gvimrc was working previously) | ||
358 | for [key, val] in items(s:file_node_extensions) | ||
359 | if !has_key(g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols, key) | ||
360 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols[key] = val | ||
361 | endif | ||
362 | endfor | ||
363 | |||
364 | " iterate to fix allow user overriding of specific individual keys in vimrc (only gvimrc was working previously) | ||
365 | for [key, val] in items(s:file_node_exact_matches) | ||
366 | if !has_key(g:WebDevIconsUnicodeDecorateFileNodesExactSymbols, key) | ||
367 | let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols[key] = val | ||
368 | endif | ||
369 | endfor | ||
370 | |||
371 | " iterate to fix allow user overriding of specific individual keys in vimrc (only gvimrc was working previously) | ||
372 | for [key, val] in items(s:file_node_pattern_matches) | ||
373 | if !has_key(g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols, key) | ||
374 | let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols[key] = val | ||
375 | endif | ||
376 | endfor | ||
377 | |||
378 | endfunction | ||
379 | |||
380 | " scope: local | ||
381 | function! s:setSyntax() | ||
382 | if g:webdevicons_enable_nerdtree == 1 && g:webdevicons_conceal_nerdtree_brackets == 1 | ||
383 | augroup webdevicons_conceal_nerdtree_brackets | ||
384 | au! | ||
385 | autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\]" contained conceal containedin=NERDTreeFlags | ||
386 | autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\[" contained conceal containedin=NERDTreeFlags | ||
387 | autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\]" contained conceal containedin=NERDTreeLinkFile | ||
388 | autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\]" contained conceal containedin=NERDTreeLinkDir | ||
389 | autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\[" contained conceal containedin=NERDTreeLinkFile | ||
390 | autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\[" contained conceal containedin=NERDTreeLinkDir | ||
391 | autocmd FileType nerdtree setlocal conceallevel=3 | ||
392 | autocmd FileType nerdtree setlocal concealcursor=nvic | ||
393 | augroup END | ||
394 | endif | ||
395 | endfunction | ||
396 | |||
397 | " scope: local | ||
398 | " stole solution/idea from nerdtree-git-plugin :) | ||
399 | function! s:setCursorHold() | ||
400 | if g:webdevicons_enable_nerdtree | ||
401 | augroup webdevicons_cursor_hold | ||
402 | autocmd CursorHold * silent! call s:CursorHoldUpdate() | ||
403 | augroup END | ||
404 | endif | ||
405 | endfunction | ||
406 | |||
407 | " scope: local | ||
408 | " stole solution/idea from nerdtree-git-plugin :) | ||
409 | function! s:CursorHoldUpdate() | ||
410 | if g:NERDTreeUpdateOnCursorHold != 1 || g:NERDTreeGitStatusUpdateOnCursorHold != 1 | ||
411 | return | ||
412 | endif | ||
413 | |||
414 | if !exists('g:NERDTree') || !g:NERDTree.IsOpen() | ||
415 | return | ||
416 | endif | ||
417 | |||
418 | " Do not update when a special buffer is selected | ||
419 | if !empty(&l:buftype) | ||
420 | return | ||
421 | endif | ||
422 | |||
423 | " winnr need to make focus go to opened file | ||
424 | " CursorToTreeWin needed to avoid error on opening file | ||
425 | let l:winnr = winnr() | ||
426 | let l:altwinnr = winnr('#') | ||
427 | |||
428 | call g:NERDTree.CursorToTreeWin() | ||
429 | call b:NERDTree.root.refreshFlags() | ||
430 | call NERDTreeRender() | ||
431 | |||
432 | exec l:altwinnr . 'wincmd w' | ||
433 | exec l:winnr . 'wincmd w' | ||
434 | endfunction | ||
435 | |||
436 | " scope: local | ||
437 | function! s:hardRefreshNerdTree() | ||
438 | if g:webdevicons_enable_nerdtree == 1 && g:webdevicons_conceal_nerdtree_brackets == 1 && g:NERDTree.IsOpen() | ||
439 | NERDTreeClose | ||
440 | NERDTree | ||
441 | endif | ||
442 | endfunction | ||
443 | |||
444 | " scope: local | ||
445 | function! s:softRefreshNerdTree() | ||
446 | if g:webdevicons_enable_nerdtree == 1 && exists('g:NERDTree') && g:NERDTree.IsOpen() | ||
447 | NERDTreeToggle | ||
448 | NERDTreeToggle | ||
449 | endif | ||
450 | endfunction | ||
451 | |||
452 | " local initialization {{{2 | ||
453 | "======================================================================== | ||
454 | |||
455 | " scope: local | ||
456 | function! s:initialize() | ||
457 | call s:setDictionaries() | ||
458 | call s:setSyntax() | ||
459 | call s:setCursorHold() | ||
460 | |||
461 | if exists('g:loaded_flagship') | call devicons#plugins#flagship#init() | endif | ||
462 | if exists('g:loaded_unite') && g:webdevicons_enable_unite | call devicons#plugins#unite#init() | endif | ||
463 | if exists('g:loaded_denite') && g:webdevicons_enable_denite | call devicons#plugins#denite#init() | endif | ||
464 | if exists('g:loaded_vimfiler') && g:webdevicons_enable_vimfiler | call devicons#plugins#vimfiler#init() | endif | ||
465 | if exists('g:loaded_ctrlp') && g:webdevicons_enable_ctrlp | call devicons#plugins#ctrlp#init() | endif | ||
466 | if exists('g:loaded_startify') && g:webdevicons_enable_startify | call devicons#plugins#startify#init() | endif | ||
467 | endfunction | ||
468 | |||
469 | |||
470 | " public functions {{{2 | ||
471 | "======================================================================== | ||
472 | |||
473 | " scope: public | ||
474 | function! webdevicons#version() | ||
475 | return s:version | ||
476 | endfunction | ||
477 | |||
478 | " scope: public | ||
479 | function! webdevicons#pluginHome() | ||
480 | return s:plugin_home | ||
481 | endfunction | ||
482 | |||
483 | " scope: public | ||
484 | " allow the first version of refresh to now call softRefresh | ||
485 | function! webdevicons#refresh() | ||
486 | call webdevicons#softRefresh() | ||
487 | endfunction | ||
488 | |||
489 | " scope: public | ||
490 | function! webdevicons#hardRefresh() | ||
491 | call s:setSyntax() | ||
492 | call s:hardRefreshNerdTree() | ||
493 | endfunction | ||
494 | |||
495 | " scope: public | ||
496 | function! webdevicons#softRefresh() | ||
497 | call s:setSyntax() | ||
498 | call s:softRefreshNerdTree() | ||
499 | endfunction | ||
500 | |||
501 | " a:1 (bufferName), a:2 (isDirectory) | ||
502 | " scope: public | ||
503 | function! WebDevIconsGetFileTypeSymbol(...) abort | ||
504 | if a:0 == 0 | ||
505 | let fileNodeExtension = !empty(expand('%:e')) ? expand('%:e') : &filetype | ||
506 | let fileNode = expand('%:t') | ||
507 | let isDirectory = 0 | ||
508 | else | ||
509 | let fileNodeExtension = fnamemodify(a:1, ':e') | ||
510 | let fileNode = fnamemodify(a:1, ':t') | ||
511 | if a:0 > 1 | ||
512 | let isDirectory = a:2 | ||
513 | else | ||
514 | let isDirectory = 0 | ||
515 | endif | ||
516 | endif | ||
517 | |||
518 | if isDirectory == 0 || g:DevIconsEnableFolderPatternMatching | ||
519 | |||
520 | let symbol = g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol | ||
521 | let fileNodeExtension = tolower(fileNodeExtension) | ||
522 | let fileNode = tolower(fileNode) | ||
523 | |||
524 | for [pattern, glyph] in items(g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols) | ||
525 | if match(fileNode, pattern) != -1 | ||
526 | let symbol = glyph | ||
527 | break | ||
528 | endif | ||
529 | endfor | ||
530 | |||
531 | if symbol == g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol | ||
532 | if has_key(g:WebDevIconsUnicodeDecorateFileNodesExactSymbols, fileNode) | ||
533 | let symbol = g:WebDevIconsUnicodeDecorateFileNodesExactSymbols[fileNode] | ||
534 | elseif ((isDirectory == 1 && g:DevIconsEnableFolderExtensionPatternMatching) || isDirectory == 0) && has_key(g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols, fileNodeExtension) | ||
535 | let symbol = g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols[fileNodeExtension] | ||
536 | elseif isDirectory == 1 | ||
537 | let symbol = g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol | ||
538 | endif | ||
539 | endif | ||
540 | |||
541 | else | ||
542 | let symbol = g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol | ||
543 | endif | ||
544 | |||
545 | let artifactFix = s:DevIconsGetArtifactFix() | ||
546 | |||
547 | return symbol . artifactFix | ||
548 | |||
549 | endfunction | ||
550 | |||
551 | " scope: local | ||
552 | " Temporary (hopefully) fix for glyph issues in gvim (proper fix is with the | ||
553 | " actual font patcher) | ||
554 | function! s:DevIconsGetArtifactFix() | ||
555 | if g:DevIconsAppendArtifactFix == 1 | ||
556 | let artifactFix = g:DevIconsArtifactFixChar | ||
557 | else | ||
558 | let artifactFix = '' | ||
559 | endif | ||
560 | |||
561 | return artifactFix | ||
562 | endfunction | ||
563 | |||
564 | " scope: public | ||
565 | function! WebDevIconsGetFileFormatSymbol(...) | ||
566 | let fileformat = '' | ||
567 | let bomb = '' | ||
568 | |||
569 | if (&bomb && g:WebDevIconsUnicodeByteOrderMarkerDefaultSymbol !=? '') | ||
570 | let bomb = g:WebDevIconsUnicodeByteOrderMarkerDefaultSymbol . ' ' | ||
571 | endif | ||
572 | |||
573 | if &fileformat ==? 'dos' | ||
574 | let fileformat = '' | ||
575 | elseif &fileformat ==? 'unix' | ||
576 | let fileformat = s:isDarwin() ? '' : s:getDistro() | ||
577 | elseif &fileformat ==? 'mac' | ||
578 | let fileformat = '' | ||
579 | endif | ||
580 | |||
581 | let artifactFix = s:DevIconsGetArtifactFix() | ||
582 | |||
583 | return bomb . fileformat . artifactFix | ||
584 | endfunction | ||
585 | |||
586 | " for airline plugin {{{3 | ||
587 | "======================================================================== | ||
588 | |||
589 | " scope: public | ||
590 | function! AirlineWebDevIcons(...) | ||
591 | let w:airline_section_x = get(w:, 'airline_section_x', | ||
592 | \ get(g:, 'airline_section_x', '')) | ||
593 | let w:airline_section_x .= ' %{WebDevIconsGetFileTypeSymbol()} ' | ||
594 | let hasFileFormatEncodingPart = airline#parts#ffenc() !=? '' | ||
595 | if g:webdevicons_enable_airline_statusline_fileformat_symbols && hasFileFormatEncodingPart | ||
596 | let w:airline_section_y = ' %{&fenc . " " . WebDevIconsGetFileFormatSymbol()} ' | ||
597 | endif | ||
598 | endfunction | ||
599 | |||
600 | if g:webdevicons_enable == 1 && exists('g:loaded_airline') && g:loaded_airline == 1 && g:webdevicons_enable_airline_statusline | ||
601 | call airline#add_statusline_func('AirlineWebDevIcons') | ||
602 | endif | ||
603 | |||
604 | if g:webdevicons_enable == 1 && g:webdevicons_enable_airline_tabline | ||
605 | " Store original formatter. | ||
606 | let g:_webdevicons_airline_orig_formatter = get(g:, 'airline#extensions#tabline#formatter', 'default') | ||
607 | let g:airline#extensions#tabline#formatter = 'webdevicons' | ||
608 | endif | ||
609 | |||
610 | " for nerdtree plugin {{{3 | ||
611 | "======================================================================== | ||
612 | |||
613 | " scope: public | ||
614 | function! NERDTreeWebDevIconsRefreshListener(event) | ||
615 | let path = a:event.subject | ||
616 | let postPadding = g:WebDevIconsNerdTreeAfterGlyphPadding | ||
617 | let prePadding = g:WebDevIconsNerdTreeBeforeGlyphPadding | ||
618 | let hasGitFlags = (len(path.flagSet._flagsForScope('git')) > 0) | ||
619 | let hasGitNerdTreePlugin = (exists('g:loaded_nerdtree_git_status') == 1) | ||
620 | let artifactFix = s:DevIconsGetArtifactFix() | ||
621 | |||
622 | " align vertically at the same level: non git-flag nodes with git-flag nodes | ||
623 | if g:WebDevIconsNerdTreeGitPluginForceVAlign && !hasGitFlags && hasGitNerdTreePlugin | ||
624 | let prePadding .= ' ' | ||
625 | endif | ||
626 | |||
627 | if !path.isDirectory | ||
628 | " Hey we got a regular file, lets get it's proper icon | ||
629 | let flag = prePadding . WebDevIconsGetFileTypeSymbol(path.str()) . postPadding | ||
630 | |||
631 | elseif path.isDirectory && g:WebDevIconsUnicodeDecorateFolderNodes == 1 | ||
632 | " Ok we got a directory, some more tests and checks | ||
633 | let directoryOpened = 0 | ||
634 | |||
635 | if g:DevIconsEnableFoldersOpenClose && len(path.flagSet._flagsForScope('webdevicons')) > 0 | ||
636 | " did the user set different icons for open and close? | ||
637 | |||
638 | " isOpen is not available on the path listener directly | ||
639 | " but we added one via overriding particular keymappings for NERDTree | ||
640 | if has_key(path, 'isOpen') && path.isOpen == 1 | ||
641 | let directoryOpened = 1 | ||
642 | endif | ||
643 | endif | ||
644 | |||
645 | if g:WebDevIconsUnicodeDecorateFolderNodesExactMatches == 1 | ||
646 | " Did the user enable exact matching of folder type/names | ||
647 | " think node_modules | ||
648 | if g:DevIconsEnableFoldersOpenClose && directoryOpened | ||
649 | " the folder is open | ||
650 | let flag = prePadding . g:DevIconsDefaultFolderOpenSymbol . artifactFix . postPadding | ||
651 | else | ||
652 | " the folder is not open | ||
653 | if path.isSymLink | ||
654 | " We have a symlink | ||
655 | let flag = prePadding . g:WebDevIconsUnicodeDecorateFolderNodesSymlinkSymbol . artifactFix . postPadding | ||
656 | else | ||
657 | " We have a regular folder | ||
658 | let flag = prePadding . WebDevIconsGetFileTypeSymbol(path.str(), path.isDirectory) . postPadding | ||
659 | endif | ||
660 | endif | ||
661 | |||
662 | else | ||
663 | " the user did not enable exact matching | ||
664 | if g:DevIconsEnableFoldersOpenClose && directoryOpened | ||
665 | " the folder is open | ||
666 | let flag = prePadding . g:DevIconsDefaultFolderOpenSymbol . artifactFix . postPadding | ||
667 | else | ||
668 | " the folder is not open | ||
669 | if path.isSymLink | ||
670 | " We have a symlink | ||
671 | let flag = prePadding . g:WebDevIconsUnicodeDecorateFolderNodesSymlinkSymbol . artifactFix . postPadding | ||
672 | else | ||
673 | " We have a regular folder | ||
674 | let flag = prePadding . g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol . artifactFix . postPadding | ||
675 | endif | ||
676 | endif | ||
677 | |||
678 | endif | ||
679 | |||
680 | else | ||
681 | let flag = prePadding . ' ' . artifactFix . postPadding | ||
682 | endif | ||
683 | |||
684 | call path.flagSet.clearFlags('webdevicons') | ||
685 | |||
686 | if flag !=? '' | ||
687 | call path.flagSet.addFlag('webdevicons', flag) | ||
688 | endif | ||
689 | |||
690 | endfunction | ||
691 | |||
692 | " call setup after processing all the functions (to avoid errors) {{{1 | ||
693 | "======================================================================== | ||
694 | " had some issues with VimEnter, for now using: | ||
695 | call s:initialize() | ||
696 | |||
697 | " standard fix/safety: line continuation (avoiding side effects) {{{1 | ||
698 | "======================================================================== | ||
699 | let &cpo = s:save_cpo | ||
700 | unlet s:save_cpo | ||
701 | |||
702 | " modeline syntax: | ||
703 | " vim: fdm=marker tabstop=2 softtabstop=2 shiftwidth=2 expandtab: | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/pythonx/vim_devicons/__init__.py b/.vim/pack/vendor/start/vim-devicons/pythonx/vim_devicons/__init__.py new file mode 100644 index 0000000..ece379c --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/pythonx/vim_devicons/__init__.py | |||
@@ -0,0 +1,2 @@ | |||
1 | import pkg_resources | ||
2 | pkg_resources.declare_namespace(__name__) | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/pythonx/vim_devicons/powerline/__init__.py b/.vim/pack/vendor/start/vim-devicons/pythonx/vim_devicons/powerline/__init__.py new file mode 100644 index 0000000..ece379c --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/pythonx/vim_devicons/powerline/__init__.py | |||
@@ -0,0 +1,2 @@ | |||
1 | import pkg_resources | ||
2 | pkg_resources.declare_namespace(__name__) | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/pythonx/vim_devicons/powerline/segments.py b/.vim/pack/vendor/start/vim-devicons/pythonx/vim_devicons/powerline/segments.py new file mode 100644 index 0000000..f92f4ee --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/pythonx/vim_devicons/powerline/segments.py | |||
@@ -0,0 +1,28 @@ | |||
1 | # -*- coding: utf-8 -*- | ||
2 | # vim:se fenc=utf8 noet: | ||
3 | from __future__ import (unicode_literals, division, absolute_import, print_function) | ||
4 | |||
5 | try: | ||
6 | import vim | ||
7 | except ImportError: | ||
8 | vim = {} | ||
9 | |||
10 | from powerline.bindings.vim import (vim_get_func, buffer_name) | ||
11 | from powerline.theme import requires_segment_info | ||
12 | |||
13 | @requires_segment_info | ||
14 | def webdevicons(pl, segment_info): | ||
15 | webdevicons = vim_get_func('WebDevIconsGetFileTypeSymbol') | ||
16 | name = buffer_name(segment_info) | ||
17 | return [] if not webdevicons else [{ | ||
18 | 'contents': webdevicons(name), | ||
19 | 'highlight_groups': ['webdevicons', 'file_name'], | ||
20 | }] | ||
21 | |||
22 | @requires_segment_info | ||
23 | def webdevicons_file_format(pl, segment_info): | ||
24 | webdevicons_file_format = vim_get_func('WebDevIconsGetFileFormatSymbol') | ||
25 | return [] if not webdevicons_file_format else [{ | ||
26 | 'contents': webdevicons_file_format(), | ||
27 | 'highlight_groups': ['webdevicons_file_format', 'file_format'], | ||
28 | }] | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/rplugin/python3/denite/filter/devicons_denite_converter.py b/.vim/pack/vendor/start/vim-devicons/rplugin/python3/denite/filter/devicons_denite_converter.py new file mode 100644 index 0000000..6768009 --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/rplugin/python3/denite/filter/devicons_denite_converter.py | |||
@@ -0,0 +1,31 @@ | |||
1 | # -*- coding: utf-8 -*- | ||
2 | # vim:se fenc=utf8 noet: | ||
3 | from .base import Base | ||
4 | from os.path import isdir | ||
5 | |||
6 | |||
7 | class Filter(Base): | ||
8 | |||
9 | def __init__(self, vim): | ||
10 | super().__init__(vim) | ||
11 | self.name = 'devicons_denite_converter' | ||
12 | self.description = 'add devicons in front of candidates' | ||
13 | |||
14 | def filter(self, context): | ||
15 | for candidate in context['candidates']: | ||
16 | |||
17 | if 'bufnr' in candidate: | ||
18 | bufname = self.vim.funcs.bufname(candidate['bufnr']) | ||
19 | filename = self.vim.funcs.fnamemodify(bufname, ':p:t') | ||
20 | elif 'word' in candidate and 'action__path' in candidate: | ||
21 | filename = candidate['word'] | ||
22 | |||
23 | icon = self.vim.funcs.WebDevIconsGetFileTypeSymbol( | ||
24 | filename, isdir(filename)) | ||
25 | |||
26 | # Customize output format if not done already. | ||
27 | if icon not in candidate.get('abbr', '')[:10]: | ||
28 | candidate['abbr'] = ' {} {}'.format( | ||
29 | icon, candidate.get('abbr', candidate['word'])) | ||
30 | |||
31 | return context['candidates'] | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/test/.themisrc b/.vim/pack/vendor/start/vim-devicons/test/.themisrc new file mode 100644 index 0000000..f59497a --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/test/.themisrc | |||
@@ -0,0 +1 @@ | |||
filetype plugin on | |||
diff --git a/.vim/pack/vendor/start/vim-devicons/test/default_setting.vim b/.vim/pack/vendor/start/vim-devicons/test/default_setting.vim new file mode 100644 index 0000000..b379948 --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/test/default_setting.vim | |||
@@ -0,0 +1,39 @@ | |||
1 | scriptencoding utf-8 | ||
2 | |||
3 | let s:suite = themis#suite('Webdevicons-default-value') | ||
4 | let s:assert = themis#helper('assert') | ||
5 | |||
6 | function! s:suite.ExtensionConfig() | ||
7 | call s:assert.equals(g:webdevicons_enable, 1) | ||
8 | call s:assert.equals(g:webdevicons_enable_nerdtree, 1) | ||
9 | call s:assert.equals(g:webdevicons_enable_unite, 1) | ||
10 | call s:assert.equals(g:webdevicons_enable_denite, 1) | ||
11 | call s:assert.equals(g:webdevicons_enable_vimfiler, 1) | ||
12 | call s:assert.equals(g:webdevicons_enable_ctrlp, 1) | ||
13 | call s:assert.equals(g:webdevicons_enable_airline_tabline, 1) | ||
14 | call s:assert.equals(g:webdevicons_enable_airline_statusline, 1) | ||
15 | call s:assert.equals(g:webdevicons_enable_airline_statusline_fileformat_symbols, 1) | ||
16 | call s:assert.equals(g:webdevicons_enable_flagship_statusline, 1) | ||
17 | call s:assert.equals(g:webdevicons_enable_flagship_statusline_fileformat_symbols, 1) | ||
18 | call s:assert.equals(g:webdevicons_enable_startify, 1) | ||
19 | call s:assert.equals(g:webdevicons_conceal_nerdtree_brackets, 1) | ||
20 | endfunction | ||
21 | |||
22 | function! s:suite.ConfigOptions() | ||
23 | call s:assert.equals(g:DevIconsAppendArtifactFix, 0) | ||
24 | call s:assert.equals(g:DevIconsArtifactFixChar, ' ') | ||
25 | call s:assert.equals(g:WebDevIconsUnicodeDecorateFileNodes, 1) | ||
26 | call s:assert.equals(g:WebDevIconsUnicodeDecorateFolderNodes, 1) | ||
27 | call s:assert.equals(g:DevIconsEnableFoldersOpenClose, 0) | ||
28 | call s:assert.equals(g:DevIconsEnableFolderPatternMatching, 1) | ||
29 | call s:assert.equals(g:DevIconsEnableFolderExtensionPatternMatching, 0) | ||
30 | call s:assert.equals(1, g:WebDevIconsUnicodeDecorateFolderNodesExactMatches, 1) | ||
31 | call s:assert.equals(1, g:WebDevIconsUnicodeGlyphDoubleWidth, 1) | ||
32 | call s:assert.equals(g:WebDevIconsNerdTreeBeforeGlyphPadding, ' ') | ||
33 | call s:assert.equals(g:WebDevIconsNerdTreeAfterGlyphPadding, ' ') | ||
34 | call s:assert.equals(g:WebDevIconsNerdTreeGitPluginForceVAlign, 1) | ||
35 | call s:assert.equals(g:NERDTreeUpdateOnCursorHold, 1) " Obsolete: for backward compatibility | ||
36 | call s:assert.equals(g:NERDTreeGitStatusUpdateOnCursorHold, 1) | ||
37 | call s:assert.equals(g:WebDevIconsTabAirLineBeforeGlyphPadding, ' ') | ||
38 | call s:assert.equals(g:WebDevIconsTabAirLineAfterGlyphPadding, '') | ||
39 | endfunction | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/test/fileformat.vim b/.vim/pack/vendor/start/vim-devicons/test/fileformat.vim new file mode 100644 index 0000000..170a27b --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/test/fileformat.vim | |||
@@ -0,0 +1,29 @@ | |||
1 | scriptencoding utf-8 | ||
2 | |||
3 | " Please use nerd-font if you watch icon-font | ||
4 | |||
5 | let s:suite = themis#suite('WebDevIconsGetFileFormatSymbol') | ||
6 | let s:assert = themis#helper('assert') | ||
7 | |||
8 | function! s:suite.UnixIcon() | ||
9 | set fileformat=unix | ||
10 | let os = system('uname -a') | ||
11 | if os =~# 'Darwin' | ||
12 | call s:assert.equals(WebDevIconsGetFileFormatSymbol(), '') | ||
13 | " It may return Ubuntu because github-actions's OS is Ubuntu | ||
14 | elseif os =~# 'Ubuntu' | ||
15 | call s:assert.equals(WebDevIconsGetFileFormatSymbol(), '') | ||
16 | else | ||
17 | call s:assert.skip('Skip testing except for Ubuntu and Mac.') | ||
18 | endif | ||
19 | endfunction | ||
20 | |||
21 | function! s:suite.WindowsIcon() | ||
22 | set fileformat=dos | ||
23 | call s:assert.equals(WebDevIconsGetFileFormatSymbol(), '') | ||
24 | endfunction | ||
25 | |||
26 | function! s:suite.MacIcon() | ||
27 | set fileformat=mac | ||
28 | call s:assert.equals(WebDevIconsGetFileFormatSymbol(), '') | ||
29 | endfunction | ||
diff --git a/.vim/pack/vendor/start/vim-devicons/test/filetype.vim b/.vim/pack/vendor/start/vim-devicons/test/filetype.vim new file mode 100644 index 0000000..3669ad9 --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/test/filetype.vim | |||
@@ -0,0 +1,344 @@ | |||
1 | scriptencoding utf-8 | ||
2 | |||
3 | " Please use nerd-font if you watch icon-font | ||
4 | |||
5 | let s:suite = themis#suite('WebDevIconsGetFileTypeSymbol') | ||
6 | let s:assert = themis#helper('assert') | ||
7 | |||
8 | function! s:Assert(filename, icon) | ||
9 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(a:filename), a:icon) | ||
10 | endfunction | ||
11 | |||
12 | function! s:suite.NoArgument_GetDefaultIcon() | ||
13 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(), '') | ||
14 | endfunction | ||
15 | |||
16 | function! s:suite.__OneArgument_VimIcon__() | ||
17 | let targetfilenames = ['.vimrc', 'vimrc', '.gvimrc', '_gvimrc', 'test.vim'] | ||
18 | let expecticon = '' | ||
19 | let child = themis#suite('OneArgument_VimIcon') | ||
20 | |||
21 | for targetfilename in targetfilenames | ||
22 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
23 | endfor | ||
24 | endfunction | ||
25 | |||
26 | function! s:suite.__OneArgument_RubyIcon__() | ||
27 | let targetfilenames = ['test.rb', 'rakefile', 'RAKEFILE', 'Gemfile', 'config.ru'] | ||
28 | let expecticon = '' | ||
29 | let child = themis#suite('OneArgument_RubyIcon') | ||
30 | |||
31 | for targetfilename in targetfilenames | ||
32 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
33 | endfor | ||
34 | endfunction | ||
35 | |||
36 | function! s:suite.__OneArgument_MarkDownIcon__() | ||
37 | let targetfilenames = ['test.md', 'test.markdown', 'test.mdx', 'test.rmd'] | ||
38 | let expecticon = '' | ||
39 | let child = themis#suite('OneArgument_MarkDownIcon') | ||
40 | |||
41 | for targetfilename in targetfilenames | ||
42 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
43 | endfor | ||
44 | endfunction | ||
45 | |||
46 | function! s:suite.__OneArgument_PythonIcon__() | ||
47 | let targetfilenames = ['test.py', 'test.pyc', 'test.pyo', 'test.pyd'] | ||
48 | let expecticon = '' | ||
49 | let child = themis#suite('OneArgument_PythonIcon') | ||
50 | |||
51 | for targetfilename in targetfilenames | ||
52 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
53 | endfor | ||
54 | endfunction | ||
55 | |||
56 | function! s:suite.__OneArgument_ShellIcon__() | ||
57 | let targetfilenames = ['test.sh', 'test.fish', 'test.bash', 'test.ksh', 'test.csh', 'test.awk', 'test.ps1'] | ||
58 | let expecticon = '' | ||
59 | let child = themis#suite('OneArgument_ShellIcon') | ||
60 | |||
61 | for targetfilename in targetfilenames | ||
62 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
63 | endfor | ||
64 | endfunction | ||
65 | |||
66 | function! s:suite.__OneArgument_DBIcon__() | ||
67 | let targetfilenames = ['test.db', 'test.sql', 'test.dump'] | ||
68 | let expecticon = '' | ||
69 | let child = themis#suite('OneArgument_DBIcon') | ||
70 | |||
71 | for targetfilename in targetfilenames | ||
72 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
73 | endfor | ||
74 | endfunction | ||
75 | |||
76 | function! s:suite.__OneArgument_RustIcon__() | ||
77 | let targetfilenames = ['test.rs', 'test.rlib'] | ||
78 | let expecticon = '' | ||
79 | let child = themis#suite('OneArgument_RustIcon') | ||
80 | |||
81 | for targetfilename in targetfilenames | ||
82 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
83 | endfor | ||
84 | endfunction | ||
85 | |||
86 | function! s:suite.__OneArgument_DockerIcon__() | ||
87 | let targetfilenames = ['Dockerfile', 'docker-compose.yml'] | ||
88 | let expecticon = '' | ||
89 | let child = themis#suite('OneArgument_DockerIcon') | ||
90 | |||
91 | for targetfilename in targetfilenames | ||
92 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
93 | endfor | ||
94 | endfunction | ||
95 | |||
96 | function! s:suite.__OneArgument_JavaScriptIcon__() | ||
97 | let targetfilenames = ['test.js', 'test.mjs'] | ||
98 | let expecticon = '' | ||
99 | let child = themis#suite('OneArgument_JavaScriptIcon') | ||
100 | |||
101 | for targetfilename in targetfilenames | ||
102 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
103 | endfor | ||
104 | endfunction | ||
105 | |||
106 | function! s:suite.__OneArgument_ReactIcon__() | ||
107 | let targetfilenames = ['test.jsx', 'test.tsx', 'react.jsx'] | ||
108 | let expecticon = '' | ||
109 | let child = themis#suite('OneArgument_ReactIcon') | ||
110 | |||
111 | for targetfilename in targetfilenames | ||
112 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
113 | endfor | ||
114 | endfunction | ||
115 | |||
116 | function! s:suite.__OneArgument_JsonIcon__() | ||
117 | let targetfilenames = ['test.json', 'test.webmanifest'] | ||
118 | let expecticon = '' | ||
119 | let child = themis#suite('OneArgument_JsonIcon') | ||
120 | |||
121 | for targetfilename in targetfilenames | ||
122 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
123 | endfor | ||
124 | endfunction | ||
125 | |||
126 | function! s:suite.__OneArgument_GearIcon__() | ||
127 | let targetfilenames = ['.DS_Store', 'Makefile', 'test.mk', '.bashrc', '.zshrc', '.gitignore', '.gitattributes', 'cmakelists.txt', 'test.yaml', 'test.yml', 'test.toml', 'test.bat'] | ||
128 | let expecticon = '' | ||
129 | let child = themis#suite('OneArgument_GearIcon') | ||
130 | |||
131 | for targetfilename in targetfilenames | ||
132 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
133 | endfor | ||
134 | endfunction | ||
135 | |||
136 | function! s:suite.__OneArgument_ErlangIcon__() | ||
137 | let targetfilenames = ['test.erl', 'test.hrl'] | ||
138 | let expecticon = '' | ||
139 | let child = themis#suite('OneArgument_ErlangIcon') | ||
140 | |||
141 | for targetfilename in targetfilenames | ||
142 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
143 | endfor | ||
144 | endfunction | ||
145 | |||
146 | function! s:suite.__OneArgument_SwiftIcon__() | ||
147 | let targetfilenames = ['test.swift', 'test.xcplayground'] | ||
148 | let expecticon = '' | ||
149 | let child = themis#suite('OneArgument_SwiftIcon') | ||
150 | |||
151 | for targetfilename in targetfilenames | ||
152 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
153 | endfor | ||
154 | endfunction | ||
155 | |||
156 | function! s:suite.__OneArgument_HaskellIcon__() | ||
157 | let targetfilenames = ['test.hs', 'test.lhs'] | ||
158 | let expecticon = '' | ||
159 | let child = themis#suite('OneArgument_HaskellIcon') | ||
160 | |||
161 | for targetfilename in targetfilenames | ||
162 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
163 | endfor | ||
164 | endfunction | ||
165 | |||
166 | function! s:suite.__OneArgument_CppIcon__() | ||
167 | let targetfilenames = ['test.cpp', 'test.c++', 'test.cp', 'test.cxx', 'test.cc'] | ||
168 | let expecticon = '' | ||
169 | let child = themis#suite('OneArgument_C++Icon') | ||
170 | |||
171 | for targetfilename in targetfilenames | ||
172 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
173 | endfor | ||
174 | endfunction | ||
175 | |||
176 | function! s:suite.__OneArgument_ElixirIcon__() | ||
177 | let targetfilenames = ['test.ex', 'test.exs', 'test.eex', 'test.leex', 'test.heex'] | ||
178 | let expecticon = '' | ||
179 | let child = themis#suite('OneArgument_ElixirIcon') | ||
180 | |||
181 | for targetfilename in targetfilenames | ||
182 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
183 | endfor | ||
184 | endfunction | ||
185 | |||
186 | function! s:suite.__OneArgument_PerlIcon__() | ||
187 | let targetfilenames = ['test.pl', 'test.pm', 'test.t'] | ||
188 | let expecticon = '' | ||
189 | let child = themis#suite('OneArgument_PerlIcon') | ||
190 | |||
191 | for targetfilename in targetfilenames | ||
192 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
193 | endfor | ||
194 | endfunction | ||
195 | |||
196 | function! s:suite.__OneArgument_FSharpIcon__() | ||
197 | let targetfilenames = ['test.fs', 'test.fsx', 'test.fsi', 'test.fsscript'] | ||
198 | let expecticon = '' | ||
199 | let child = themis#suite('OneArgument_FSharpIcon') | ||
200 | |||
201 | for targetfilename in targetfilenames | ||
202 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) | ||
203 | endfor | ||
204 | endfunction | ||
205 | |||
206 | function! s:suite.OneArgument_GetTypeScriptIcon() | ||
207 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.ts'), '') | ||
208 | endfunction | ||
209 | |||
210 | function! s:suite.OneArgument_GetVueIcon() | ||
211 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.vue'), '﵂') | ||
212 | endfunction | ||
213 | |||
214 | function! s:suite.OneArgument_GetNodeModuleIcon() | ||
215 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('node_modules'), '') | ||
216 | endfunction | ||
217 | |||
218 | function! s:suite.OneArgument_GetDropboxIcon() | ||
219 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('Dropbox'), '') | ||
220 | endfunction | ||
221 | |||
222 | function! s:suite.OneArgument_GetRIcon() | ||
223 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.r'), 'ﳒ') | ||
224 | endfunction | ||
225 | |||
226 | function! s:suite.OneArgument_GetLuaIcon() | ||
227 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.lua'), '') | ||
228 | endfunction | ||
229 | |||
230 | function! s:suite.OneArgument_GetJavaIcon() | ||
231 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.java'), '') | ||
232 | endfunction | ||
233 | |||
234 | function! s:suite.OneArgument_GetCIcon() | ||
235 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.c'), '') | ||
236 | endfunction | ||
237 | |||
238 | function! s:suite.OneArgument_GetCSSIcon() | ||
239 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.cs'), '') | ||
240 | endfunction | ||
241 | |||
242 | function! s:suite.OneArgument_GetCSharpIcon() | ||
243 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.cs'), '') | ||
244 | endfunction | ||
245 | |||
246 | function! s:suite.OneArgument_GetElmIcon() | ||
247 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.elm'), '') | ||
248 | endfunction | ||
249 | |||
250 | function! s:suite.OneArgument_GetRssIcon() | ||
251 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.rss'), '') | ||
252 | endfunction | ||
253 | |||
254 | function! s:suite.OneArgument_GetDartIcon() | ||
255 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.dart'), '') | ||
256 | endfunction | ||
257 | |||
258 | function! s:suite.OneArgument_GetSolidityIcon() | ||
259 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.sol'), 'ﲹ') | ||
260 | endfunction | ||
261 | |||
262 | function! s:suite.OneArgument_GetGoIcon() | ||
263 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.go'), '') | ||
264 | endfunction | ||
265 | |||
266 | function! s:suite.OneArgument_GetPhpIcon() | ||
267 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.php'),'') | ||
268 | endfunction | ||
269 | |||
270 | function! s:suite.OneArgument_GetScalaIcon() | ||
271 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('test.scala'), '') | ||
272 | endfunction | ||
273 | |||
274 | function! s:suite.OneArgument_GetTexIcon() | ||
275 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('test.tex'), 'ﭨ') | ||
276 | endfunction | ||
277 | |||
278 | function! s:suite.OneArgument_GetLicenseIcon() | ||
279 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('LICENSE'), '') | ||
280 | endfunction | ||
281 | |||
282 | function! s:suite.OneArgument_GetRobotIcon() | ||
283 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('robots.txt'), 'ﮧ') | ||
284 | endfunction | ||
285 | |||
286 | function! s:suite.OneArgument_PemIcon() | ||
287 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('test.pem'), '') | ||
288 | endfunction | ||
289 | |||
290 | function! s:suite.TwoArgument_zero_GetFileIcon() | ||
291 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('test.vim', 0), '') | ||
292 | endfunction | ||
293 | |||
294 | function! s:suite.TwoArgument_one_GetFolderIcon() | ||
295 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('test.vim', 1), '') | ||
296 | endfunction | ||
297 | |||
298 | function! s:suite.TwoArgument_two_GetDefaultIcon() | ||
299 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('test.vim', 2), '') | ||
300 | endfunction | ||
301 | |||
302 | function! s:suite.TwoArgument_string_GetFileTypeIcon() | ||
303 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('test.php', 'test.vim'), '') | ||
304 | endfunction | ||
305 | |||
306 | function! s:suite.NoArgument_OverWriteFileType_GetVimIcon() | ||
307 | set ft=vim | ||
308 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(), '') | ||
309 | endfunction | ||
310 | |||
311 | function! s:suite.NoArgument_EditVimFile_GetVimIcon() | ||
312 | edit! test.vim | ||
313 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(), '') | ||
314 | endfunction | ||
315 | |||
316 | function! s:suite.NoArgument_Editvimrc_GetVimIcon() | ||
317 | edit! vimrc | ||
318 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(), '') | ||
319 | endfunction | ||
320 | |||
321 | function! s:suite.NoArgument_EditPythonFile_GetPythonIcon() | ||
322 | edit! test.py | ||
323 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(), '') | ||
324 | endfunction | ||
325 | |||
326 | function! s:suite.NoArgument_EditjavaScriptFile_GetjavaScriptIcon() | ||
327 | edit! test.js | ||
328 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(), '') | ||
329 | endfunction | ||
330 | |||
331 | function! s:suite.NoArgument_EditRustFile_GetRustIcon() | ||
332 | edit! test.rs | ||
333 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(), '') | ||
334 | endfunction | ||
335 | |||
336 | function! s:suite.NoArgument_EditMKFile_GetGearIcon() | ||
337 | edit! test.mk | ||
338 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(), '') | ||
339 | endfunction | ||
340 | |||
341 | function! s:suite.OneArgument_EditPythonFile_GetRubyIcon() | ||
342 | edit! test.py | ||
343 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.rb'), '') | ||
344 | endfunction | ||