summaryrefslogtreecommitdiff
path: root/.vim/pack/vendor/start/nerdtree/plugin
diff options
context:
space:
mode:
authorSam Chudnick <sam@chudnick.com>2023-06-11 07:54:59 -0400
committerSam Chudnick <sam@chudnick.com>2023-06-11 07:54:59 -0400
commit3adcf542289a0883924ae9b9be8b898c36702c95 (patch)
treef02166ef4c95161ffa994eb1a3e5729c93c2c66b /.vim/pack/vendor/start/nerdtree/plugin
parentdfcc303e7cc284a45f55bae81ed888dc256432b8 (diff)
Add some Vim plugins
Diffstat (limited to '.vim/pack/vendor/start/nerdtree/plugin')
-rw-r--r--.vim/pack/vendor/start/nerdtree/plugin/NERD_tree.vim234
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"============================================================
14scriptencoding utf-8
15
16if exists('loaded_nerd_tree')
17 finish
18endif
19if v:version < 703
20 echoerr "NERDTree: this plugin requires vim >= 7.3. DOWNLOAD IT! You'll thank me later!"
21 finish
22endif
23let loaded_nerd_tree = 1
24
25"for line continuation - i.e dont want C in &cpoptions
26let s:old_cpo = &cpoptions
27set cpoptions&vim
28
29"SECTION: Initialize variable calls and other random constants {{{2
30let g:NERDTreeAutoCenter = get(g:, 'NERDTreeAutoCenter', 1)
31let g:NERDTreeAutoCenterThreshold = get(g:, 'NERDTreeAutoCenterThreshold', 3)
32let g:NERDTreeCaseSensitiveSort = get(g:, 'NERDTreeCaseSensitiveSort', 0)
33let g:NERDTreeNaturalSort = get(g:, 'NERDTreeNaturalSort', 0)
34let g:NERDTreeSortHiddenFirst = get(g:, 'NERDTreeSortHiddenFirst', 1)
35let g:NERDTreeUseTCD = get(g:, 'NERDTreeUseTCD', 0)
36let g:NERDTreeChDirMode = get(g:, 'NERDTreeChDirMode', 0)
37let g:NERDTreeCreatePrefix = get(g:, 'NERDTreeCreatePrefix', 'silent')
38let g:NERDTreeMinimalUI = get(g:, 'NERDTreeMinimalUI', 0)
39let g:NERDTreeMinimalMenu = get(g:, 'NERDTreeMinimalMenu', 0)
40let g:NERDTreeIgnore = get(g:, 'NERDTreeIgnore', ['\~$'])
41let g:NERDTreeBookmarksFile = get(g:, 'NERDTreeBookmarksFile', expand('$HOME') . '/.NERDTreeBookmarks')
42let g:NERDTreeBookmarksSort = get(g:, 'NERDTreeBookmarksSort', 1)
43let g:NERDTreeHighlightCursorline = get(g:, 'NERDTreeHighlightCursorline', 1)
44let g:NERDTreeHijackNetrw = get(g:, 'NERDTreeHijackNetrw', 1)
45let g:NERDTreeMarkBookmarks = get(g:, 'NERDTreeMarkBookmarks', 1)
46let g:NERDTreeMouseMode = get(g:, 'NERDTreeMouseMode', 1)
47let g:NERDTreeNotificationThreshold = get(g:, 'NERDTreeNotificationThreshold', 100)
48let g:NERDTreeQuitOnOpen = get(g:, 'NERDTreeQuitOnOpen', 0)
49let g:NERDTreeRespectWildIgnore = get(g:, 'NERDTreeRespectWildIgnore', 0)
50let g:NERDTreeShowBookmarks = get(g:, 'NERDTreeShowBookmarks', 0)
51let g:NERDTreeShowFiles = get(g:, 'NERDTreeShowFiles', 1)
52let g:NERDTreeShowHidden = get(g:, 'NERDTreeShowHidden', 0)
53let g:NERDTreeShowLineNumbers = get(g:, 'NERDTreeShowLineNumbers', 0)
54let g:NERDTreeSortDirs = get(g:, 'NERDTreeSortDirs', 1)
55
56if !nerdtree#runningWindows() && !nerdtree#runningCygwin()
57 let g:NERDTreeDirArrowExpandable = get(g:, 'NERDTreeDirArrowExpandable', '▸')
58 let g:NERDTreeDirArrowCollapsible = get(g:, 'NERDTreeDirArrowCollapsible', '▾')
59else
60 let g:NERDTreeDirArrowExpandable = get(g:, 'NERDTreeDirArrowExpandable', '+')
61 let g:NERDTreeDirArrowCollapsible = get(g:, 'NERDTreeDirArrowCollapsible', '~')
62endif
63
64let g:NERDTreeCascadeOpenSingleChildDir = get(g:, 'NERDTreeCascadeOpenSingleChildDir', 1)
65let g:NERDTreeCascadeSingleChildDir = get(g:, 'NERDTreeCascadeSingleChildDir', 1)
66
67let g:NERDTreeSortOrder = get(g:, 'NERDTreeSortOrder', ['\/$', '*', '\.swp$', '\.bak$', '\~$'])
68let g:NERDTreeOldSortOrder = []
69
70let g:NERDTreeGlyphReadOnly = get(g:, 'NERDTreeGlyphReadOnly', 'RO')
71
72if has('conceal')
73 let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\x07")
74elseif (g:NERDTreeDirArrowExpandable ==# "\u00a0" || g:NERDTreeDirArrowCollapsible ==# "\u00a0")
75 let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\u00b7")
76else
77 let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\u00a0")
78endif
79
80"the exists() crap here is a hack to stop vim spazzing out when
81"loading a session that was created with an open nerd tree. It spazzes
82"because it doesnt store b:NERDTree(its a b: var, and its a hash)
83let g:NERDTreeStatusline = get(g:, 'NERDTreeStatusline', "%{exists('b:NERDTree')?b:NERDTree.root.path.str():''}")
84
85let g:NERDTreeWinPos = get(g:, 'NERDTreeWinPos', 'left')
86let g:NERDTreeWinSize = get(g:, 'NERDTreeWinSize', 31)
87
88"init the shell commands that will be used to copy nodes, and remove dir trees
89"Note: the space after the command is important
90if nerdtree#runningWindows()
91 let g:NERDTreeRemoveDirCmd = get(g:, 'NERDTreeRemoveDirCmd', 'rmdir /s /q ')
92 let g:NERDTreeCopyDirCmd = get(g:, 'NERDTreeCopyDirCmd', 'xcopy /s /e /i /y /q ')
93 let g:NERDTreeCopyFileCmd = get(g:, 'NERDTreeCopyFileCmd', 'copy /y ')
94else
95 let g:NERDTreeRemoveDirCmd = get(g:, 'NERDTreeRemoveDirCmd', 'rm -rf ')
96 let g:NERDTreeCopyCmd = get(g:, 'NERDTreeCopyCmd', 'cp -r ')
97endif
98
99"SECTION: Init variable calls for key mappings {{{2
100let g:NERDTreeMapCustomOpen = get(g:, 'NERDTreeMapCustomOpen', '<CR>')
101let g:NERDTreeMapActivateNode = get(g:, 'NERDTreeMapActivateNode', 'o')
102let g:NERDTreeMapChangeRoot = get(g:, 'NERDTreeMapChangeRoot', 'C')
103let g:NERDTreeMapChdir = get(g:, 'NERDTreeMapChdir', 'cd')
104let g:NERDTreeMapCloseChildren = get(g:, 'NERDTreeMapCloseChildren', 'X')
105let g:NERDTreeMapCloseDir = get(g:, 'NERDTreeMapCloseDir', 'x')
106let g:NERDTreeMapDeleteBookmark = get(g:, 'NERDTreeMapDeleteBookmark', 'D')
107let g:NERDTreeMapMenu = get(g:, 'NERDTreeMapMenu', 'm')
108let g:NERDTreeMapHelp = get(g:, 'NERDTreeMapHelp', '?')
109let g:NERDTreeMapJumpFirstChild = get(g:, 'NERDTreeMapJumpFirstChild', 'K')
110let g:NERDTreeMapJumpLastChild = get(g:, 'NERDTreeMapJumpLastChild', 'J')
111let g:NERDTreeMapJumpNextSibling = get(g:, 'NERDTreeMapJumpNextSibling', '<C-j>')
112let g:NERDTreeMapJumpParent = get(g:, 'NERDTreeMapJumpParent', 'p')
113let g:NERDTreeMapJumpPrevSibling = get(g:, 'NERDTreeMapJumpPrevSibling', '<C-k>')
114let g:NERDTreeMapJumpRoot = get(g:, 'NERDTreeMapJumpRoot', 'P')
115let g:NERDTreeMapOpenExpl = get(g:, 'NERDTreeMapOpenExpl', 'e')
116let g:NERDTreeMapOpenInTab = get(g:, 'NERDTreeMapOpenInTab', 't')
117let g:NERDTreeMapOpenInTabSilent = get(g:, 'NERDTreeMapOpenInTabSilent', 'T')
118let g:NERDTreeMapOpenRecursively = get(g:, 'NERDTreeMapOpenRecursively', 'O')
119let g:NERDTreeMapOpenSplit = get(g:, 'NERDTreeMapOpenSplit', 'i')
120let g:NERDTreeMapOpenVSplit = get(g:, 'NERDTreeMapOpenVSplit', 's')
121let g:NERDTreeMapPreview = get(g:, 'NERDTreeMapPreview', 'g'.NERDTreeMapActivateNode)
122let g:NERDTreeMapPreviewSplit = get(g:, 'NERDTreeMapPreviewSplit', 'g'.NERDTreeMapOpenSplit)
123let g:NERDTreeMapPreviewVSplit = get(g:, 'NERDTreeMapPreviewVSplit', 'g'.NERDTreeMapOpenVSplit)
124let g:NERDTreeMapQuit = get(g:, 'NERDTreeMapQuit', 'q')
125let g:NERDTreeMapRefresh = get(g:, 'NERDTreeMapRefresh', 'r')
126let g:NERDTreeMapRefreshRoot = get(g:, 'NERDTreeMapRefreshRoot', 'R')
127let g:NERDTreeMapToggleBookmarks = get(g:, 'NERDTreeMapToggleBookmarks', 'B')
128let g:NERDTreeMapToggleFiles = get(g:, 'NERDTreeMapToggleFiles', 'F')
129let g:NERDTreeMapToggleFilters = get(g:, 'NERDTreeMapToggleFilters', 'f')
130let g:NERDTreeMapToggleHidden = get(g:, 'NERDTreeMapToggleHidden', 'I')
131let g:NERDTreeMapToggleZoom = get(g:, 'NERDTreeMapToggleZoom', 'A')
132let g:NERDTreeMapUpdir = get(g:, 'NERDTreeMapUpdir', 'u')
133let g:NERDTreeMapUpdirKeepOpen = get(g:, 'NERDTreeMapUpdirKeepOpen', 'U')
134let g:NERDTreeMapCWD = get(g:, 'NERDTreeMapCWD', 'CD')
135let g:NERDTreeMenuDown = get(g:, 'NERDTreeMenuDown', 'j')
136let g:NERDTreeMenuUp = get(g:, 'NERDTreeMenuUp', 'k')
137
138"SECTION: Load class files{{{2
139call nerdtree#loadClassFiles()
140
141" SECTION: Commands {{{1
142"============================================================
143call nerdtree#ui_glue#setupCommands()
144
145" SECTION: Auto commands {{{1
146"============================================================
147augroup NERDTree
148 "Save the cursor position whenever we close the nerd tree
149 exec 'autocmd BufLeave,WinLeave '. g:NERDTreeCreator.BufNamePrefix() .'* if g:NERDTree.IsOpen() | call b:NERDTree.ui.saveScreenState() | endif'
150
151 "disallow insert mode in the NERDTree
152 exec 'autocmd BufEnter,WinEnter '. g:NERDTreeCreator.BufNamePrefix() .'* stopinsert'
153augroup END
154
155if g:NERDTreeHijackNetrw
156 augroup NERDTreeHijackNetrw
157 autocmd VimEnter * silent! autocmd! FileExplorer
158 au BufEnter,VimEnter * call nerdtree#checkForBrowse(expand('<amatch>'))
159 augroup END
160endif
161
162if g:NERDTreeChDirMode ==# 3
163 augroup NERDTreeChDirOnTabSwitch
164 autocmd TabEnter * if g:NERDTree.ExistsForTab()|call g:NERDTree.ForCurrentTab().getRoot().path.changeToDir()|endif
165 augroup END
166endif
167
168" SECTION: Public API {{{1
169"============================================================
170function! NERDTreeAddMenuItem(options)
171 call g:NERDTreeMenuItem.Create(a:options)
172endfunction
173
174function! NERDTreeAddMenuSeparator(...)
175 let opts = a:0 ? a:1 : {}
176 call g:NERDTreeMenuItem.CreateSeparator(opts)
177endfunction
178
179function! NERDTreeAddSubmenu(options)
180 return g:NERDTreeMenuItem.Create(a:options)
181endfunction
182
183function! NERDTreeAddKeyMap(options)
184 call g:NERDTreeKeyMap.Create(a:options)
185endfunction
186
187function! NERDTreeRender()
188 call nerdtree#renderView()
189endfunction
190
191function! NERDTreeFocus()
192 if g:NERDTree.IsOpen()
193 call g:NERDTree.CursorToTreeWin(0)
194 else
195 call g:NERDTreeCreator.ToggleTabTree('')
196 endif
197endfunction
198
199function! NERDTreeCWD()
200
201 if empty(getcwd())
202 call nerdtree#echoWarning('current directory does not exist')
203 return
204 endif
205
206 try
207 let l:cwdPath = g:NERDTreePath.New(getcwd())
208 catch /^NERDTree.InvalidArgumentsError/
209 call nerdtree#echoWarning('current directory does not exist')
210 return
211 endtry
212
213 call NERDTreeFocus()
214
215 if b:NERDTree.root.path.equals(l:cwdPath)
216 return
217 endif
218
219 let l:newRoot = g:NERDTreeFileNode.New(l:cwdPath, b:NERDTree)
220 call b:NERDTree.changeRoot(l:newRoot)
221 normal! ^
222endfunction
223
224function! NERDTreeAddPathFilter(callback)
225 call g:NERDTree.AddPathFilter(a:callback)
226endfunction
227
228" SECTION: Post Source Actions {{{1
229call nerdtree#postSourceActions()
230
231"reset &cpoptions back to users setting
232let &cpoptions = s:old_cpo
233
234" vim: set sw=4 sts=4 et fdm=marker: