diff options
Diffstat (limited to '.vim/pack/vendor/start/nerdtree/plugin')
-rw-r--r-- | .vim/pack/vendor/start/nerdtree/plugin/NERD_tree.vim | 234 |
1 files changed, 234 insertions, 0 deletions
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: | ||