VIM: Reinstall NERDTree
Nerdtree is a rather slow, but extremely useful plugin. So I made the decission to reinstall it, but don't launch it on startup but with a keybinding. Signed-off-by: Tobias Manske <tobias.manske@mailbox.org>
This commit is contained in:
		
							
								
								
									
										3
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							@@ -154,3 +154,6 @@
 | 
			
		||||
[submodule "vim/plugins/vim-window-resize-easy"]
 | 
			
		||||
	path = vim/plugins/vim-window-resize-easy
 | 
			
		||||
	url = https://github.com/roxma/vim-window-resize-easy
 | 
			
		||||
[submodule "vim/plugins/nerdtree"]
 | 
			
		||||
	path = vim/plugins/nerdtree
 | 
			
		||||
	url = https://github.com/scrooloose/nerdtree
 | 
			
		||||
 
 | 
			
		||||
@@ -41,6 +41,19 @@ let g:NERDCommentEmptyLines = 1
 | 
			
		||||
let g:NERDTrimTrailingWhitespace = 1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
" NerdTree
 | 
			
		||||
let NERDTreeMinimalUI = 1
 | 
			
		||||
let g:NERDTreeDirArrowExpandable = '🗀'
 | 
			
		||||
let g:NERDTreeDirArrowCollapsible = '🗁'
 | 
			
		||||
let g:NERDTreeHighlightFolders = 1
 | 
			
		||||
let g:NERDTreeHighlightFoldersFullName = 1
 | 
			
		||||
 | 
			
		||||
" autoclose if nerdtree is last open window
 | 
			
		||||
augroup NERDTree
 | 
			
		||||
	autocmd!
 | 
			
		||||
	autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
 | 
			
		||||
augroup end
 | 
			
		||||
 | 
			
		||||
" PyMode
 | 
			
		||||
let g:pymode_lint = 0
 | 
			
		||||
let g:pymode_syntax = 1
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										28
									
								
								vim/plugins/nerdtree/.github/ISSUE_TEMPLATE.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								vim/plugins/nerdtree/.github/ISSUE_TEMPLATE.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
<!--- To assist in resolving your issue, provide as much information as possible. -->
 | 
			
		||||
 | 
			
		||||
### Environment
 | 
			
		||||
<!--- Describe your Vim/NERDTree setup. -->
 | 
			
		||||
 | 
			
		||||
* Operating System: 
 | 
			
		||||
* Vim version `:version`: 
 | 
			
		||||
* NERDTree version `git rev-parse --short HEAD`: 
 | 
			
		||||
* NERDTree settings applied in your vimrc, if any:
 | 
			
		||||
    ```vim
 | 
			
		||||
    ```
 | 
			
		||||
 | 
			
		||||
### Process
 | 
			
		||||
<!--- List the steps that will recreate the issue. -->
 | 
			
		||||
 | 
			
		||||
1. 
 | 
			
		||||
 | 
			
		||||
### Current Result
 | 
			
		||||
<!--- Describe what you you currently experience from this process. -->
 | 
			
		||||
 | 
			
		||||
### Expected Result
 | 
			
		||||
<!--- Describe what you would have expected from this process. -->
 | 
			
		||||
 | 
			
		||||
### Screenshot(s)
 | 
			
		||||
 | 
			
		||||
### Possible Fix
 | 
			
		||||
<!--- If you have explored the code, share what you've found. -->
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										3
									
								
								vim/plugins/nerdtree/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								vim/plugins/nerdtree/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
*~
 | 
			
		||||
*.swp
 | 
			
		||||
tags
 | 
			
		||||
							
								
								
									
										179
									
								
								vim/plugins/nerdtree/CHANGELOG
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										179
									
								
								vim/plugins/nerdtree/CHANGELOG
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,179 @@
 | 
			
		||||
Next
 | 
			
		||||
    - Fix broken "t" and "T" mappings, tabs now open at end (lifecrisis) #759
 | 
			
		||||
    - Update doc with already existing mapping variables (asnr) #699
 | 
			
		||||
    - Fix the broken g:NERDTreeBookmarksSort setting (lifecrisis) #696
 | 
			
		||||
    - Correct NERDTreeIgnore pattern in doc (cntoplolicon) #648
 | 
			
		||||
    - Remove empty segments when splitting path (sooth-sayer) #574
 | 
			
		||||
    - Suppress autocmds less agressively (wincent) #578 #691
 | 
			
		||||
    - Add an Issues template to ask for more info initially.
 | 
			
		||||
    - Fix markdown headers in readme (josephfrazier) #676
 | 
			
		||||
    - Don't touch @o and @h registers when rendering
 | 
			
		||||
    - Fix bug with files and directories with dollar signs (alegen) #649
 | 
			
		||||
    - Reuse/reopen existing window trees where possible #244
 | 
			
		||||
    - Remove NERDTree.previousBuf()
 | 
			
		||||
    - Change color of arrow (Leeiio) #630
 | 
			
		||||
    - Improved a tip in README.markdown (ggicci) #628
 | 
			
		||||
    - Shorten delete confimration of empty directory to 'y' (mikeperri) #530
 | 
			
		||||
    - Fix API call to open directory tree in window (devm33) #533
 | 
			
		||||
    - Change default arrows on non-Windows platforms (gwilk) #546
 | 
			
		||||
    - Update to README - combine cd and git clone (zwhitchcox) #584
 | 
			
		||||
    - Update to README - Tip: start NERDTree when vim starts (therealplato) #593 
 | 
			
		||||
    - Escape filename when moving an open buffer (zacharyvoase) #595
 | 
			
		||||
    - Fixed incorrect :helptags command in README (curran) #619
 | 
			
		||||
    - Fixed incomplete escaping of folder arrows (adityanatraj) #548
 | 
			
		||||
    - Added NERDTreeCascadeSingleChildDir option (juanibiapina) #558
 | 
			
		||||
    - Replace strchars() with backward compatible workaround.
 | 
			
		||||
    - Add support for copy command in Windows (SkylerLipthay) #231
 | 
			
		||||
    - Fixed typo in README.markdown - :Helptags -> :helptags
 | 
			
		||||
    - Rename "primary" and "secondary" trees to "tab" and "window" trees.
 | 
			
		||||
    - Move a bunch of buffer level variables into the NERDTree and UI classes.
 | 
			
		||||
    - Display cascading dirs on one line to save vertical/horizontal space (@matt-gardner: brainstorming/testing)
 | 
			
		||||
    - Remove the old style UI - Remove 'NERDTreeDirArrows' option.
 | 
			
		||||
    - On windows default to + and ~ for expand/collapse directory symbols.
 | 
			
		||||
    - Lots more refactoring. Move a bunch of b: level vars into b:NERDTree and friends.
 | 
			
		||||
 | 
			
		||||
5.0.0
 | 
			
		||||
    - Refactor the code significantly:
 | 
			
		||||
        * Break the classes out into their own files.
 | 
			
		||||
        * Make the majority of the code OO - previously large parts were
 | 
			
		||||
          effectively a tangle of "global" methods.
 | 
			
		||||
    - Add an API to assign flags to nodes. This allows VCS plugins like
 | 
			
		||||
      https://github.com/Xuyuanp/nerdtree-git-plugin to exist. Thanks to
 | 
			
		||||
      Xuyuanp for helping design/test/build said API.
 | 
			
		||||
    - add 'scope' argument to the key map API see :help NERDTreeAddKeyMap()
 | 
			
		||||
    - add magic [[dir]] and [[file]] flags to NERDTreeIgnore
 | 
			
		||||
    - add support for custom path filters. See :help NERDTreeAddPathFilter()
 | 
			
		||||
    - add path listener API. See :help NERDTreePathListenerAPI.
 | 
			
		||||
    - expand the fs menu functionality to list file properties (PhilRunninger,
 | 
			
		||||
      apbarrero, JESii)
 | 
			
		||||
    - make bookmarks work with `~` home shortcuts (hiberabyss)
 | 
			
		||||
    - show OSX specific fsmenu options in regular vim on mac (evindor)
 | 
			
		||||
    - make dir arrow icons configurable (PickRelated)
 | 
			
		||||
    - optimise node sorting performance when opening large dirs (vtsang)
 | 
			
		||||
    - make the root note render prettier by truncating it at a path slash (gcmt)
 | 
			
		||||
    - remove NERDChristmasTree option - its always christmas now
 | 
			
		||||
    - add "cascade" open and closing for dirs containing only another single
 | 
			
		||||
      dir. See :help NERDTreeCascadeOpenSingleChildDir (pendulm)
 | 
			
		||||
 | 
			
		||||
    Many other fixes, doc updates and contributions from:
 | 
			
		||||
    actionshrimp
 | 
			
		||||
    SchDen
 | 
			
		||||
    egalpin
 | 
			
		||||
    cperl82 - many small fixes
 | 
			
		||||
    toiffel
 | 
			
		||||
    WoLpH
 | 
			
		||||
    handcraftedbits
 | 
			
		||||
    devmanhinton
 | 
			
		||||
    xiaodili
 | 
			
		||||
    zhangoose
 | 
			
		||||
    gastropoda
 | 
			
		||||
    mixvin
 | 
			
		||||
    alvan
 | 
			
		||||
    lucascaton
 | 
			
		||||
    kelaban
 | 
			
		||||
    shanesmith
 | 
			
		||||
    staeff
 | 
			
		||||
    pendulm
 | 
			
		||||
    stephenprater
 | 
			
		||||
    franksort
 | 
			
		||||
    agrussellknives
 | 
			
		||||
    AndrewRadev
 | 
			
		||||
    Twinside
 | 
			
		||||
 | 
			
		||||
4.2.0
 | 
			
		||||
    - Add NERDTreeDirArrows option to make the UI use pretty arrow chars
 | 
			
		||||
      instead of the old +~| chars to define the tree structure (sickill)
 | 
			
		||||
    - shift the syntax highlighting out into its own syntax file (gnap)
 | 
			
		||||
    - add some mac specific options to the filesystem menu - for macvim
 | 
			
		||||
      only (andersonfreitas)
 | 
			
		||||
    - Add NERDTreeMinimalUI option to remove some non functional parts of the
 | 
			
		||||
      nerdtree ui (camthompson)
 | 
			
		||||
    - tweak the behaviour of :NERDTreeFind - see :help :NERDTreeFind for the
 | 
			
		||||
      new behaviour (benjamingeiger)
 | 
			
		||||
    - if no name is given to :Bookmark, make it default to the name of the
 | 
			
		||||
      target file/dir (minyoung)
 | 
			
		||||
    - use 'file' completion when doing copying, create, and move
 | 
			
		||||
      operations (EvanDotPro)
 | 
			
		||||
    - lots of misc bug fixes (paddyoloughlin, sdewald, camthompson, Vitaly
 | 
			
		||||
      Bogdanov, AndrewRadev, mathias, scottstvnsn, kml, wycats, me RAWR!)
 | 
			
		||||
 | 
			
		||||
4.1.0
 | 
			
		||||
    features:
 | 
			
		||||
    - NERDTreeFind to reveal the node for the current buffer in the tree,
 | 
			
		||||
      see |NERDTreeFind|. This effectively merges the FindInNERDTree plugin (by
 | 
			
		||||
      Doug McInnes) into the script.
 | 
			
		||||
    - make NERDTreeQuitOnOpen apply to the t/T keymaps too. Thanks to Stefan
 | 
			
		||||
      Ritter and Rémi Prévost.
 | 
			
		||||
    - truncate the root node if wider than the tree window. Thanks to Victor
 | 
			
		||||
      Gonzalez.
 | 
			
		||||
 | 
			
		||||
    bugfixes:
 | 
			
		||||
    - really fix window state restoring
 | 
			
		||||
    - fix some win32 path escaping issues. Thanks to Stephan Baumeister, Ricky,
 | 
			
		||||
      jfilip1024, and Chris Chambers
 | 
			
		||||
 | 
			
		||||
4.0.0
 | 
			
		||||
    - add a new programmable menu system (see :help NERDTreeMenu).
 | 
			
		||||
    - add new APIs to add menus/menu-items to the menu system as well as
 | 
			
		||||
      custom key mappings to the NERD tree buffer (see :help NERDTreeAPI).
 | 
			
		||||
    - removed the old API functions
 | 
			
		||||
    - added a mapping to maximize/restore the size of nerd tree window, thanks
 | 
			
		||||
      to Guillaume Duranceau for the patch. See :help NERDTree-A for details.
 | 
			
		||||
 | 
			
		||||
    - fix a bug where secondary nerd trees (netrw hijacked trees) and
 | 
			
		||||
      NERDTreeQuitOnOpen didnt play nicely, thanks to Curtis Harvey.
 | 
			
		||||
    - fix a bug where the script ignored directories whose name ended in a dot,
 | 
			
		||||
      thanks to Aggelos Orfanakos for the patch.
 | 
			
		||||
    - fix a bug when using the x mapping on the tree root, thanks to Bryan
 | 
			
		||||
      Venteicher for the patch.
 | 
			
		||||
    - fix a bug where the cursor position/window size of the nerd tree buffer
 | 
			
		||||
      wasnt being stored on closing the window, thanks to Richard Hart.
 | 
			
		||||
    - fix a bug where NERDTreeMirror would mirror the wrong tree
 | 
			
		||||
 | 
			
		||||
3.1.1
 | 
			
		||||
    - fix a bug where a non-listed no-name buffer was getting created every
 | 
			
		||||
      time the tree windows was created, thanks to Derek Wyatt and owen1
 | 
			
		||||
    - make <CR> behave the same as the 'o' mapping
 | 
			
		||||
    - some helptag fixes in the doc, thanks strull
 | 
			
		||||
    - fix a bug when using :set nohidden and opening a file where the previous
 | 
			
		||||
      buf was modified. Thanks iElectric
 | 
			
		||||
    - other minor fixes
 | 
			
		||||
 | 
			
		||||
3.1.0
 | 
			
		||||
    New features:
 | 
			
		||||
    - add mappings to open files in a vsplit, see :help NERDTree-s and :help
 | 
			
		||||
      NERDTree-gs
 | 
			
		||||
    - make the statusline for the nerd tree window default to something
 | 
			
		||||
      hopefully more useful. See :help 'NERDTreeStatusline'
 | 
			
		||||
    Bugfixes:
 | 
			
		||||
    - make the hijack netrw functionality work when vim is started with "vim
 | 
			
		||||
      <some dir>" (thanks to Alf Mikula for the patch).
 | 
			
		||||
    - fix a bug where the CWD wasnt being changed for some operations even when
 | 
			
		||||
      NERDTreeChDirMode==2 (thanks to Lucas S. Buchala)
 | 
			
		||||
    - add -bar to all the nerd tree :commands so they can chain with other
 | 
			
		||||
      :commands (thanks to tpope)
 | 
			
		||||
    - fix bugs when ignorecase was set (thanks to nach)
 | 
			
		||||
    - fix a bug with the relative path code (thanks to nach)
 | 
			
		||||
    - fix a bug where doing a :cd would cause :NERDTreeToggle to fail (thanks nach)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
3.0.1
 | 
			
		||||
    Bugfixes:
 | 
			
		||||
    - fix bugs with :NERDTreeToggle and :NERDTreeMirror when 'hidden
 | 
			
		||||
      was not set
 | 
			
		||||
    - fix a bug where :NERDTree <path> would fail if <path> was relative and
 | 
			
		||||
      didnt start with a ./ or ../  Thanks to James Kanze.
 | 
			
		||||
    - make the q mapping work with secondary (:e <dir>  style) trees,
 | 
			
		||||
      thanks to jamessan
 | 
			
		||||
    - fix a bunch of small bugs with secondary trees
 | 
			
		||||
 | 
			
		||||
    More insane refactoring.
 | 
			
		||||
 | 
			
		||||
3.0.0
 | 
			
		||||
    - hijack netrw so that doing an :edit <directory>  will put a NERD tree in
 | 
			
		||||
      the window rather than a netrw browser. See :help 'NERDTreeHijackNetrw'
 | 
			
		||||
    - allow sharing of trees across tabs, see :help :NERDTreeMirror
 | 
			
		||||
    - remove "top" and "bottom" as valid settings for NERDTreeWinPos
 | 
			
		||||
    - change the '<tab>' mapping to 'i'
 | 
			
		||||
    - change the 'H' mapping to 'I'
 | 
			
		||||
    - lots of refactoring
 | 
			
		||||
							
								
								
									
										13
									
								
								vim/plugins/nerdtree/LICENCE
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								vim/plugins/nerdtree/LICENCE
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
 | 
			
		||||
                   Version 2, December 2004
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
 | 
			
		||||
 | 
			
		||||
Everyone is permitted to copy and distribute verbatim or modified
 | 
			
		||||
copies of this license document, and changing it is allowed as long
 | 
			
		||||
as the name is changed.
 | 
			
		||||
 | 
			
		||||
           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
 | 
			
		||||
  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 | 
			
		||||
 | 
			
		||||
 0. You just DO WHAT THE FUCK YOU WANT TO.
 | 
			
		||||
							
								
								
									
										96
									
								
								vim/plugins/nerdtree/README.markdown
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								vim/plugins/nerdtree/README.markdown
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,96 @@
 | 
			
		||||
The NERDTree
 | 
			
		||||
=============
 | 
			
		||||
 | 
			
		||||
Introduction
 | 
			
		||||
------------
 | 
			
		||||
 | 
			
		||||
The NERDTree is a file system explorer for the Vim editor. Using this plugin,
 | 
			
		||||
users can visually browse complex directory hierarchies, quickly open files for
 | 
			
		||||
reading or editing, and perform basic file system operations.
 | 
			
		||||
 | 
			
		||||
This plugin can also be extended with custom mappings using a special API. The
 | 
			
		||||
details of this API and of other NERDTree features are described in the
 | 
			
		||||
included documentation.
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
Installation
 | 
			
		||||
------------
 | 
			
		||||
 | 
			
		||||
#### [pathogen.vim](https://github.com/tpope/vim-pathogen)
 | 
			
		||||
 | 
			
		||||
    git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree
 | 
			
		||||
 | 
			
		||||
Then reload Vim, run `:helptags ~/.vim/bundle/nerdtree/doc/` or `:Helptags`, and check out `:help NERDTree.txt`.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#### [apt-vim](https://github.com/egalpin/apt-vim)
 | 
			
		||||
 | 
			
		||||
    apt-vim install -y https://github.com/scrooloose/nerdtree.git
 | 
			
		||||
 | 
			
		||||
F.A.Q.
 | 
			
		||||
------
 | 
			
		||||
 | 
			
		||||
> Is there any support for `git` flags?
 | 
			
		||||
 | 
			
		||||
Yes, install [nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin).
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
> Can I have the nerdtree on every tab automatically?
 | 
			
		||||
 | 
			
		||||
Nope. If this is something you want then chances are you aren't using tabs and
 | 
			
		||||
buffers as they were intended to be used. Read this
 | 
			
		||||
http://stackoverflow.com/questions/102384/using-vims-tabs-like-buffers
 | 
			
		||||
 | 
			
		||||
If you are interested in this behaviour then consider [vim-nerdtree-tabs](https://github.com/jistr/vim-nerdtree-tabs)
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
> How can I open a NERDTree automatically when vim starts up?
 | 
			
		||||
 | 
			
		||||
Stick this in your vimrc: `autocmd vimenter * NERDTree`
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
> How can I open a NERDTree automatically when vim starts up if no files were specified?
 | 
			
		||||
 | 
			
		||||
Stick this in your vimrc:
 | 
			
		||||
 | 
			
		||||
    autocmd StdinReadPre * let s:std_in=1
 | 
			
		||||
    autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
 | 
			
		||||
 | 
			
		||||
Note: Now start vim with plain `vim`, not `vim .`
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
> How can I open NERDTree automatically when vim starts up on opening a directory?
 | 
			
		||||
 | 
			
		||||
    autocmd StdinReadPre * let s:std_in=1
 | 
			
		||||
    autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
 | 
			
		||||
 | 
			
		||||
This window is tab-specific, meaning it's used by all windows in the tab. This trick also prevents NERDTree from hiding when first selecting a file.
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
> How can I map a specific key or shortcut to open NERDTree?
 | 
			
		||||
 | 
			
		||||
Stick this in your vimrc to open NERDTree with `Ctrl+n` (you can set whatever key you want):
 | 
			
		||||
 | 
			
		||||
    map <C-n> :NERDTreeToggle<CR>
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
> How can I close vim if the only window left open is a NERDTree?
 | 
			
		||||
 | 
			
		||||
Stick this in your vimrc:
 | 
			
		||||
 | 
			
		||||
    autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
> Can I have different highlighting for different file extensions?
 | 
			
		||||
 | 
			
		||||
See here: https://github.com/scrooloose/nerdtree/issues/433#issuecomment-92590696
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
> How can I change default arrows?
 | 
			
		||||
 | 
			
		||||
Use these variables in your vimrc. Note that below are default arrow symbols
 | 
			
		||||
 | 
			
		||||
    let g:NERDTreeDirArrowExpandable = '▸'
 | 
			
		||||
    let g:NERDTreeDirArrowCollapsible = '▾'
 | 
			
		||||
							
								
								
									
										200
									
								
								vim/plugins/nerdtree/autoload/nerdtree.vim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										200
									
								
								vim/plugins/nerdtree/autoload/nerdtree.vim
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,200 @@
 | 
			
		||||
if exists("g:loaded_nerdtree_autoload")
 | 
			
		||||
    finish
 | 
			
		||||
endif
 | 
			
		||||
let g:loaded_nerdtree_autoload = 1
 | 
			
		||||
 | 
			
		||||
function! nerdtree#version()
 | 
			
		||||
    return '5.0.0'
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" SECTION: General Functions {{{1
 | 
			
		||||
"============================================================
 | 
			
		||||
 | 
			
		||||
"FUNCTION: nerdtree#checkForBrowse(dir) {{{2
 | 
			
		||||
"inits a window tree in the current buffer if appropriate
 | 
			
		||||
function! nerdtree#checkForBrowse(dir)
 | 
			
		||||
    if !isdirectory(a:dir)
 | 
			
		||||
        return
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    if s:reuseWin(a:dir)
 | 
			
		||||
        return
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    call g:NERDTreeCreator.CreateWindowTree(a:dir)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"FUNCTION: s:reuseWin(dir) {{{2
 | 
			
		||||
"finds a NERDTree buffer with root of dir, and opens it.
 | 
			
		||||
function! s:reuseWin(dir) abort
 | 
			
		||||
    let path = g:NERDTreePath.New(fnamemodify(a:dir, ":p"))
 | 
			
		||||
 | 
			
		||||
    for i in range(1, bufnr("$"))
 | 
			
		||||
        unlet! nt
 | 
			
		||||
        let nt = getbufvar(i, "NERDTree")
 | 
			
		||||
        if empty(nt)
 | 
			
		||||
            continue
 | 
			
		||||
        endif
 | 
			
		||||
 | 
			
		||||
        if nt.isWinTree() && nt.root.path.equals(path)
 | 
			
		||||
            call nt.setPreviousBuf(bufnr("#"))
 | 
			
		||||
            exec "buffer " . i
 | 
			
		||||
            return 1
 | 
			
		||||
        endif
 | 
			
		||||
    endfor
 | 
			
		||||
 | 
			
		||||
    return 0
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: nerdtree#completeBookmarks(A,L,P) {{{2
 | 
			
		||||
" completion function for the bookmark commands
 | 
			
		||||
function! nerdtree#completeBookmarks(A,L,P)
 | 
			
		||||
    return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"')
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"FUNCTION: nerdtree#compareNodes(dir) {{{2
 | 
			
		||||
function! nerdtree#compareNodes(n1, n2)
 | 
			
		||||
    return a:n1.path.compareTo(a:n2.path)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"FUNCTION: nerdtree#compareNodesBySortKey(n1, n2) {{{2
 | 
			
		||||
function! nerdtree#compareNodesBySortKey(n1, n2)
 | 
			
		||||
    let sortKey1 = a:n1.path.getSortKey()
 | 
			
		||||
    let sortKey2 = a:n2.path.getSortKey()
 | 
			
		||||
    let i = 0
 | 
			
		||||
    while i < min([len(sortKey1), len(sortKey2)])
 | 
			
		||||
        " Compare chunks upto common length.
 | 
			
		||||
        " If chunks have different type, the one which has
 | 
			
		||||
        " integer type is the lesser.
 | 
			
		||||
        if type(sortKey1[i]) == type(sortKey2[i])
 | 
			
		||||
            if sortKey1[i] <# sortKey2[i]
 | 
			
		||||
                return - 1
 | 
			
		||||
            elseif sortKey1[i] ># sortKey2[i]
 | 
			
		||||
                return 1
 | 
			
		||||
            endif
 | 
			
		||||
        elseif type(sortKey1[i]) == v:t_number
 | 
			
		||||
            return -1
 | 
			
		||||
        elseif type(sortKey2[i]) == v:t_number
 | 
			
		||||
            return 1
 | 
			
		||||
        endif
 | 
			
		||||
        let i = i + 1
 | 
			
		||||
    endwhile
 | 
			
		||||
 | 
			
		||||
    " Keys are identical upto common length.
 | 
			
		||||
    " The key which has smaller chunks is the lesser one.
 | 
			
		||||
    if len(sortKey1) < len(sortKey2)
 | 
			
		||||
        return -1
 | 
			
		||||
    elseif len(sortKey1) > len(sortKey2)
 | 
			
		||||
        return 1
 | 
			
		||||
    else
 | 
			
		||||
        return 0
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: nerdtree#deprecated(func, [msg]) {{{2
 | 
			
		||||
" Issue a deprecation warning for a:func. If a second arg is given, use this
 | 
			
		||||
" as the deprecation message
 | 
			
		||||
function! nerdtree#deprecated(func, ...)
 | 
			
		||||
    let msg = a:0 ? a:func . ' ' . a:1 : a:func . ' is deprecated'
 | 
			
		||||
 | 
			
		||||
    if !exists('s:deprecationWarnings')
 | 
			
		||||
        let s:deprecationWarnings = {}
 | 
			
		||||
    endif
 | 
			
		||||
    if !has_key(s:deprecationWarnings, a:func)
 | 
			
		||||
        let s:deprecationWarnings[a:func] = 1
 | 
			
		||||
        echomsg msg
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: nerdtree#exec(cmd) {{{2
 | 
			
		||||
" Same as :exec cmd but with eventignore set for the duration
 | 
			
		||||
" to disable the autocommands used by NERDTree (BufEnter,
 | 
			
		||||
" BufLeave and VimEnter)
 | 
			
		||||
function! nerdtree#exec(cmd)
 | 
			
		||||
    let old_ei = &ei
 | 
			
		||||
    set ei=BufEnter,BufLeave,VimEnter
 | 
			
		||||
    exec a:cmd
 | 
			
		||||
    let &ei = old_ei
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: nerdtree#has_opt(options, name) {{{2
 | 
			
		||||
function! nerdtree#has_opt(options, name)
 | 
			
		||||
    return has_key(a:options, a:name) && a:options[a:name] == 1
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: nerdtree#loadClassFiles() {{{2
 | 
			
		||||
function! nerdtree#loadClassFiles()
 | 
			
		||||
    runtime lib/nerdtree/path.vim
 | 
			
		||||
    runtime lib/nerdtree/menu_controller.vim
 | 
			
		||||
    runtime lib/nerdtree/menu_item.vim
 | 
			
		||||
    runtime lib/nerdtree/key_map.vim
 | 
			
		||||
    runtime lib/nerdtree/bookmark.vim
 | 
			
		||||
    runtime lib/nerdtree/tree_file_node.vim
 | 
			
		||||
    runtime lib/nerdtree/tree_dir_node.vim
 | 
			
		||||
    runtime lib/nerdtree/opener.vim
 | 
			
		||||
    runtime lib/nerdtree/creator.vim
 | 
			
		||||
    runtime lib/nerdtree/flag_set.vim
 | 
			
		||||
    runtime lib/nerdtree/nerdtree.vim
 | 
			
		||||
    runtime lib/nerdtree/ui.vim
 | 
			
		||||
    runtime lib/nerdtree/event.vim
 | 
			
		||||
    runtime lib/nerdtree/notifier.vim
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: nerdtree#postSourceActions() {{{2
 | 
			
		||||
function! nerdtree#postSourceActions()
 | 
			
		||||
    call g:NERDTreeBookmark.CacheBookmarks(1)
 | 
			
		||||
    call nerdtree#ui_glue#createDefaultBindings()
 | 
			
		||||
 | 
			
		||||
    "load all nerdtree plugins
 | 
			
		||||
    runtime! nerdtree_plugin/**/*.vim
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"FUNCTION: nerdtree#runningWindows(dir) {{{2
 | 
			
		||||
function! nerdtree#runningWindows()
 | 
			
		||||
    return has("win16") || has("win32") || has("win64")
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"FUNCTION: nerdtree#runningCygwin(dir) {{{2
 | 
			
		||||
function! nerdtree#runningCygwin()
 | 
			
		||||
    return has("win32unix")
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" SECTION: View Functions {{{1
 | 
			
		||||
"============================================================
 | 
			
		||||
 | 
			
		||||
"FUNCTION: nerdtree#echo  {{{2
 | 
			
		||||
"A wrapper for :echo. Appends 'NERDTree:' on the front of all messages
 | 
			
		||||
"
 | 
			
		||||
"Args:
 | 
			
		||||
"msg: the message to echo
 | 
			
		||||
function! nerdtree#echo(msg)
 | 
			
		||||
    redraw
 | 
			
		||||
    echomsg "NERDTree: " . a:msg
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"FUNCTION: nerdtree#echoError {{{2
 | 
			
		||||
"Wrapper for nerdtree#echo, sets the message type to errormsg for this message
 | 
			
		||||
"Args:
 | 
			
		||||
"msg: the message to echo
 | 
			
		||||
function! nerdtree#echoError(msg)
 | 
			
		||||
    echohl errormsg
 | 
			
		||||
    call nerdtree#echo(a:msg)
 | 
			
		||||
    echohl normal
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"FUNCTION: nerdtree#echoWarning {{{2
 | 
			
		||||
"Wrapper for nerdtree#echo, sets the message type to warningmsg for this message
 | 
			
		||||
"Args:
 | 
			
		||||
"msg: the message to echo
 | 
			
		||||
function! nerdtree#echoWarning(msg)
 | 
			
		||||
    echohl warningmsg
 | 
			
		||||
    call nerdtree#echo(a:msg)
 | 
			
		||||
    echohl normal
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"FUNCTION: nerdtree#renderView {{{2
 | 
			
		||||
function! nerdtree#renderView()
 | 
			
		||||
    call b:NERDTree.render()
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" vim: set sw=4 sts=4 et fdm=marker:
 | 
			
		||||
							
								
								
									
										661
									
								
								vim/plugins/nerdtree/autoload/nerdtree/ui_glue.vim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										661
									
								
								vim/plugins/nerdtree/autoload/nerdtree/ui_glue.vim
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,661 @@
 | 
			
		||||
if exists("g:loaded_nerdtree_ui_glue_autoload")
 | 
			
		||||
    finish
 | 
			
		||||
endif
 | 
			
		||||
let g:loaded_nerdtree_ui_glue_autoload = 1
 | 
			
		||||
 | 
			
		||||
" FUNCTION: nerdtree#ui_glue#createDefaultBindings() {{{1
 | 
			
		||||
function! nerdtree#ui_glue#createDefaultBindings()
 | 
			
		||||
    let s = '<SNR>' . s:SID() . '_'
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': '<MiddleMouse>', 'scope': 'all', 'callback': s . 'handleMiddleMouse' })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': '<LeftRelease>', 'scope': "all", 'callback': s."handleLeftClick" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "DirNode", 'callback': s."activateDirNode" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "FileNode", 'callback': s."activateFileNode" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "Bookmark", 'callback': s."activateBookmark" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "all", 'callback': s."activateAll" })
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "DirNode", 'callback': s."activateDirNode" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "FileNode", 'callback': s."activateFileNode" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "Bookmark", 'callback': s."activateBookmark" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "all", 'callback': s."activateAll" })
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': "Node", 'callback': s."openHSplit" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': "Node", 'callback': s."openVSplit" })
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': "Node", 'callback': s."previewNodeCurrent" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': "Node", 'callback': s."previewNodeVSplit" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': "Node", 'callback': s."previewNodeHSplit" })
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': "DirNode", 'callback': s."openNodeRecursively" })
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdir, 'scope': 'all', 'callback': s . 'upDirCurrentRootClosed' })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdirKeepOpen, 'scope': 'all', 'callback': s . 'upDirCurrentRootOpen' })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChangeRoot, 'scope': 'Node', 'callback': s . 'chRoot' })
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChdir, 'scope': "Node", 'callback': s."chCwd" })
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapQuit, 'scope': "all", 'callback': s."closeTreeWindow" })
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCWD, 'scope': "all", 'callback': "nerdtree#ui_glue#chRootCwd" })
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefreshRoot, 'scope': "all", 'callback': s."refreshRoot" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefresh, 'scope': "Node", 'callback': s."refreshCurrent" })
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapHelp, 'scope': "all", 'callback': s."displayHelp" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleZoom, 'scope': "all", 'callback': s."toggleZoom" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleHidden, 'scope': "all", 'callback': s."toggleShowHidden" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFilters, 'scope': "all", 'callback': s."toggleIgnoreFilter" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFiles, 'scope': "all", 'callback': s."toggleShowFiles" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleBookmarks, 'scope': "all", 'callback': s."toggleShowBookmarks" })
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseDir, 'scope': "Node", 'callback': s."closeCurrentDir" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseChildren, 'scope': "DirNode", 'callback': s."closeChildren" })
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapMenu, 'scope': "Node", 'callback': s."showMenu" })
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpParent, 'scope': "Node", 'callback': s."jumpToParent" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpFirstChild, 'scope': "Node", 'callback': s."jumpToFirstChild" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpLastChild, 'scope': "Node", 'callback': s."jumpToLastChild" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpRoot, 'scope': "all", 'callback': s."jumpToRoot" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpNextSibling, 'scope': "Node", 'callback': s."jumpToNextSibling" })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpPrevSibling, 'scope': "Node", 'callback': s."jumpToPrevSibling" })
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': 'Node', 'callback': s . 'openInNewTab' })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': 'Node', 'callback': s . 'openInNewTabSilent' })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': 'Bookmark', 'callback': s . 'openInNewTab' })
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': 'Bookmark', 'callback': s . 'openInNewTabSilent' })
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': "DirNode", 'callback': s."openExplorer" })
 | 
			
		||||
 | 
			
		||||
    call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapDeleteBookmark, 'scope': "Bookmark", 'callback': s."deleteBookmark" })
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
"SECTION: Interface bindings {{{1
 | 
			
		||||
"============================================================
 | 
			
		||||
 | 
			
		||||
"FUNCTION: s:activateAll() {{{1
 | 
			
		||||
"handle the user activating the updir line
 | 
			
		||||
function! s:activateAll()
 | 
			
		||||
    if getline(".") ==# g:NERDTreeUI.UpDirLine()
 | 
			
		||||
        return nerdtree#ui_glue#upDir(0)
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:activateDirNode(directoryNode) {{{1
 | 
			
		||||
function! s:activateDirNode(directoryNode)
 | 
			
		||||
 | 
			
		||||
    if a:directoryNode.isRoot() && a:directoryNode.isOpen
 | 
			
		||||
        call nerdtree#echo('cannot close tree root')
 | 
			
		||||
        return
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    call a:directoryNode.activate()
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"FUNCTION: s:activateFileNode() {{{1
 | 
			
		||||
"handle the user activating a tree node
 | 
			
		||||
function! s:activateFileNode(node)
 | 
			
		||||
    call a:node.activate({'reuse': 'all', 'where': 'p'})
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"FUNCTION: s:activateBookmark() {{{1
 | 
			
		||||
"handle the user activating a bookmark
 | 
			
		||||
function! s:activateBookmark(bm)
 | 
			
		||||
    call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p'} : {})
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1
 | 
			
		||||
" Associate the current node with the given name
 | 
			
		||||
function! nerdtree#ui_glue#bookmarkNode(...)
 | 
			
		||||
    let currentNode = g:NERDTreeFileNode.GetSelected()
 | 
			
		||||
    if currentNode != {}
 | 
			
		||||
        let name = a:1
 | 
			
		||||
        if empty(name)
 | 
			
		||||
            let name = currentNode.path.getLastPathComponent(0)
 | 
			
		||||
        endif
 | 
			
		||||
        try
 | 
			
		||||
            call currentNode.bookmark(name)
 | 
			
		||||
            call b:NERDTree.render()
 | 
			
		||||
        catch /^NERDTree.IllegalBookmarkNameError/
 | 
			
		||||
            call nerdtree#echo("bookmark names must not contain spaces")
 | 
			
		||||
        endtry
 | 
			
		||||
    else
 | 
			
		||||
        call nerdtree#echo("select a node first")
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:chCwd(node) {{{1
 | 
			
		||||
function! s:chCwd(node)
 | 
			
		||||
    try
 | 
			
		||||
        call a:node.path.changeToDir()
 | 
			
		||||
    catch /^NERDTree.PathChangeError/
 | 
			
		||||
        call nerdtree#echoWarning("could not change cwd")
 | 
			
		||||
    endtry
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:chRoot(node) {{{1
 | 
			
		||||
" changes the current root to the selected one
 | 
			
		||||
function! s:chRoot(node)
 | 
			
		||||
    call b:NERDTree.changeRoot(a:node)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:nerdtree#ui_glue#chRootCwd() {{{1
 | 
			
		||||
" changes the current root to CWD
 | 
			
		||||
function! nerdtree#ui_glue#chRootCwd()
 | 
			
		||||
    try
 | 
			
		||||
        let cwd = g:NERDTreePath.New(getcwd())
 | 
			
		||||
    catch /^NERDTree.InvalidArgumentsError/
 | 
			
		||||
        call nerdtree#echo("current directory does not exist.")
 | 
			
		||||
        return
 | 
			
		||||
    endtry
 | 
			
		||||
    if cwd.str() == g:NERDTreeFileNode.GetRootForTab().path.str()
 | 
			
		||||
       return
 | 
			
		||||
    endif
 | 
			
		||||
    call s:chRoot(g:NERDTreeDirNode.New(cwd, b:NERDTree))
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: nnerdtree#ui_glue#clearBookmarks(bookmarks) {{{1
 | 
			
		||||
function! nerdtree#ui_glue#clearBookmarks(bookmarks)
 | 
			
		||||
    if a:bookmarks ==# ''
 | 
			
		||||
        let currentNode = g:NERDTreeFileNode.GetSelected()
 | 
			
		||||
        if currentNode != {}
 | 
			
		||||
            call currentNode.clearBookmarks()
 | 
			
		||||
        endif
 | 
			
		||||
    else
 | 
			
		||||
        for name in split(a:bookmarks, ' ')
 | 
			
		||||
            let bookmark = g:NERDTreeBookmark.BookmarkFor(name)
 | 
			
		||||
            call bookmark.delete()
 | 
			
		||||
        endfor
 | 
			
		||||
    endif
 | 
			
		||||
    call b:NERDTree.root.refresh()
 | 
			
		||||
    call b:NERDTree.render()
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:closeChildren(node) {{{1
 | 
			
		||||
" closes all childnodes of the current node
 | 
			
		||||
function! s:closeChildren(node)
 | 
			
		||||
    call a:node.closeChildren()
 | 
			
		||||
    call b:NERDTree.render()
 | 
			
		||||
    call a:node.putCursorHere(0, 0)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:closeCurrentDir(node) {{{1
 | 
			
		||||
" Close the parent directory of the current node.
 | 
			
		||||
function! s:closeCurrentDir(node)
 | 
			
		||||
 | 
			
		||||
    if a:node.isRoot()
 | 
			
		||||
        call nerdtree#echo('cannot close parent of tree root')
 | 
			
		||||
        return
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    let l:parent = a:node.parent
 | 
			
		||||
 | 
			
		||||
    while l:parent.isCascadable()
 | 
			
		||||
        let l:parent = l:parent.parent
 | 
			
		||||
    endwhile
 | 
			
		||||
 | 
			
		||||
    if l:parent.isRoot()
 | 
			
		||||
        call nerdtree#echo('cannot close tree root')
 | 
			
		||||
        return
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    call l:parent.close()
 | 
			
		||||
    call b:NERDTree.render()
 | 
			
		||||
    call l:parent.putCursorHere(0, 0)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:closeTreeWindow() {{{1
 | 
			
		||||
" close the tree window
 | 
			
		||||
function! s:closeTreeWindow()
 | 
			
		||||
    if b:NERDTree.isWinTree() && b:NERDTree.previousBuf() != -1
 | 
			
		||||
        exec "buffer " . b:NERDTree.previousBuf()
 | 
			
		||||
    else
 | 
			
		||||
        if winnr("$") > 1
 | 
			
		||||
            call g:NERDTree.Close()
 | 
			
		||||
        else
 | 
			
		||||
            call nerdtree#echo("Cannot close last window")
 | 
			
		||||
        endif
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:deleteBookmark(bookmark) {{{1
 | 
			
		||||
" Prompt the user to confirm the deletion of the selected bookmark.
 | 
			
		||||
function! s:deleteBookmark(bookmark)
 | 
			
		||||
    let l:message = "Delete the bookmark \"" . a:bookmark.name
 | 
			
		||||
                \ . "\" from the bookmark list?"
 | 
			
		||||
 | 
			
		||||
    let l:choices = "&Yes\n&No"
 | 
			
		||||
 | 
			
		||||
    echo | redraw
 | 
			
		||||
    let l:selection = confirm(l:message, l:choices, 1, 'Warning')
 | 
			
		||||
 | 
			
		||||
    if l:selection != 1
 | 
			
		||||
        call nerdtree#echo('bookmark not deleted')
 | 
			
		||||
        return
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    try
 | 
			
		||||
        call a:bookmark.delete()
 | 
			
		||||
        silent call b:NERDTree.root.refresh()
 | 
			
		||||
        call b:NERDTree.render()
 | 
			
		||||
        echo | redraw
 | 
			
		||||
    catch /^NERDTree/
 | 
			
		||||
        call nerdtree#echoWarning('could not remove bookmark')
 | 
			
		||||
    endtry
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:displayHelp() {{{1
 | 
			
		||||
" toggles the help display
 | 
			
		||||
function! s:displayHelp()
 | 
			
		||||
    call b:NERDTree.ui.toggleHelp()
 | 
			
		||||
    call b:NERDTree.render()
 | 
			
		||||
    call b:NERDTree.ui.centerView()
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:findAndRevealPath(pathStr) {{{1
 | 
			
		||||
function! s:findAndRevealPath(pathStr)
 | 
			
		||||
    let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p')
 | 
			
		||||
 | 
			
		||||
    if empty(l:pathStr)
 | 
			
		||||
        call nerdtree#echoWarning('no file for the current buffer')
 | 
			
		||||
        return
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    try
 | 
			
		||||
        let l:pathObj = g:NERDTreePath.New(l:pathStr)
 | 
			
		||||
    catch /^NERDTree.InvalidArgumentsError/
 | 
			
		||||
        call nerdtree#echoWarning('invalid path')
 | 
			
		||||
        return
 | 
			
		||||
    endtry
 | 
			
		||||
 | 
			
		||||
    if !g:NERDTree.ExistsForTab()
 | 
			
		||||
        try
 | 
			
		||||
            let l:cwd = g:NERDTreePath.New(getcwd())
 | 
			
		||||
        catch /^NERDTree.InvalidArgumentsError/
 | 
			
		||||
            call nerdtree#echo('current directory does not exist.')
 | 
			
		||||
            let l:cwd = l:pathObj.getParent()
 | 
			
		||||
        endtry
 | 
			
		||||
 | 
			
		||||
        if l:pathObj.isUnder(l:cwd)
 | 
			
		||||
            call g:NERDTreeCreator.CreateTabTree(l:cwd.str())
 | 
			
		||||
        else
 | 
			
		||||
            call g:NERDTreeCreator.CreateTabTree(l:pathObj.getParent().str())
 | 
			
		||||
        endif
 | 
			
		||||
    else
 | 
			
		||||
        NERDTreeFocus
 | 
			
		||||
 | 
			
		||||
        if !l:pathObj.isUnder(b:NERDTree.root.path)
 | 
			
		||||
            call s:chRoot(g:NERDTreeDirNode.New(l:pathObj.getParent(), b:NERDTree))
 | 
			
		||||
        endif
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    if l:pathObj.isHiddenUnder(b:NERDTree.root.path)
 | 
			
		||||
        call b:NERDTree.ui.setShowHidden(1)
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    let l:node = b:NERDTree.root.reveal(l:pathObj)
 | 
			
		||||
    call b:NERDTree.render()
 | 
			
		||||
    call l:node.putCursorHere(1, 0)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"FUNCTION: s:handleLeftClick() {{{1
 | 
			
		||||
"Checks if the click should open the current node
 | 
			
		||||
function! s:handleLeftClick()
 | 
			
		||||
    let currentNode = g:NERDTreeFileNode.GetSelected()
 | 
			
		||||
    if currentNode != {}
 | 
			
		||||
 | 
			
		||||
        "the dir arrows are multibyte chars, and vim's string functions only
 | 
			
		||||
        "deal with single bytes - so split the line up with the hack below and
 | 
			
		||||
        "take the line substring manually
 | 
			
		||||
        let line = split(getline(line(".")), '\zs')
 | 
			
		||||
        let startToCur = ""
 | 
			
		||||
        for i in range(0,len(line)-1)
 | 
			
		||||
            let startToCur .= line[i]
 | 
			
		||||
        endfor
 | 
			
		||||
 | 
			
		||||
        if currentNode.path.isDirectory
 | 
			
		||||
            if startToCur =~# g:NERDTreeUI.MarkupReg() && startToCur =~# '[+~'.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'] \?$'
 | 
			
		||||
                call currentNode.activate()
 | 
			
		||||
                return
 | 
			
		||||
            endif
 | 
			
		||||
        endif
 | 
			
		||||
 | 
			
		||||
        if (g:NERDTreeMouseMode ==# 2 && currentNode.path.isDirectory) || g:NERDTreeMouseMode ==# 3
 | 
			
		||||
            let char = strpart(startToCur, strlen(startToCur)-1, 1)
 | 
			
		||||
            if char !~# g:NERDTreeUI.MarkupReg()
 | 
			
		||||
                if currentNode.path.isDirectory
 | 
			
		||||
                    call currentNode.activate()
 | 
			
		||||
                else
 | 
			
		||||
                    call currentNode.activate({'reuse': 'all', 'where': 'p'})
 | 
			
		||||
                endif
 | 
			
		||||
                return
 | 
			
		||||
            endif
 | 
			
		||||
        endif
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:handleMiddleMouse() {{{1
 | 
			
		||||
function! s:handleMiddleMouse()
 | 
			
		||||
 | 
			
		||||
    " A middle mouse click does not automatically position the cursor as one
 | 
			
		||||
    " would expect. Forcing the execution of a regular left mouse click here
 | 
			
		||||
    " fixes this problem.
 | 
			
		||||
    execute "normal! \<LeftMouse>"
 | 
			
		||||
 | 
			
		||||
    let l:currentNode = g:NERDTreeFileNode.GetSelected()
 | 
			
		||||
    if empty(l:currentNode)
 | 
			
		||||
        call nerdtree#echoError('use the pointer to select a node')
 | 
			
		||||
        return
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    if l:currentNode.path.isDirectory
 | 
			
		||||
        call l:currentNode.openExplorer()
 | 
			
		||||
    else
 | 
			
		||||
        call l:currentNode.open({'where': 'h'})
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:jumpToChild(direction) {{{2
 | 
			
		||||
" Args:
 | 
			
		||||
" direction: 0 if going to first child, 1 if going to last
 | 
			
		||||
function! s:jumpToChild(currentNode, direction)
 | 
			
		||||
    if a:currentNode.isRoot()
 | 
			
		||||
        return nerdtree#echo("cannot jump to " . (a:direction ? "last" : "first") .  " child")
 | 
			
		||||
    end
 | 
			
		||||
    let dirNode = a:currentNode.parent
 | 
			
		||||
    let childNodes = dirNode.getVisibleChildren()
 | 
			
		||||
 | 
			
		||||
    let targetNode = childNodes[0]
 | 
			
		||||
    if a:direction
 | 
			
		||||
        let targetNode = childNodes[len(childNodes) - 1]
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    if targetNode.equals(a:currentNode)
 | 
			
		||||
        let siblingDir = a:currentNode.parent.findOpenDirSiblingWithVisibleChildren(a:direction)
 | 
			
		||||
        if siblingDir != {}
 | 
			
		||||
            let indx = a:direction ? siblingDir.getVisibleChildCount()-1 : 0
 | 
			
		||||
            let targetNode = siblingDir.getChildByIndex(indx, 1)
 | 
			
		||||
        endif
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    call targetNode.putCursorHere(1, 0)
 | 
			
		||||
 | 
			
		||||
    call b:NERDTree.ui.centerView()
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
" FUNCTION: nerdtree#ui_glue#invokeKeyMap(key) {{{1
 | 
			
		||||
"this is needed since I cant figure out how to invoke dict functions from a
 | 
			
		||||
"key map
 | 
			
		||||
function! nerdtree#ui_glue#invokeKeyMap(key)
 | 
			
		||||
    call g:NERDTreeKeyMap.Invoke(a:key)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:jumpToFirstChild() {{{1
 | 
			
		||||
" wrapper for the jump to child method
 | 
			
		||||
function! s:jumpToFirstChild(node)
 | 
			
		||||
    call s:jumpToChild(a:node, 0)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:jumpToLastChild() {{{1
 | 
			
		||||
" wrapper for the jump to child method
 | 
			
		||||
function! s:jumpToLastChild(node)
 | 
			
		||||
    call s:jumpToChild(a:node, 1)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:jumpToParent(node) {{{1
 | 
			
		||||
" Move the cursor to the parent of the specified node. For a cascade, move to
 | 
			
		||||
" the parent of the cascade's highest node. At the root, do nothing.
 | 
			
		||||
function! s:jumpToParent(node)
 | 
			
		||||
    let l:parent = a:node.parent
 | 
			
		||||
 | 
			
		||||
    " If "a:node" represents a directory, back out of its cascade.
 | 
			
		||||
    if a:node.path.isDirectory
 | 
			
		||||
        while !empty(l:parent) && !l:parent.isRoot()
 | 
			
		||||
            if index(l:parent.getCascade(), a:node) >= 0
 | 
			
		||||
                let l:parent = l:parent.parent
 | 
			
		||||
            else
 | 
			
		||||
                break
 | 
			
		||||
            endif
 | 
			
		||||
        endwhile
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    if !empty(l:parent)
 | 
			
		||||
        call l:parent.putCursorHere(1, 0)
 | 
			
		||||
        call b:NERDTree.ui.centerView()
 | 
			
		||||
    else
 | 
			
		||||
        call nerdtree#echo('could not jump to parent node')
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:jumpToRoot() {{{1
 | 
			
		||||
" moves the cursor to the root node
 | 
			
		||||
function! s:jumpToRoot()
 | 
			
		||||
    call b:NERDTree.root.putCursorHere(1, 0)
 | 
			
		||||
    call b:NERDTree.ui.centerView()
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:jumpToNextSibling(node) {{{1
 | 
			
		||||
function! s:jumpToNextSibling(node)
 | 
			
		||||
    call s:jumpToSibling(a:node, 1)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:jumpToPrevSibling(node) {{{1
 | 
			
		||||
function! s:jumpToPrevSibling(node)
 | 
			
		||||
    call s:jumpToSibling(a:node, 0)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:jumpToSibling(currentNode, forward) {{{2
 | 
			
		||||
" moves the cursor to the sibling of the current node in the given direction
 | 
			
		||||
"
 | 
			
		||||
" Args:
 | 
			
		||||
" forward: 1 if the cursor should move to the next sibling, 0 if it should
 | 
			
		||||
" move back to the previous sibling
 | 
			
		||||
function! s:jumpToSibling(currentNode, forward)
 | 
			
		||||
    let sibling = a:currentNode.findSibling(a:forward)
 | 
			
		||||
 | 
			
		||||
    if !empty(sibling)
 | 
			
		||||
        call sibling.putCursorHere(1, 0)
 | 
			
		||||
        call b:NERDTree.ui.centerView()
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: nerdtree#ui_glue#openBookmark(name) {{{1
 | 
			
		||||
" Open the Bookmark that has the specified name. This function provides the
 | 
			
		||||
" implementation for the ":OpenBookmark" command.
 | 
			
		||||
function! nerdtree#ui_glue#openBookmark(name)
 | 
			
		||||
    try
 | 
			
		||||
        let l:bookmark = g:NERDTreeBookmark.BookmarkFor(a:name)
 | 
			
		||||
    catch /^NERDTree.BookmarkNotFoundError/
 | 
			
		||||
        call nerdtree#echoError('bookmark "' . a:name . '" not found')
 | 
			
		||||
        return
 | 
			
		||||
    endtry
 | 
			
		||||
    if l:bookmark.path.isDirectory
 | 
			
		||||
        call l:bookmark.open(b:NERDTree)
 | 
			
		||||
    else
 | 
			
		||||
        call l:bookmark.open(b:NERDTree, {'where': 'p'})
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:openHSplit(target) {{{1
 | 
			
		||||
function! s:openHSplit(target)
 | 
			
		||||
    call a:target.activate({'where': 'h'})
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:openVSplit(target) {{{1
 | 
			
		||||
function! s:openVSplit(target)
 | 
			
		||||
    call a:target.activate({'where': 'v'})
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:openExplorer(node) {{{1
 | 
			
		||||
function! s:openExplorer(node)
 | 
			
		||||
    call a:node.openExplorer()
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:openInNewTab(target) {{{1
 | 
			
		||||
function! s:openInNewTab(target)
 | 
			
		||||
    let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't'})
 | 
			
		||||
    call l:opener.open(a:target)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:openInNewTabSilent(target) {{{1
 | 
			
		||||
function! s:openInNewTabSilent(target)
 | 
			
		||||
    let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'stay': 1})
 | 
			
		||||
    call l:opener.open(a:target)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:openNodeRecursively(node) {{{1
 | 
			
		||||
function! s:openNodeRecursively(node)
 | 
			
		||||
    call nerdtree#echo("Recursively opening node. Please wait...")
 | 
			
		||||
    call a:node.openRecursively()
 | 
			
		||||
    call b:NERDTree.render()
 | 
			
		||||
    redraw
 | 
			
		||||
    call nerdtree#echo("Recursively opening node. Please wait... DONE")
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"FUNCTION: s:previewNodeCurrent(node) {{{1
 | 
			
		||||
function! s:previewNodeCurrent(node)
 | 
			
		||||
    call a:node.open({'stay': 1, 'where': 'p', 'keepopen': 1})
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"FUNCTION: s:previewNodeHSplit(node) {{{1
 | 
			
		||||
function! s:previewNodeHSplit(node)
 | 
			
		||||
    call a:node.open({'stay': 1, 'where': 'h', 'keepopen': 1})
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"FUNCTION: s:previewNodeVSplit(node) {{{1
 | 
			
		||||
function! s:previewNodeVSplit(node)
 | 
			
		||||
    call a:node.open({'stay': 1, 'where': 'v', 'keepopen': 1})
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: nerdtree#ui_glue#revealBookmark(name) {{{1
 | 
			
		||||
" put the cursor on the node associate with the given name
 | 
			
		||||
function! nerdtree#ui_glue#revealBookmark(name)
 | 
			
		||||
    try
 | 
			
		||||
        let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree)
 | 
			
		||||
        call targetNode.putCursorHere(0, 1)
 | 
			
		||||
    catch /^NERDTree.BookmarkNotFoundError/
 | 
			
		||||
        call nerdtree#echo("Bookmark isnt cached under the current root")
 | 
			
		||||
    endtry
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:refreshRoot() {{{1
 | 
			
		||||
" Reloads the current root. All nodes below this will be lost and the root dir
 | 
			
		||||
" will be reloaded.
 | 
			
		||||
function! s:refreshRoot()
 | 
			
		||||
    call nerdtree#echo("Refreshing the root node. This could take a while...")
 | 
			
		||||
    call b:NERDTree.root.refresh()
 | 
			
		||||
    call b:NERDTree.render()
 | 
			
		||||
    redraw
 | 
			
		||||
    call nerdtree#echo("Refreshing the root node. This could take a while... DONE")
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:refreshCurrent(node) {{{1
 | 
			
		||||
" refreshes the root for the current node
 | 
			
		||||
function! s:refreshCurrent(node)
 | 
			
		||||
    let node = a:node
 | 
			
		||||
    if !node.path.isDirectory
 | 
			
		||||
        let node = node.parent
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    call nerdtree#echo("Refreshing node. This could take a while...")
 | 
			
		||||
    call node.refresh()
 | 
			
		||||
    call b:NERDTree.render()
 | 
			
		||||
    redraw
 | 
			
		||||
    call nerdtree#echo("Refreshing node. This could take a while... DONE")
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: nerdtree#ui_glue#setupCommands() {{{1
 | 
			
		||||
function! nerdtree#ui_glue#setupCommands()
 | 
			
		||||
    command! -n=? -complete=dir -bar NERDTree :call g:NERDTreeCreator.CreateTabTree('<args>')
 | 
			
		||||
    command! -n=? -complete=dir -bar NERDTreeToggle :call g:NERDTreeCreator.ToggleTabTree('<args>')
 | 
			
		||||
    command! -n=0 -bar NERDTreeClose :call g:NERDTree.Close()
 | 
			
		||||
    command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.CreateTabTree('<args>')
 | 
			
		||||
    command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.CreateMirror()
 | 
			
		||||
    command! -n=? -complete=file -bar NERDTreeFind call s:findAndRevealPath('<args>')
 | 
			
		||||
    command! -n=0 -bar NERDTreeFocus call NERDTreeFocus()
 | 
			
		||||
    command! -n=0 -bar NERDTreeCWD call NERDTreeCWD()
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" Function: s:SID()   {{{1
 | 
			
		||||
function s:SID()
 | 
			
		||||
    if !exists("s:sid")
 | 
			
		||||
        let s:sid = matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$')
 | 
			
		||||
    endif
 | 
			
		||||
    return s:sid
 | 
			
		||||
endfun
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:showMenu(node) {{{1
 | 
			
		||||
function! s:showMenu(node)
 | 
			
		||||
    let mc = g:NERDTreeMenuController.New(g:NERDTreeMenuItem.AllEnabled())
 | 
			
		||||
    call mc.showMenu()
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:toggleIgnoreFilter() {{{1
 | 
			
		||||
function! s:toggleIgnoreFilter()
 | 
			
		||||
    call b:NERDTree.ui.toggleIgnoreFilter()
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:toggleShowBookmarks() {{{1
 | 
			
		||||
function! s:toggleShowBookmarks()
 | 
			
		||||
    call b:NERDTree.ui.toggleShowBookmarks()
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:toggleShowFiles() {{{1
 | 
			
		||||
function! s:toggleShowFiles()
 | 
			
		||||
    call b:NERDTree.ui.toggleShowFiles()
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:toggleShowHidden() {{{1
 | 
			
		||||
" toggles the display of hidden files
 | 
			
		||||
function! s:toggleShowHidden()
 | 
			
		||||
    call b:NERDTree.ui.toggleShowHidden()
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:toggleZoom() {{{1
 | 
			
		||||
function! s:toggleZoom()
 | 
			
		||||
    call b:NERDTree.ui.toggleZoom()
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: nerdtree#ui_glue#upDir(preserveState) {{{1
 | 
			
		||||
" Move the NERDTree up one level.
 | 
			
		||||
"
 | 
			
		||||
" Args:
 | 
			
		||||
" preserveState: if 1, the current root is left open when the new tree is
 | 
			
		||||
" rendered; if 0, the current root node is closed
 | 
			
		||||
function! nerdtree#ui_glue#upDir(preserveState)
 | 
			
		||||
 | 
			
		||||
    try
 | 
			
		||||
        call b:NERDTree.root.cacheParent()
 | 
			
		||||
    catch /^NERDTree.CannotCacheParentError/
 | 
			
		||||
        call nerdtree#echo('already at root directory')
 | 
			
		||||
        return
 | 
			
		||||
    endtry
 | 
			
		||||
 | 
			
		||||
    let l:oldRoot = b:NERDTree.root
 | 
			
		||||
    let l:newRoot = b:NERDTree.root.parent
 | 
			
		||||
 | 
			
		||||
    call l:newRoot.open()
 | 
			
		||||
    call l:newRoot.transplantChild(l:oldRoot)
 | 
			
		||||
 | 
			
		||||
    if !a:preserveState
 | 
			
		||||
        call l:oldRoot.close()
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    call b:NERDTree.changeRoot(l:newRoot)
 | 
			
		||||
    call l:oldRoot.putCursorHere(0, 0)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:upDirCurrentRootOpen() {{{1
 | 
			
		||||
function! s:upDirCurrentRootOpen()
 | 
			
		||||
    call nerdtree#ui_glue#upDir(1)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: s:upDirCurrentRootClosed() {{{1
 | 
			
		||||
function! s:upDirCurrentRootClosed()
 | 
			
		||||
    call nerdtree#ui_glue#upDir(0)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" vim: set sw=4 sts=4 et fdm=marker:
 | 
			
		||||
							
								
								
									
										1309
									
								
								vim/plugins/nerdtree/doc/NERDTree.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1309
									
								
								vim/plugins/nerdtree/doc/NERDTree.txt
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										40
									
								
								vim/plugins/nerdtree/nerdtree_plugin/exec_menuitem.vim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								vim/plugins/nerdtree/nerdtree_plugin/exec_menuitem.vim
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
" ============================================================================
 | 
			
		||||
" File:        exec_menuitem.vim
 | 
			
		||||
" Description: plugin for NERD Tree that provides an execute file menu item
 | 
			
		||||
" Maintainer:  Martin Grenfell <martin.grenfell at gmail dot com>
 | 
			
		||||
" License:     This program is free software. It comes without any warranty,
 | 
			
		||||
"              to the extent permitted by applicable law. You can redistribute
 | 
			
		||||
"              it and/or modify it under the terms of the Do What The Fuck You
 | 
			
		||||
"              Want To Public License, Version 2, as published by Sam Hocevar.
 | 
			
		||||
"              See http://sam.zoy.org/wtfpl/COPYING for more details.
 | 
			
		||||
"
 | 
			
		||||
" ============================================================================
 | 
			
		||||
if exists("g:loaded_nerdtree_exec_menuitem")
 | 
			
		||||
    finish
 | 
			
		||||
endif
 | 
			
		||||
let g:loaded_nerdtree_exec_menuitem = 1
 | 
			
		||||
 | 
			
		||||
call NERDTreeAddMenuItem({
 | 
			
		||||
            \ 'text': '(!)Execute file',
 | 
			
		||||
            \ 'shortcut': '!',
 | 
			
		||||
            \ 'callback': 'NERDTreeExecFile',
 | 
			
		||||
            \ 'isActiveCallback': 'NERDTreeExecFileActive' })
 | 
			
		||||
 | 
			
		||||
function! NERDTreeExecFileActive()
 | 
			
		||||
    let node = g:NERDTreeFileNode.GetSelected()
 | 
			
		||||
    return !node.path.isDirectory && node.path.isExecutable
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
function! NERDTreeExecFile()
 | 
			
		||||
    let treenode = g:NERDTreeFileNode.GetSelected()
 | 
			
		||||
    echo "==========================================================\n"
 | 
			
		||||
    echo "Complete the command to execute (add arguments etc):\n"
 | 
			
		||||
    let cmd = treenode.path.str({'escape': 1})
 | 
			
		||||
    let cmd = input(':!', cmd . ' ')
 | 
			
		||||
 | 
			
		||||
    if cmd != ''
 | 
			
		||||
        exec ':!' . cmd
 | 
			
		||||
    else
 | 
			
		||||
        echo "Aborted"
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
							
								
								
									
										365
									
								
								vim/plugins/nerdtree/nerdtree_plugin/fs_menu.vim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										365
									
								
								vim/plugins/nerdtree/nerdtree_plugin/fs_menu.vim
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,365 @@
 | 
			
		||||
" ============================================================================
 | 
			
		||||
" File:        fs_menu.vim
 | 
			
		||||
" Description: plugin for the NERD Tree that provides a file system menu
 | 
			
		||||
" Maintainer:  Martin Grenfell <martin.grenfell at gmail dot com>
 | 
			
		||||
" License:     This program is free software. It comes without any warranty,
 | 
			
		||||
"              to the extent permitted by applicable law. You can redistribute
 | 
			
		||||
"              it and/or modify it under the terms of the Do What The Fuck You
 | 
			
		||||
"              Want To Public License, Version 2, as published by Sam Hocevar.
 | 
			
		||||
"              See http://sam.zoy.org/wtfpl/COPYING for more details.
 | 
			
		||||
"
 | 
			
		||||
" ============================================================================
 | 
			
		||||
if exists("g:loaded_nerdtree_fs_menu")
 | 
			
		||||
    finish
 | 
			
		||||
endif
 | 
			
		||||
let g:loaded_nerdtree_fs_menu = 1
 | 
			
		||||
 | 
			
		||||
"Automatically delete the buffer after deleting or renaming a file
 | 
			
		||||
if !exists("g:NERDTreeAutoDeleteBuffer")
 | 
			
		||||
    let g:NERDTreeAutoDeleteBuffer = 0
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callback': 'NERDTreeAddNode'})
 | 
			
		||||
call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'})
 | 
			
		||||
call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})
 | 
			
		||||
 | 
			
		||||
if has("gui_mac") || has("gui_macvim") || has("mac")
 | 
			
		||||
    call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'})
 | 
			
		||||
    call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'})
 | 
			
		||||
    call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'})
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
if executable("xdg-open")
 | 
			
		||||
    call NERDTreeAddMenuItem({'text': '(r)eveal the current node in file manager', 'shortcut': 'r', 'callback': 'NERDTreeRevealFileLinux'})
 | 
			
		||||
    call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileLinux'})
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
if g:NERDTreePath.CopyingSupported()
 | 
			
		||||
    call NERDTreeAddMenuItem({'text': '(c)opy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'})
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
if has("unix") || has("osx")
 | 
			
		||||
    call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNode'})
 | 
			
		||||
else
 | 
			
		||||
    call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNodeWin32'})
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
"FUNCTION: s:promptToDelBuffer(bufnum, msg){{{1
 | 
			
		||||
"prints out the given msg and, if the user responds by pushing 'y' then the
 | 
			
		||||
"buffer with the given bufnum is deleted
 | 
			
		||||
"
 | 
			
		||||
"Args:
 | 
			
		||||
"bufnum: the buffer that may be deleted
 | 
			
		||||
"msg: a message that will be echoed to the user asking them if they wish to
 | 
			
		||||
"     del the buffer
 | 
			
		||||
function! s:promptToDelBuffer(bufnum, msg)
 | 
			
		||||
    echo a:msg
 | 
			
		||||
    if g:NERDTreeAutoDeleteBuffer || nr2char(getchar()) ==# 'y'
 | 
			
		||||
        " 1. ensure that all windows which display the just deleted filename
 | 
			
		||||
        " now display an empty buffer (so a layout is preserved).
 | 
			
		||||
        " Is not it better to close single tabs with this file only ?
 | 
			
		||||
        let s:originalTabNumber = tabpagenr()
 | 
			
		||||
        let s:originalWindowNumber = winnr()
 | 
			
		||||
        " Go to the next buffer in buffer list if at least one extra buffer is listed
 | 
			
		||||
        " Otherwise open a new empty buffer
 | 
			
		||||
        if v:version >= 800
 | 
			
		||||
            let l:listedBufferCount = len(getbufinfo({'buflisted':1}))
 | 
			
		||||
        elseif v:version >= 702
 | 
			
		||||
            let l:listedBufferCount = len(filter(range(1, bufnr('$')), 'buflisted(v:val)'))
 | 
			
		||||
        else
 | 
			
		||||
            " Ignore buffer count in this case to make sure we keep the old
 | 
			
		||||
            " behavior
 | 
			
		||||
            let l:listedBufferCount = 0
 | 
			
		||||
        endif
 | 
			
		||||
        if l:listedBufferCount > 1
 | 
			
		||||
            exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':bnext! ' | endif"
 | 
			
		||||
        else
 | 
			
		||||
            exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':enew! ' | endif"
 | 
			
		||||
        endif
 | 
			
		||||
        exec "tabnext " . s:originalTabNumber
 | 
			
		||||
        exec s:originalWindowNumber . "wincmd w"
 | 
			
		||||
        " 3. We don't need a previous buffer anymore
 | 
			
		||||
        exec "bwipeout! " . a:bufnum
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"FUNCTION: s:promptToRenameBuffer(bufnum, msg){{{1
 | 
			
		||||
"prints out the given msg and, if the user responds by pushing 'y' then the
 | 
			
		||||
"buffer with the given bufnum is replaced with a new one
 | 
			
		||||
"
 | 
			
		||||
"Args:
 | 
			
		||||
"bufnum: the buffer that may be deleted
 | 
			
		||||
"msg: a message that will be echoed to the user asking them if they wish to
 | 
			
		||||
"     del the buffer
 | 
			
		||||
function! s:promptToRenameBuffer(bufnum, msg, newFileName)
 | 
			
		||||
    echo a:msg
 | 
			
		||||
    if g:NERDTreeAutoDeleteBuffer || nr2char(getchar()) ==# 'y'
 | 
			
		||||
        let quotedFileName = fnameescape(a:newFileName)
 | 
			
		||||
        " 1. ensure that a new buffer is loaded
 | 
			
		||||
        exec "badd " . quotedFileName
 | 
			
		||||
        " 2. ensure that all windows which display the just deleted filename
 | 
			
		||||
        " display a buffer for a new filename.
 | 
			
		||||
        let s:originalTabNumber = tabpagenr()
 | 
			
		||||
        let s:originalWindowNumber = winnr()
 | 
			
		||||
        let editStr = g:NERDTreePath.New(a:newFileName).str({'format': 'Edit'})
 | 
			
		||||
        exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':e! " . editStr . "' | endif"
 | 
			
		||||
        exec "tabnext " . s:originalTabNumber
 | 
			
		||||
        exec s:originalWindowNumber . "wincmd w"
 | 
			
		||||
        " 3. We don't need a previous buffer anymore
 | 
			
		||||
        exec "bwipeout! " . a:bufnum
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
"FUNCTION: NERDTreeAddNode(){{{1
 | 
			
		||||
function! NERDTreeAddNode()
 | 
			
		||||
    let curDirNode = g:NERDTreeDirNode.GetSelected()
 | 
			
		||||
 | 
			
		||||
    let newNodeName = input("Add a childnode\n".
 | 
			
		||||
                          \ "==========================================================\n".
 | 
			
		||||
                          \ "Enter the dir/file name to be created. Dirs end with a '/'\n" .
 | 
			
		||||
                          \ "", curDirNode.path.str() . g:NERDTreePath.Slash(), "file")
 | 
			
		||||
 | 
			
		||||
    if newNodeName ==# ''
 | 
			
		||||
        call nerdtree#echo("Node Creation Aborted.")
 | 
			
		||||
        return
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    try
 | 
			
		||||
        let newPath = g:NERDTreePath.Create(newNodeName)
 | 
			
		||||
        let parentNode = b:NERDTree.root.findNode(newPath.getParent())
 | 
			
		||||
 | 
			
		||||
        let newTreeNode = g:NERDTreeFileNode.New(newPath, b:NERDTree)
 | 
			
		||||
        if empty(parentNode)
 | 
			
		||||
            call b:NERDTree.root.refresh()
 | 
			
		||||
            call b:NERDTree.render()
 | 
			
		||||
        elseif parentNode.isOpen || !empty(parentNode.children)
 | 
			
		||||
            call parentNode.addChild(newTreeNode, 1)
 | 
			
		||||
            call NERDTreeRender()
 | 
			
		||||
            call newTreeNode.putCursorHere(1, 0)
 | 
			
		||||
        endif
 | 
			
		||||
    catch /^NERDTree/
 | 
			
		||||
        call nerdtree#echoWarning("Node Not Created.")
 | 
			
		||||
    endtry
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"FUNCTION: NERDTreeMoveNode(){{{1
 | 
			
		||||
function! NERDTreeMoveNode()
 | 
			
		||||
    let curNode = g:NERDTreeFileNode.GetSelected()
 | 
			
		||||
    let newNodePath = input("Rename the current node\n" .
 | 
			
		||||
                          \ "==========================================================\n" .
 | 
			
		||||
                          \ "Enter the new path for the node:                          \n" .
 | 
			
		||||
                          \ "", curNode.path.str(), "file")
 | 
			
		||||
 | 
			
		||||
    if newNodePath ==# ''
 | 
			
		||||
        call nerdtree#echo("Node Renaming Aborted.")
 | 
			
		||||
        return
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    try
 | 
			
		||||
        let bufnum = bufnr("^".curNode.path.str()."$")
 | 
			
		||||
 | 
			
		||||
        call curNode.rename(newNodePath)
 | 
			
		||||
        call b:NERDTree.root.refresh()
 | 
			
		||||
        call NERDTreeRender()
 | 
			
		||||
 | 
			
		||||
        "if the node is open in a buffer, ask the user if they want to
 | 
			
		||||
        "close that buffer
 | 
			
		||||
        if bufnum != -1
 | 
			
		||||
            let prompt = "\nNode renamed.\n\nThe old file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Replace this buffer with the new file? (yN)"
 | 
			
		||||
            call s:promptToRenameBuffer(bufnum,  prompt, newNodePath)
 | 
			
		||||
        endif
 | 
			
		||||
 | 
			
		||||
        call curNode.putCursorHere(1, 0)
 | 
			
		||||
 | 
			
		||||
        redraw
 | 
			
		||||
    catch /^NERDTree/
 | 
			
		||||
        call nerdtree#echoWarning("Node Not Renamed.")
 | 
			
		||||
    endtry
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: NERDTreeDeleteNode() {{{1
 | 
			
		||||
function! NERDTreeDeleteNode()
 | 
			
		||||
    let currentNode = g:NERDTreeFileNode.GetSelected()
 | 
			
		||||
    let confirmed = 0
 | 
			
		||||
 | 
			
		||||
    if currentNode.path.isDirectory && ((currentNode.isOpen && currentNode.getChildCount() > 0) ||
 | 
			
		||||
                                      \ (len(currentNode._glob('*', 1)) > 0))
 | 
			
		||||
        let choice =input("Delete the current node\n" .
 | 
			
		||||
                         \ "==========================================================\n" .
 | 
			
		||||
                         \ "STOP! Directory is not empty! To delete, type 'yes'\n" .
 | 
			
		||||
                         \ "" . currentNode.path.str() . ": ")
 | 
			
		||||
        let confirmed = choice ==# 'yes'
 | 
			
		||||
    else
 | 
			
		||||
        echo "Delete the current node\n" .
 | 
			
		||||
           \ "==========================================================\n".
 | 
			
		||||
           \ "Are you sure you wish to delete the node:\n" .
 | 
			
		||||
           \ "" . currentNode.path.str() . " (yN):"
 | 
			
		||||
        let choice = nr2char(getchar())
 | 
			
		||||
        let confirmed = choice ==# 'y'
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    if confirmed
 | 
			
		||||
        try
 | 
			
		||||
            call currentNode.delete()
 | 
			
		||||
            call NERDTreeRender()
 | 
			
		||||
 | 
			
		||||
            "if the node is open in a buffer, ask the user if they want to
 | 
			
		||||
            "close that buffer
 | 
			
		||||
            let bufnum = bufnr("^".currentNode.path.str()."$")
 | 
			
		||||
            if buflisted(bufnum)
 | 
			
		||||
                let prompt = "\nNode deleted.\n\nThe file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
 | 
			
		||||
                call s:promptToDelBuffer(bufnum, prompt)
 | 
			
		||||
            endif
 | 
			
		||||
 | 
			
		||||
            redraw
 | 
			
		||||
        catch /^NERDTree/
 | 
			
		||||
            call nerdtree#echoWarning("Could not remove node")
 | 
			
		||||
        endtry
 | 
			
		||||
    else
 | 
			
		||||
        call nerdtree#echo("delete aborted")
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: NERDTreeListNode() {{{1
 | 
			
		||||
function! NERDTreeListNode()
 | 
			
		||||
    let treenode = g:NERDTreeFileNode.GetSelected()
 | 
			
		||||
    if !empty(treenode)
 | 
			
		||||
        let s:uname = system("uname")
 | 
			
		||||
        let stat_cmd = 'stat -c "%s" ' 
 | 
			
		||||
        
 | 
			
		||||
        if s:uname =~? "Darwin"                
 | 
			
		||||
            let stat_cmd = 'stat -f "%z" '
 | 
			
		||||
        endif
 | 
			
		||||
 | 
			
		||||
        let cmd = 'size=$(' . stat_cmd . shellescape(treenode.path.str()) . ') && ' .
 | 
			
		||||
        \         'size_with_commas=$(echo $size | sed -e :a -e "s/\(.*[0-9]\)\([0-9]\{3\}\)/\1,\2/;ta") && ' .
 | 
			
		||||
        \         'ls -ld ' . shellescape(treenode.path.str()) . ' | sed -e "s/ $size / $size_with_commas /"'
 | 
			
		||||
 | 
			
		||||
        let metadata = split(system(cmd),'\n')
 | 
			
		||||
        call nerdtree#echo(metadata[0])
 | 
			
		||||
    else
 | 
			
		||||
        call nerdtree#echo("No information available")
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: NERDTreeListNodeWin32() {{{1
 | 
			
		||||
function! NERDTreeListNodeWin32()
 | 
			
		||||
    let l:node = g:NERDTreeFileNode.GetSelected()
 | 
			
		||||
 | 
			
		||||
    if !empty(l:node)
 | 
			
		||||
 | 
			
		||||
        let l:save_shell = &shell
 | 
			
		||||
        set shell&
 | 
			
		||||
 | 
			
		||||
        if exists('+shellslash')
 | 
			
		||||
            let l:save_shellslash = &shellslash
 | 
			
		||||
            set noshellslash
 | 
			
		||||
        endif
 | 
			
		||||
 | 
			
		||||
        let l:command = 'DIR /Q '
 | 
			
		||||
                    \ . shellescape(l:node.path.str())
 | 
			
		||||
                    \ . ' | FINDSTR "^[012][0-9]/[0-3][0-9]/[12][0-9][0-9][0-9]"'
 | 
			
		||||
 | 
			
		||||
        let l:metadata = split(system(l:command), "\n")
 | 
			
		||||
 | 
			
		||||
        if v:shell_error == 0
 | 
			
		||||
            call nerdtree#echo(l:metadata[0])
 | 
			
		||||
        else
 | 
			
		||||
            call nerdtree#echoError('shell command failed')
 | 
			
		||||
        endif
 | 
			
		||||
 | 
			
		||||
        let &shell = l:save_shell
 | 
			
		||||
 | 
			
		||||
        if exists('l:save_shellslash')
 | 
			
		||||
            let &shellslash = l:save_shellslash
 | 
			
		||||
        endif
 | 
			
		||||
 | 
			
		||||
        return
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
    call nerdtree#echo('node not recognized')
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: NERDTreeCopyNode() {{{1
 | 
			
		||||
function! NERDTreeCopyNode()
 | 
			
		||||
    let currentNode = g:NERDTreeFileNode.GetSelected()
 | 
			
		||||
    let newNodePath = input("Copy the current node\n" .
 | 
			
		||||
                          \ "==========================================================\n" .
 | 
			
		||||
                          \ "Enter the new path to copy the node to:                   \n" .
 | 
			
		||||
                          \ "", currentNode.path.str(), "file")
 | 
			
		||||
 | 
			
		||||
    if newNodePath != ""
 | 
			
		||||
        "strip trailing slash
 | 
			
		||||
        let newNodePath = substitute(newNodePath, '\/$', '', '')
 | 
			
		||||
 | 
			
		||||
        let confirmed = 1
 | 
			
		||||
        if currentNode.path.copyingWillOverwrite(newNodePath)
 | 
			
		||||
            call nerdtree#echo("Warning: copying may overwrite files! Continue? (yN)")
 | 
			
		||||
            let choice = nr2char(getchar())
 | 
			
		||||
            let confirmed = choice ==# 'y'
 | 
			
		||||
        endif
 | 
			
		||||
 | 
			
		||||
        if confirmed
 | 
			
		||||
            try
 | 
			
		||||
                let newNode = currentNode.copy(newNodePath)
 | 
			
		||||
                if empty(newNode)
 | 
			
		||||
                    call b:NERDTree.root.refresh()
 | 
			
		||||
                    call b:NERDTree.render()
 | 
			
		||||
                else
 | 
			
		||||
                    call NERDTreeRender()
 | 
			
		||||
                    call newNode.putCursorHere(0, 0)
 | 
			
		||||
                endif
 | 
			
		||||
            catch /^NERDTree/
 | 
			
		||||
                call nerdtree#echoWarning("Could not copy node")
 | 
			
		||||
            endtry
 | 
			
		||||
        endif
 | 
			
		||||
    else
 | 
			
		||||
        call nerdtree#echo("Copy aborted.")
 | 
			
		||||
    endif
 | 
			
		||||
    redraw
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: NERDTreeQuickLook() {{{1
 | 
			
		||||
function! NERDTreeQuickLook()
 | 
			
		||||
    let treenode = g:NERDTreeFileNode.GetSelected()
 | 
			
		||||
    if treenode != {}
 | 
			
		||||
        call system("qlmanage -p 2>/dev/null '" . treenode.path.str() . "'")
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: NERDTreeRevealInFinder() {{{1
 | 
			
		||||
function! NERDTreeRevealInFinder()
 | 
			
		||||
    let treenode = g:NERDTreeFileNode.GetSelected()
 | 
			
		||||
    if treenode != {}
 | 
			
		||||
        call system("open -R '" . treenode.path.str() . "'")
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: NERDTreeExecuteFile() {{{1
 | 
			
		||||
function! NERDTreeExecuteFile()
 | 
			
		||||
    let treenode = g:NERDTreeFileNode.GetSelected()
 | 
			
		||||
    if treenode != {}
 | 
			
		||||
        call system("open '" . treenode.path.str() . "'")
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: NERDTreeRevealFileLinux() {{{1
 | 
			
		||||
function! NERDTreeRevealFileLinux()
 | 
			
		||||
    let treenode = g:NERDTreeFileNode.GetSelected()
 | 
			
		||||
    let parentnode = treenode.parent
 | 
			
		||||
    if parentnode != {}
 | 
			
		||||
        call system("xdg-open '" . parentnode.path.str() . "' &")
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" FUNCTION: NERDTreeExecuteFileLinux() {{{1
 | 
			
		||||
function! NERDTreeExecuteFileLinux()
 | 
			
		||||
    let treenode = g:NERDTreeFileNode.GetSelected()
 | 
			
		||||
    if treenode != {}
 | 
			
		||||
        call system("xdg-open '" . treenode.path.str() . "' &")
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" vim: set sw=4 sts=4 et fdm=marker:
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										219
									
								
								vim/plugins/nerdtree/plugin/NERD_tree.vim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										219
									
								
								vim/plugins/nerdtree/plugin/NERD_tree.vim
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,219 @@
 | 
			
		||||
" ============================================================================
 | 
			
		||||
" File:        NERD_tree.vim
 | 
			
		||||
" Maintainer:  Martin Grenfell <martin.grenfell at gmail dot com>
 | 
			
		||||
" License:     This program is free software. It comes without any warranty,
 | 
			
		||||
"              to the extent permitted by applicable law. You can redistribute
 | 
			
		||||
"              it and/or modify it under the terms of the Do What The Fuck You
 | 
			
		||||
"              Want To Public License, Version 2, as published by Sam Hocevar.
 | 
			
		||||
"              See http://sam.zoy.org/wtfpl/COPYING for more details.
 | 
			
		||||
"
 | 
			
		||||
" ============================================================================
 | 
			
		||||
"
 | 
			
		||||
" SECTION: Script init stuff {{{1
 | 
			
		||||
"============================================================
 | 
			
		||||
if exists("loaded_nerd_tree")
 | 
			
		||||
    finish
 | 
			
		||||
endif
 | 
			
		||||
if v:version < 700
 | 
			
		||||
    echoerr "NERDTree: this plugin requires vim >= 7. DOWNLOAD IT! You'll thank me later!"
 | 
			
		||||
    finish
 | 
			
		||||
endif
 | 
			
		||||
let loaded_nerd_tree = 1
 | 
			
		||||
 | 
			
		||||
"for line continuation - i.e dont want C in &cpo
 | 
			
		||||
let s:old_cpo = &cpo
 | 
			
		||||
set cpo&vim
 | 
			
		||||
 | 
			
		||||
"Function: s:initVariable() function {{{2
 | 
			
		||||
"This function is used to initialise a given variable to a given value. The
 | 
			
		||||
"variable is only initialised if it does not exist prior
 | 
			
		||||
"
 | 
			
		||||
"Args:
 | 
			
		||||
"var: the name of the var to be initialised
 | 
			
		||||
"value: the value to initialise var to
 | 
			
		||||
"
 | 
			
		||||
"Returns:
 | 
			
		||||
"1 if the var is set, 0 otherwise
 | 
			
		||||
function! s:initVariable(var, value)
 | 
			
		||||
    if !exists(a:var)
 | 
			
		||||
        exec 'let ' . a:var . ' = ' . "'" . substitute(a:value, "'", "''", "g") . "'"
 | 
			
		||||
        return 1
 | 
			
		||||
    endif
 | 
			
		||||
    return 0
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
"SECTION: Init variable calls and other random constants {{{2
 | 
			
		||||
call s:initVariable("g:NERDTreeAutoCenter", 1)
 | 
			
		||||
call s:initVariable("g:NERDTreeAutoCenterThreshold", 3)
 | 
			
		||||
call s:initVariable("g:NERDTreeCaseSensitiveSort", 0)
 | 
			
		||||
call s:initVariable("g:NERDTreeNaturalSort", 0)
 | 
			
		||||
call s:initVariable("g:NERDTreeSortHiddenFirst", 1)
 | 
			
		||||
call s:initVariable("g:NERDTreeChDirMode", 0)
 | 
			
		||||
call s:initVariable("g:NERDTreeCreatePrefix", "silent")
 | 
			
		||||
call s:initVariable("g:NERDTreeMinimalUI", 0)
 | 
			
		||||
if !exists("g:NERDTreeIgnore")
 | 
			
		||||
    let g:NERDTreeIgnore = ['\~$']
 | 
			
		||||
endif
 | 
			
		||||
call s:initVariable("g:NERDTreeBookmarksFile", expand('$HOME') . '/.NERDTreeBookmarks')
 | 
			
		||||
call s:initVariable("g:NERDTreeBookmarksSort", 1)
 | 
			
		||||
call s:initVariable("g:NERDTreeHighlightCursorline", 1)
 | 
			
		||||
call s:initVariable("g:NERDTreeHijackNetrw", 1)
 | 
			
		||||
call s:initVariable('g:NERDTreeMarkBookmarks', 1)
 | 
			
		||||
call s:initVariable("g:NERDTreeMouseMode", 1)
 | 
			
		||||
call s:initVariable("g:NERDTreeNotificationThreshold", 100)
 | 
			
		||||
call s:initVariable("g:NERDTreeQuitOnOpen", 0)
 | 
			
		||||
call s:initVariable("g:NERDTreeRespectWildIgnore", 0)
 | 
			
		||||
call s:initVariable("g:NERDTreeShowBookmarks", 0)
 | 
			
		||||
call s:initVariable("g:NERDTreeShowFiles", 1)
 | 
			
		||||
call s:initVariable("g:NERDTreeShowHidden", 0)
 | 
			
		||||
call s:initVariable("g:NERDTreeShowLineNumbers", 0)
 | 
			
		||||
call s:initVariable("g:NERDTreeSortDirs", 1)
 | 
			
		||||
 | 
			
		||||
if !nerdtree#runningWindows() && !nerdtree#runningCygwin()
 | 
			
		||||
    call s:initVariable("g:NERDTreeDirArrowExpandable", "▸")
 | 
			
		||||
    call s:initVariable("g:NERDTreeDirArrowCollapsible", "▾")
 | 
			
		||||
else
 | 
			
		||||
    call s:initVariable("g:NERDTreeDirArrowExpandable", "+")
 | 
			
		||||
    call s:initVariable("g:NERDTreeDirArrowCollapsible", "~")
 | 
			
		||||
endif
 | 
			
		||||
call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1)
 | 
			
		||||
call s:initVariable("g:NERDTreeCascadeSingleChildDir", 1)
 | 
			
		||||
 | 
			
		||||
if !exists("g:NERDTreeSortOrder")
 | 
			
		||||
    let g:NERDTreeSortOrder = ['\/$', '*', '\.swp$',  '\.bak$', '\~$']
 | 
			
		||||
endif
 | 
			
		||||
let g:NERDTreeOldSortOrder = []
 | 
			
		||||
 | 
			
		||||
call s:initVariable("g:NERDTreeGlyphReadOnly", "RO")
 | 
			
		||||
 | 
			
		||||
if !exists('g:NERDTreeStatusline')
 | 
			
		||||
 | 
			
		||||
    "the exists() crap here is a hack to stop vim spazzing out when
 | 
			
		||||
    "loading a session that was created with an open nerd tree. It spazzes
 | 
			
		||||
    "because it doesnt store b:NERDTree(its a b: var, and its a hash)
 | 
			
		||||
    let g:NERDTreeStatusline = "%{exists('b:NERDTree')?b:NERDTree.root.path.str():''}"
 | 
			
		||||
 | 
			
		||||
endif
 | 
			
		||||
call s:initVariable("g:NERDTreeWinPos", "left")
 | 
			
		||||
call s:initVariable("g:NERDTreeWinSize", 31)
 | 
			
		||||
 | 
			
		||||
"init the shell commands that will be used to copy nodes, and remove dir trees
 | 
			
		||||
"
 | 
			
		||||
"Note: the space after the command is important
 | 
			
		||||
if nerdtree#runningWindows()
 | 
			
		||||
    call s:initVariable("g:NERDTreeRemoveDirCmd", 'rmdir /s /q ')
 | 
			
		||||
    call s:initVariable("g:NERDTreeCopyDirCmd", 'xcopy /s /e /i /y /q ')
 | 
			
		||||
    call s:initVariable("g:NERDTreeCopyFileCmd", 'copy /y ')
 | 
			
		||||
else
 | 
			
		||||
    call s:initVariable("g:NERDTreeRemoveDirCmd", 'rm -rf ')
 | 
			
		||||
    call s:initVariable("g:NERDTreeCopyCmd", 'cp -r ')
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
"SECTION: Init variable calls for key mappings {{{2
 | 
			
		||||
call s:initVariable("g:NERDTreeMapActivateNode", "o")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapChangeRoot", "C")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapChdir", "cd")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapCloseChildren", "X")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapCloseDir", "x")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapDeleteBookmark", "D")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapMenu", "m")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapHelp", "?")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapJumpFirstChild", "K")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapJumpLastChild", "J")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapJumpNextSibling", "<C-j>")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapJumpParent", "p")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapJumpPrevSibling", "<C-k>")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapJumpRoot", "P")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapOpenExpl", "e")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapOpenInTab", "t")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapOpenInTabSilent", "T")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapOpenRecursively", "O")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapOpenSplit", "i")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapOpenVSplit", "s")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapPreview", "g" . NERDTreeMapActivateNode)
 | 
			
		||||
call s:initVariable("g:NERDTreeMapPreviewSplit", "g" . NERDTreeMapOpenSplit)
 | 
			
		||||
call s:initVariable("g:NERDTreeMapPreviewVSplit", "g" . NERDTreeMapOpenVSplit)
 | 
			
		||||
call s:initVariable("g:NERDTreeMapQuit", "q")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapRefresh", "r")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapRefreshRoot", "R")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapToggleBookmarks", "B")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapToggleFiles", "F")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapToggleFilters", "f")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapToggleHidden", "I")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapToggleZoom", "A")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapUpdir", "u")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapUpdirKeepOpen", "U")
 | 
			
		||||
call s:initVariable("g:NERDTreeMapCWD", "CD")
 | 
			
		||||
 | 
			
		||||
"SECTION: Load class files{{{2
 | 
			
		||||
call nerdtree#loadClassFiles()
 | 
			
		||||
 | 
			
		||||
" SECTION: Commands {{{1
 | 
			
		||||
"============================================================
 | 
			
		||||
call nerdtree#ui_glue#setupCommands()
 | 
			
		||||
 | 
			
		||||
" SECTION: Auto commands {{{1
 | 
			
		||||
"============================================================
 | 
			
		||||
augroup NERDTree
 | 
			
		||||
    "Save the cursor position whenever we close the nerd tree
 | 
			
		||||
    exec "autocmd BufLeave ". g:NERDTreeCreator.BufNamePrefix() ."* if g:NERDTree.IsOpen() | call b:NERDTree.ui.saveScreenState() | endif"
 | 
			
		||||
 | 
			
		||||
    "disallow insert mode in the NERDTree
 | 
			
		||||
    exec "autocmd BufEnter ". g:NERDTreeCreator.BufNamePrefix() ."* stopinsert"
 | 
			
		||||
augroup END
 | 
			
		||||
 | 
			
		||||
if g:NERDTreeHijackNetrw
 | 
			
		||||
    augroup NERDTreeHijackNetrw
 | 
			
		||||
        autocmd VimEnter * silent! autocmd! FileExplorer
 | 
			
		||||
        au BufEnter,VimEnter * call nerdtree#checkForBrowse(expand("<amatch>"))
 | 
			
		||||
    augroup END
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
" SECTION: Public API {{{1
 | 
			
		||||
"============================================================
 | 
			
		||||
function! NERDTreeAddMenuItem(options)
 | 
			
		||||
    call g:NERDTreeMenuItem.Create(a:options)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
function! NERDTreeAddMenuSeparator(...)
 | 
			
		||||
    let opts = a:0 ? a:1 : {}
 | 
			
		||||
    call g:NERDTreeMenuItem.CreateSeparator(opts)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
function! NERDTreeAddSubmenu(options)
 | 
			
		||||
    return g:NERDTreeMenuItem.Create(a:options)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
function! NERDTreeAddKeyMap(options)
 | 
			
		||||
    call g:NERDTreeKeyMap.Create(a:options)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
function! NERDTreeRender()
 | 
			
		||||
    call nerdtree#renderView()
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
function! NERDTreeFocus()
 | 
			
		||||
    if g:NERDTree.IsOpen()
 | 
			
		||||
        call g:NERDTree.CursorToTreeWin()
 | 
			
		||||
    else
 | 
			
		||||
        call g:NERDTreeCreator.ToggleTabTree("")
 | 
			
		||||
    endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
function! NERDTreeCWD()
 | 
			
		||||
    call NERDTreeFocus()
 | 
			
		||||
    call nerdtree#ui_glue#chRootCwd()
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
function! NERDTreeAddPathFilter(callback)
 | 
			
		||||
    call g:NERDTree.AddPathFilter(a:callback)
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
" SECTION: Post Source Actions {{{1
 | 
			
		||||
call nerdtree#postSourceActions()
 | 
			
		||||
 | 
			
		||||
"reset &cpo back to users setting
 | 
			
		||||
let &cpo = s:old_cpo
 | 
			
		||||
 | 
			
		||||
" vim: set sw=4 sts=4 et fdm=marker:
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								vim/plugins/nerdtree/screenshot.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								vim/plugins/nerdtree/screenshot.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 86 KiB  | 
							
								
								
									
										82
									
								
								vim/plugins/nerdtree/syntax/nerdtree.vim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								vim/plugins/nerdtree/syntax/nerdtree.vim
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,82 @@
 | 
			
		||||
let s:tree_up_dir_line = '.. (up a dir)'
 | 
			
		||||
syn match NERDTreeIgnore #\~#
 | 
			
		||||
exec 'syn match NERDTreeIgnore #\['.g:NERDTreeGlyphReadOnly.'\]#'
 | 
			
		||||
 | 
			
		||||
"highlighting for the .. (up dir) line at the top of the tree
 | 
			
		||||
execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
 | 
			
		||||
 | 
			
		||||
"quickhelp syntax elements
 | 
			
		||||
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#ms=s+2,me=e-1
 | 
			
		||||
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#ms=s+2,me=e-1
 | 
			
		||||
syn match NERDTreeHelpTitle #" .*\~$#ms=s+2,me=e-1
 | 
			
		||||
syn match NERDTreeToggleOn #(on)#ms=s+1,he=e-1
 | 
			
		||||
syn match NERDTreeToggleOff #(off)#ms=e-3,me=e-1
 | 
			
		||||
syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3
 | 
			
		||||
syn match NERDTreeHelp  #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeIgnore,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand
 | 
			
		||||
 | 
			
		||||
"highlighting for sym links
 | 
			
		||||
syn match NERDTreeLinkTarget #->.*# containedin=NERDTreeDir,NERDTreeFile
 | 
			
		||||
syn match NERDTreeLinkFile #.* ->#me=e-3 containedin=NERDTreeFile
 | 
			
		||||
syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir
 | 
			
		||||
 | 
			
		||||
"highlighing for directory nodes and file nodes
 | 
			
		||||
syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
 | 
			
		||||
 | 
			
		||||
exec 'syn match NERDTreeClosable #' . escape(g:NERDTreeDirArrowCollapsible, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
 | 
			
		||||
exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
 | 
			
		||||
 | 
			
		||||
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
 | 
			
		||||
exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
 | 
			
		||||
syn match NERDTreeExecFile  #^ .*\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark
 | 
			
		||||
exec 'syn match NERDTreeFile  #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
 | 
			
		||||
 | 
			
		||||
"highlighting for readonly files
 | 
			
		||||
exec 'syn match NERDTreeRO # *\zs.*\ze \['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
 | 
			
		||||
 | 
			
		||||
syn match NERDTreeFlags #^ *\zs\[.\]# containedin=NERDTreeFile,NERDTreeExecFile
 | 
			
		||||
syn match NERDTreeFlags #\[.\]# containedin=NERDTreeDir
 | 
			
		||||
 | 
			
		||||
syn match NERDTreeCWD #^[</].*$#
 | 
			
		||||
 | 
			
		||||
"highlighting for bookmarks
 | 
			
		||||
syn match NERDTreeBookmark # {.*}#hs=s+1
 | 
			
		||||
 | 
			
		||||
"highlighting for the bookmarks table
 | 
			
		||||
syn match NERDTreeBookmarksLeader #^>#
 | 
			
		||||
syn match NERDTreeBookmarksHeader #^>-\+Bookmarks-\+$# contains=NERDTreeBookmarksLeader
 | 
			
		||||
syn match NERDTreeBookmarkName #^>.\{-} #he=e-1 contains=NERDTreeBookmarksLeader
 | 
			
		||||
syn match NERDTreeBookmark #^>.*$# contains=NERDTreeBookmarksLeader,NERDTreeBookmarkName,NERDTreeBookmarksHeader
 | 
			
		||||
 | 
			
		||||
hi def link NERDTreePart Special
 | 
			
		||||
hi def link NERDTreePartFile Type
 | 
			
		||||
hi def link NERDTreeExecFile Title
 | 
			
		||||
hi def link NERDTreeDirSlash Identifier
 | 
			
		||||
 | 
			
		||||
hi def link NERDTreeBookmarksHeader statement
 | 
			
		||||
hi def link NERDTreeBookmarksLeader ignore
 | 
			
		||||
hi def link NERDTreeBookmarkName Identifier
 | 
			
		||||
hi def link NERDTreeBookmark normal
 | 
			
		||||
 | 
			
		||||
hi def link NERDTreeHelp String
 | 
			
		||||
hi def link NERDTreeHelpKey Identifier
 | 
			
		||||
hi def link NERDTreeHelpCommand Identifier
 | 
			
		||||
hi def link NERDTreeHelpTitle Macro
 | 
			
		||||
hi def link NERDTreeToggleOn Question
 | 
			
		||||
hi def link NERDTreeToggleOff WarningMsg
 | 
			
		||||
 | 
			
		||||
hi def link NERDTreeLinkTarget Type
 | 
			
		||||
hi def link NERDTreeLinkFile Macro
 | 
			
		||||
hi def link NERDTreeLinkDir Macro
 | 
			
		||||
 | 
			
		||||
hi def link NERDTreeDir Directory
 | 
			
		||||
hi def link NERDTreeUp Directory
 | 
			
		||||
hi def link NERDTreeFile Normal
 | 
			
		||||
hi def link NERDTreeCWD Statement
 | 
			
		||||
hi def link NERDTreeOpenable Directory
 | 
			
		||||
hi def link NERDTreeClosable Directory
 | 
			
		||||
hi def link NERDTreeIgnore ignore
 | 
			
		||||
hi def link NERDTreeRO WarningMsg
 | 
			
		||||
hi def link NERDTreeBookmark Statement
 | 
			
		||||
hi def link NERDTreeFlags Number
 | 
			
		||||
 | 
			
		||||
hi def link NERDTreeCurrentNode Search
 | 
			
		||||
		Reference in New Issue
	
	Block a user