1 *NERD_tree.txt* A tree explorer plugin that owns your momma!
7 ________ ________ _ ____________ ____ __________ ____________~
8 /_ __/ / / / ____/ / | / / ____/ __ \/ __ \ /_ __/ __ \/ ____/ ____/~
9 / / / /_/ / __/ / |/ / __/ / /_/ / / / / / / / /_/ / __/ / __/ ~
10 / / / __ / /___ / /| / /___/ _, _/ /_/ / / / / _, _/ /___/ /___ ~
11 /_/ /_/ /_/_____/ /_/ |_/_____/_/ |_/_____/ /_/ /_/ |_/_____/_____/ ~
19 ==============================================================================
20 CONTENTS *NERDTree-contents*
22 1.Intro...................................|NERDTree|
23 2.Functionality provided..................|NERDTreeFunctionality|
24 2.1.Global commands...................|NERDTreeGlobalCommands|
25 2.2.Bookmarks.........................|NERDTreeBookmarks|
26 2.2.1.The bookmark table..........|NERDTreeBookmarkTable|
27 2.2.2.Bookmark commands...........|NERDTreeBookmarkCommands|
28 2.2.3.Invalid bookmarks...........|NERDTreeInvalidBookmarks|
29 2.3.NERD tree mappings................|NERDTreeMappings|
30 2.4.The NERD tree menu................|NERDTreeMenu|
31 3.Options.................................|NERDTreeOptions|
32 3.1.Option summary....................|NERDTreeOptionSummary|
33 3.2.Option details....................|NERDTreeOptionDetails|
34 4.The NERD tree API.......................|NERDTreeAPI|
35 4.1.Key map API.......................|NERDTreeKeymapAPI|
36 4.2.Menu API..........................|NERDTreeMenuAPI|
37 5.About...................................|NERDTreeAbout|
38 6.Changelog...............................|NERDTreeChangelog|
39 7.Credits.................................|NERDTreeCredits|
40 8.License.................................|NERDTreeLicense|
42 ==============================================================================
45 What is this "NERD tree"??
47 The NERD tree allows you to explore your filesystem and to open files and
48 directories. It presents the filesystem to you in the form of a tree which you
49 manipulate with the keyboard and/or mouse. It also allows you to perform
50 simple filesystem operations.
52 The following features and functionality are provided by the NERD tree:
53 * Files and directories are displayed in a hierarchical tree structure
54 * Different highlighting is provided for the following types of nodes:
61 * Many (customisable) mappings are provided to manipulate the tree:
62 * Mappings to open/close/explore directory nodes
63 * Mappings to open files in new/existing windows/tabs
64 * Mappings to change the current root of the tree
65 * Mappings to navigate around the tree
67 * Directories and files can be bookmarked.
68 * Most NERD tree navigation can also be done with the mouse
69 * Filtering of tree content (can be toggled at runtime)
70 * custom file filters to prevent e.g. vim backup files being displayed
71 * optional displaying of hidden files (. files)
72 * files can be "turned off" so that only directories are displayed
73 * The position and size of the NERD tree window can be customised
74 * The order in which the nodes in the tree are listed can be customised.
75 * A model of your filesystem is created/maintained as you explore it. This
76 has several advantages:
77 * All filesystem information is cached and is only re-read on demand
78 * If you revisit a part of the tree that you left earlier in your
79 session, the directory nodes will be opened/closed as you left them
80 * The script remembers the cursor position and window position in the NERD
81 tree so you can toggle it off (or just close the tree window) and then
82 reopen it (with NERDTreeToggle) the NERD tree window will appear exactly
84 * You can have a separate NERD tree for each tab, share trees across tabs,
86 * By default the script overrides the default file browser (netw), so if
87 you :edit a directory a (slighly modified) NERD tree will appear in the
89 * A programmable menu system is provided (simulates right clicking on a
91 * one default menu plugin is provided to perform basic filesytem
92 operations (create/delete/move/copy files/directories)
93 * There's an API for adding your own keymappings
96 ==============================================================================
97 2. Functionality provided *NERDTreeFunctionality*
99 ------------------------------------------------------------------------------
100 2.1. Global Commands *NERDTreeGlobalCommands*
102 :NERDTree [<start-directory> | <bookmark>] *:NERDTree*
103 Opens a fresh NERD tree. The root of the tree depends on the argument
104 given. There are 3 cases: If no argument is given, the current directory
105 will be used. If a directory is given, that will be used. If a bookmark
106 name is given, the corresponding directory will be used. For example: >
107 :NERDTree /home/marty/vim7/src
108 :NERDTree foo (foo is the name of a bookmark)
110 :NERDTreeFromBookmark <bookmark> *:NERDTreeFromBookmark*
111 Opens a fresh NERD tree with the root initialized to the dir for
112 <bookmark>. This only reason to use this command over :NERDTree is for
113 the completion (which is for bookmarks rather than directories).
115 :NERDTreeToggle [<start-directory> | <bookmark>] *:NERDTreeToggle*
116 If a NERD tree already exists for this tab, it is reopened and rendered
117 again. If no NERD tree exists for this tab then this command acts the
118 same as the |:NERDTree| command.
120 :NERDTreeMirror *:NERDTreeMirror*
121 Shares an existing NERD tree, from another tab, in the current tab.
122 Changes made to one tree are reflected in both as they are actually the
125 If only one other NERD tree exists, that tree is automatically mirrored. If
126 more than one exists, the script will ask which tree to mirror.
128 :NERDTreeClose *:NERDTreeClose*
129 Close the NERD tree in this tab.
131 :NERDTreeFind *:NERDTreeFind*
132 Find the current file in the tree. If no tree exists for the current tab,
133 or the file is not under the current root, then initialize a new tree where
134 the root is the directory of the current file.
136 ------------------------------------------------------------------------------
137 2.2. Bookmarks *NERDTreeBookmarks*
139 Bookmarks in the NERD tree are a way to tag files or directories of interest.
140 For example, you could use bookmarks to tag all of your project directories.
142 ------------------------------------------------------------------------------
143 2.2.1. The Bookmark Table *NERDTreeBookmarkTable*
145 If the bookmark table is active (see |NERDTree-B| and
146 |'NERDTreeShowBookmarks'|), it will be rendered above the tree. You can double
147 click bookmarks or use the |NERDTree-o| mapping to activate them. See also,
148 |NERDTree-t| and |NERDTree-T|
150 ------------------------------------------------------------------------------
151 2.2.2. Bookmark commands *NERDTreeBookmarkCommands*
153 Note that the following commands are only available in the NERD tree buffer.
156 Bookmark the current node as <name>. If there is already a <name>
157 bookmark, it is overwritten. <name> must not contain spaces.
159 :BookmarkToRoot <bookmark>
160 Make the directory corresponding to <bookmark> the new root. If a treenode
161 corresponding to <bookmark> is already cached somewhere in the tree then
162 the current tree will be used, otherwise a fresh tree will be opened.
163 Note that if <bookmark> points to a file then its parent will be used
166 :RevealBookmark <bookmark>
167 If the node is cached under the current root then it will be revealed
168 (i.e. directory nodes above it will be opened) and the cursor will be
171 :OpenBookmark <bookmark>
172 <bookmark> must point to a file. The file is opened as though |NERDTree-o|
173 was applied. If the node is cached under the current root then it will be
174 revealed and the cursor will be placed on it.
176 :ClearBookmarks [<bookmarks>]
177 Remove all the given bookmarks. If no bookmarks are given then remove all
178 bookmarks on the current node.
181 Remove all bookmarks.
184 Re-read the bookmarks in the |'NERDTreeBookmarksFile'|.
186 See also |:NERDTree| and |:NERDTreeFromBookmark|.
188 ------------------------------------------------------------------------------
189 2.2.3. Invalid Bookmarks *NERDTreeInvalidBookmarks*
191 If invalid bookmarks are detected, the script will issue an error message and
192 the invalid bookmarks will become unavailable for use.
194 These bookmarks will still be stored in the bookmarks file (see
195 |'NERDTreeBookmarksFile'|), down the bottom. There will always be a blank line
196 after the valid bookmarks but before the invalid ones.
198 Each line in the bookmarks file represents one bookmark. The proper format is:
199 <bookmark name><space><full path to the bookmark location>
201 After you have corrected any invalid bookmarks, either restart vim, or go
202 :ReadBookmarks from the NERD tree window.
204 ------------------------------------------------------------------------------
205 2.3. NERD tree Mappings *NERDTreeMappings*
207 Default Description~ help-tag~
210 o.......Open files, directories and bookmarks....................|NERDTree-o|
211 go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
212 t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
213 T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
214 i.......Open selected file in a split window.....................|NERDTree-i|
215 gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
216 s.......Open selected file in a new vsplit.......................|NERDTree-s|
217 gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|
218 O.......Recursively open the selected directory..................|NERDTree-O|
219 x.......Close the current nodes parent...........................|NERDTree-x|
220 X.......Recursively close all children of the current node.......|NERDTree-X|
221 e.......Edit the current dif.....................................|NERDTree-e|
223 <CR>...............same as |NERDTree-o|.
224 double-click.......same as the |NERDTree-o| map.
225 middle-click.......same as |NERDTree-i| for files, same as
226 |NERDTree-e| for dirs.
228 D.......Delete the current bookmark .............................|NERDTree-D|
230 P.......Jump to the root node....................................|NERDTree-P|
231 p.......Jump to current nodes parent.............................|NERDTree-p|
232 K.......Jump up inside directories at the current tree depth.....|NERDTree-K|
233 J.......Jump down inside directories at the current tree depth...|NERDTree-J|
234 <C-J>...Jump down to the next sibling of the current directory...|NERDTree-C-J|
235 <C-K>...Jump up to the previous sibling of the current directory.|NERDTree-C-K|
237 C.......Change the tree root to the selected dir.................|NERDTree-C|
238 u.......Move the tree root up one directory......................|NERDTree-u|
239 U.......Same as 'u' except the old root node is left open........|NERDTree-U|
240 r.......Recursively refresh the current directory................|NERDTree-r|
241 R.......Recursively refresh the current root.....................|NERDTree-R|
242 m.......Display the NERD tree menu...............................|NERDTree-m|
243 cd......Change the CWD to the dir of the selected node...........|NERDTree-cd|
245 I.......Toggle whether hidden files displayed....................|NERDTree-I|
246 f.......Toggle whether the file filters are used.................|NERDTree-f|
247 F.......Toggle whether files are displayed.......................|NERDTree-F|
248 B.......Toggle whether the bookmark table is displayed...........|NERDTree-B|
250 q.......Close the NERDTree window................................|NERDTree-q|
251 A.......Zoom (maximize/minimize) the NERDTree window.............|NERDTree-A|
252 ?.......Toggle the display of the quick help.....................|NERDTree-?|
254 ------------------------------------------------------------------------------
257 Map option: NERDTreeMapActivateNode
258 Applies to: files and directories.
260 If a file node is selected, it is opened in the previous window.
262 If a directory is selected it is opened or closed depending on its current
265 If a bookmark that links to a directory is selected then that directory
266 becomes the new root.
268 If a bookmark that links to a file is selected then that file is opened in the
271 ------------------------------------------------------------------------------
277 If a file node is selected, it is opened in the previous window, but the
278 cursor does not move.
280 The key combo for this mapping is always "g" + NERDTreeMapActivateNode (see
283 ------------------------------------------------------------------------------
286 Map option: NERDTreeMapOpenInTab
287 Applies to: files and directories.
289 Opens the selected file in a new tab. If a directory is selected, a fresh
290 NERD Tree for that directory is opened in a new tab.
292 If a bookmark which points to a directory is selected, open a NERD tree for
293 that directory in a new tab. If the bookmark points to a file, open that file
296 ------------------------------------------------------------------------------
299 Map option: NERDTreeMapOpenInTabSilent
300 Applies to: files and directories.
302 The same as |NERDTree-t| except that the focus is kept in the current tab.
304 ------------------------------------------------------------------------------
307 Map option: NERDTreeMapOpenSplit
310 Opens the selected file in a new split window and puts the cursor in the new
313 ------------------------------------------------------------------------------
319 The same as |NERDTree-i| except that the cursor is not moved.
321 The key combo for this mapping is always "g" + NERDTreeMapOpenSplit (see
324 ------------------------------------------------------------------------------
327 Map option: NERDTreeMapOpenVSplit
330 Opens the selected file in a new vertically split window and puts the cursor in
333 ------------------------------------------------------------------------------
339 The same as |NERDTree-s| except that the cursor is not moved.
341 The key combo for this mapping is always "g" + NERDTreeMapOpenVSplit (see
344 ------------------------------------------------------------------------------
347 Map option: NERDTreeMapOpenRecursively
348 Applies to: directories.
350 Recursively opens the selelected directory.
352 All files and directories are cached, but if a directory would not be
353 displayed due to file filters (see |'NERDTreeIgnore'| |NERDTree-f|) or the
354 hidden file filter (see |'NERDTreeShowHidden'|) then its contents are not
355 cached. This is handy, especially if you have .svn directories.
357 ------------------------------------------------------------------------------
360 Map option: NERDTreeMapCloseDir
361 Applies to: files and directories.
363 Closes the parent of the selected node.
365 ------------------------------------------------------------------------------
368 Map option: NERDTreeMapCloseChildren
369 Applies to: directories.
371 Recursively closes all children of the selected directory.
373 Tip: To quickly "reset" the tree, use |NERDTree-P| with this mapping.
375 ------------------------------------------------------------------------------
378 Map option: NERDTreeMapOpenExpl
379 Applies to: files and directories.
381 |:edit|s the selected directory, or the selected file's directory. This could
382 result in a NERD tree or a netrw being opened, depending on
383 |'NERDTreeHijackNetrw'|.
385 ------------------------------------------------------------------------------
388 Map option: NERDTreeMapDeleteBookmark
389 Applies to: lines in the bookmarks table
391 Deletes the currently selected bookmark.
393 ------------------------------------------------------------------------------
396 Map option: NERDTreeMapJumpRoot
397 Applies to: no restrictions.
399 Jump to the tree root.
401 ------------------------------------------------------------------------------
404 Map option: NERDTreeMapJumpParent
405 Applies to: files and directories.
407 Jump to the parent node of the selected node.
409 ------------------------------------------------------------------------------
412 Map option: NERDTreeMapJumpFirstChild
413 Applies to: files and directories.
415 Jump to the first child of the current nodes parent.
417 If the cursor is already on the first node then do the following:
418 * loop back thru the siblings of the current nodes parent until we find an
419 open dir with children
420 * go to the first child of that node
422 ------------------------------------------------------------------------------
425 Map option: NERDTreeMapJumpLastChild
426 Applies to: files and directories.
428 Jump to the last child of the current nodes parent.
430 If the cursor is already on the last node then do the following:
431 * loop forward thru the siblings of the current nodes parent until we find
432 an open dir with children
433 * go to the last child of that node
435 ------------------------------------------------------------------------------
438 Map option: NERDTreeMapJumpNextSibling
439 Applies to: files and directories.
441 Jump to the next sibling of the selected node.
443 ------------------------------------------------------------------------------
446 Map option: NERDTreeMapJumpPrevSibling
447 Applies to: files and directories.
449 Jump to the previous sibling of the selected node.
451 ------------------------------------------------------------------------------
454 Map option: NERDTreeMapChdir
455 Applies to: directories.
457 Make the selected directory node the new tree root. If a file is selected, its
460 ------------------------------------------------------------------------------
463 Map option: NERDTreeMapUpdir
464 Applies to: no restrictions.
466 Move the tree root up a dir (like doing a "cd ..").
468 ------------------------------------------------------------------------------
471 Map option: NERDTreeMapUpdirKeepOpen
472 Applies to: no restrictions.
474 Like |NERDTree-u| except that the old tree root is kept open.
476 ------------------------------------------------------------------------------
479 Map option: NERDTreeMapRefresh
480 Applies to: files and directories.
482 If a dir is selected, recursively refresh that dir, i.e. scan the filesystem
483 for changes and represent them in the tree.
485 If a file node is selected then the above is done on it's parent.
487 ------------------------------------------------------------------------------
490 Map option: NERDTreeMapRefreshRoot
491 Applies to: no restrictions.
493 Recursively refresh the tree root.
495 ------------------------------------------------------------------------------
498 Map option: NERDTreeMapMenu
499 Applies to: files and directories.
501 Display the NERD tree menu. See |NERDTreeMenu| for details.
503 ------------------------------------------------------------------------------
506 Map option: NERDTreeMapChdir
507 Applies to: files and directories.
509 Change vims current working directory to that of the selected node.
511 ------------------------------------------------------------------------------
514 Map option: NERDTreeMapToggleHidden
515 Applies to: no restrictions.
517 Toggles whether hidden files (i.e. "dot files") are displayed.
519 ------------------------------------------------------------------------------
522 Map option: NERDTreeMapToggleFilters
523 Applies to: no restrictions.
525 Toggles whether file filters are used. See |'NERDTreeIgnore'| for details.
527 ------------------------------------------------------------------------------
530 Map option: NERDTreeMapToggleFiles
531 Applies to: no restrictions.
533 Toggles whether file nodes are displayed.
535 ------------------------------------------------------------------------------
538 Map option: NERDTreeMapToggleBookmarks
539 Applies to: no restrictions.
541 Toggles whether the bookmarks table is displayed.
543 ------------------------------------------------------------------------------
546 Map option: NERDTreeMapQuit
547 Applies to: no restrictions.
549 Closes the NERDtree window.
551 ------------------------------------------------------------------------------
554 Map option: NERDTreeMapToggleZoom
555 Applies to: no restrictions.
557 Maximize (zoom) and minimize the NERDtree window.
559 ------------------------------------------------------------------------------
562 Map option: NERDTreeMapHelp
563 Applies to: no restrictions.
565 Toggles whether the quickhelp is displayed.
567 ------------------------------------------------------------------------------
568 2.3. The NERD tree menu *NERDTreeMenu*
570 The NERD tree has a menu that can be programmed via the an API (see
571 |NERDTreeMenuAPI|). The idea is to simulate the "right click" menus that most
574 The script comes with two default menu plugins: exec_menuitem.vim and
575 fs_menu.vim. fs_menu.vim adds some basic filesystem operations to the menu for
576 creating/deleting/moving/copying files and dirs. exec_menuitem.vim provides a
577 menu item to execute executable files.
579 Related tags: |NERDTree-m| |NERDTreeApi|
581 ==============================================================================
582 3. Customisation *NERDTreeOptions*
585 ------------------------------------------------------------------------------
586 3.1. Customisation summary *NERDTreeOptionSummary*
588 The script provides the following options that can customise the behaviour the
589 NERD tree. These options should be set in your vimrc.
591 |'loaded_nerd_tree'| Turns off the script.
593 |'NERDChristmasTree'| Tells the NERD tree to make itself colourful
596 |'NERDTreeAutoCenter'| Controls whether the NERD tree window centers
597 when the cursor moves within a specified
598 distance to the top/bottom of the window.
599 |'NERDTreeAutoCenterThreshold'| Controls the sensitivity of autocentering.
601 |'NERDTreeCaseSensitiveSort'| Tells the NERD tree whether to be case
602 sensitive or not when sorting nodes.
604 |'NERDTreeChDirMode'| Tells the NERD tree if/when it should change
605 vim's current working directory.
607 |'NERDTreeHighlightCursorline'| Tell the NERD tree whether to highlight the
610 |'NERDTreeHijackNetrw'| Tell the NERD tree whether to replace the netrw
611 autocommands for exploring local directories.
613 |'NERDTreeIgnore'| Tells the NERD tree which files to ignore.
615 |'NERDTreeBookmarksFile'| Where the bookmarks are stored.
617 |'NERDTreeMouseMode'| Tells the NERD tree how to handle mouse
620 |'NERDTreeQuitOnOpen'| Closes the tree window after opening a file.
622 |'NERDTreeShowBookmarks'| Tells the NERD tree whether to display the
623 bookmarks table on startup.
625 |'NERDTreeShowFiles'| Tells the NERD tree whether to display files
626 in the tree on startup.
628 |'NERDTreeShowHidden'| Tells the NERD tree whether to display hidden
631 |'NERDTreeShowLineNumbers'| Tells the NERD tree whether to display line
632 numbers in the tree window.
634 |'NERDTreeSortOrder'| Tell the NERD tree how to sort the nodes in
637 |'NERDTreeStatusline'| Set a statusline for NERD tree windows.
639 |'NERDTreeWinPos'| Tells the script where to put the NERD tree
642 |'NERDTreeWinSize'| Sets the window size when the NERD tree is
645 ------------------------------------------------------------------------------
646 3.2. Customisation details *NERDTreeOptionDetails*
648 To enable any of the below options you should put the given line in your
652 If this plugin is making you feel homicidal, it may be a good idea to turn it
653 off with this line in your vimrc: >
654 let loaded_nerd_tree=1
656 ------------------------------------------------------------------------------
657 *'NERDChristmasTree'*
661 If this option is set to 1 then some extra syntax highlighting elements are
662 added to the nerd tree to make it more colourful.
664 Set it to 0 for a more vanilla looking tree.
666 ------------------------------------------------------------------------------
667 *'NERDTreeAutoCenter'*
671 If set to 1, the NERD tree window will center around the cursor if it moves to
672 within |'NERDTreeAutoCenterThreshold'| lines of the top/bottom of the window.
674 This is ONLY done in response to tree navigation mappings,
675 i.e. |NERDTree-J| |NERDTree-K| |NERDTree-C-J| |NERDTree-C-K| |NERDTree-p|
678 The centering is done with a |zz| operation.
680 ------------------------------------------------------------------------------
681 *'NERDTreeAutoCenterThreshold'*
682 Values: Any natural number.
685 This option controls the "sensitivity" of the NERD tree auto centering. See
686 |'NERDTreeAutoCenter'| for details.
688 ------------------------------------------------------------------------------
689 *'NERDTreeCaseSensitiveSort'*
693 By default the NERD tree does not sort nodes case sensitively, i.e. nodes
694 could appear like this: >
701 But, if you set this option to 1 then the case of the nodes will be taken into
702 account. The above nodes would then be sorted like this: >
709 ------------------------------------------------------------------------------
710 *'NERDTreeChDirMode'*
715 Use this option to tell the script when (if at all) to change the current
716 working directory (CWD) for vim.
718 If it is set to 0 then the CWD is never changed by the NERD tree.
720 If set to 1 then the CWD is changed when the NERD tree is first loaded to the
721 directory it is initialized in. For example, if you start the NERD tree with >
722 :NERDTree /home/marty/foobar
724 then the CWD will be changed to /home/marty/foobar and will not be changed
725 again unless you init another NERD tree with a similar command.
727 If the option is set to 2 then it behaves the same as if set to 1 except that
728 the CWD is changed whenever the tree root is changed. For example, if the CWD
729 is /home/marty/foobar and you make the node for /home/marty/foobar/baz the new
730 root then the CWD will become /home/marty/foobar/baz.
732 ------------------------------------------------------------------------------
733 *'NERDTreeHighlightCursorline'*
737 If set to 1, the current cursor line in the NERD tree buffer will be
738 highlighted. This is done using the |'cursorline'| option.
740 ------------------------------------------------------------------------------
741 *'NERDTreeHijackNetrw'*
745 If set to 1, doing a >
746 :edit <some directory>
748 will open up a "secondary" NERD tree instead of a netrw in the target window.
750 Secondary NERD trees behaves slighly different from a regular trees in the
752 1. 'o' will open the selected file in the same window as the tree,
754 2. you can have as many secondary tree as you want in the same tab.
756 ------------------------------------------------------------------------------
758 Values: a list of regular expressions.
761 This option is used to specify which files the NERD tree should ignore. It
762 must be a list of regular expressions. When the NERD tree is rendered, any
763 files/dirs that match any of the regex's in 'NERDTreeIgnore' wont be
766 For example if you put the following line in your vimrc: >
767 let NERDTreeIgnore=['\.vim$', '\~$']
769 then all files ending in .vim or ~ will be ignored.
771 Note: to tell the NERD tree not to ignore any files you must use the following
773 let NERDTreeIgnore=[]
776 The file filters can be turned on and off dynamically with the |NERDTree-f|
779 ------------------------------------------------------------------------------
780 *'NERDTreeBookmarksFile'*
782 Default: $HOME/.NERDTreeBookmarks
784 This is where bookmarks are saved. See |NERDTreeBookmarkCommands|.
786 ------------------------------------------------------------------------------
787 *'NERDTreeMouseMode'*
791 If set to 1 then a double click on a node is required to open it.
792 If set to 2 then a single click will open directory nodes, while a double
793 click will still be required for file nodes.
794 If set to 3 then a single click will open any node.
796 Note: a double click anywhere on a line that a tree node is on will
797 activate it, but all single-click activations must be done on name of the node
798 itself. For example, if you have the following node: >
801 then (to single click activate it) you must click somewhere in
804 ------------------------------------------------------------------------------
805 *'NERDTreeQuitOnOpen'*
810 If set to 1, the NERD tree window will close after opening a file with the
811 |NERDTree-o|, |NERDTree-i|, |NERDTree-t| and |NERDTree-T| mappings.
813 ------------------------------------------------------------------------------
814 *'NERDTreeShowBookmarks'*
818 If this option is set to 1 then the bookmarks table will be displayed.
820 This option can be toggled dynamically, per tree, with the |NERDTree-B|
823 ------------------------------------------------------------------------------
824 *'NERDTreeShowFiles'*
828 If this option is set to 1 then files are displayed in the NERD tree. If it is
829 set to 0 then only directories are displayed.
831 This option can be toggled dynamically, per tree, with the |NERDTree-F|
832 mapping and is useful for drastically shrinking the tree when you are
833 navigating to a different part of the tree.
835 ------------------------------------------------------------------------------
836 *'NERDTreeShowHidden'*
840 This option tells vim whether to display hidden files by default. This option
841 can be dynamically toggled, per tree, with the |NERDTree-I| mapping. Use one
842 of the follow lines to set this option: >
843 let NERDTreeShowHidden=0
844 let NERDTreeShowHidden=1
847 ------------------------------------------------------------------------------
848 *'NERDTreeShowLineNumbers'*
852 This option tells vim whether to display line numbers for the NERD tree
853 window. Use one of the follow lines to set this option: >
854 let NERDTreeShowLineNumbers=0
855 let NERDTreeShowLineNumbers=1
858 ------------------------------------------------------------------------------
859 *'NERDTreeSortOrder'*
860 Values: a list of regular expressions.
861 Default: ['\/$', '*', '\.swp$', '\.bak$', '\~$']
863 This option is set to a list of regular expressions which are used to
864 specify the order of nodes under their parent.
866 For example, if the option is set to: >
867 ['\.vim$', '\.c$', '\.h$', '*', 'foobar']
869 then all .vim files will be placed at the top, followed by all .c files then
870 all .h files. All files containing the string 'foobar' will be placed at the
871 end. The star is a special flag: it tells the script that every node that
872 doesnt match any of the other regexps should be placed here.
874 If no star is present in 'NERDTreeSortOrder' then one is automatically
875 appended to the array.
877 The regex '\/$' should be used to match directory nodes.
879 After this sorting is done, the files in each group are sorted alphabetically.
884 (3) ['\/$', '\.rb$', '\.php$', '*', '\.swp$', '\.bak$', '\~$']
886 1. Directories will appear last, everything else will appear above.
887 2. Everything will simply appear in alphabetical order.
888 3. Dirs will appear first, then ruby and php. Swap files, bak files and vim
889 backup files will appear last with everything else preceding them.
891 ------------------------------------------------------------------------------
892 *'NERDTreeStatusline'*
893 Values: Any valid statusline setting.
894 Default: %{b:NERDTreeRoot.path.strForOS(0)}
896 Tells the script what to use as the |'statusline'| setting for NERD tree
899 Note that the statusline is set using |:let-&| not |:set| so escaping spaces
902 Setting this option to -1 will will deactivate it so that your global
903 statusline setting is used instead.
905 ------------------------------------------------------------------------------
907 Values: "left" or "right"
910 This option is used to determine where NERD tree window is placed on the
913 This option makes it possible to use two different explorer plugins
914 simultaneously. For example, you could have the taglist plugin on the left of
915 the window and the NERD tree on the right.
917 ------------------------------------------------------------------------------
919 Values: a positive integer.
922 This option is used to change the size of the NERD tree when it is loaded.
924 ==============================================================================
925 4. The NERD tree API *NERDTreeAPI*
927 The NERD tree script allows you to add custom key mappings and menu items via
928 a set of API calls. Any scripts that use this API should be placed in
929 ~/.vim/nerdtree_plugin/ (*nix) or ~/vimfiles/nerdtree_plugin (windows).
931 The script exposes some prototype objects that can be used to manipulate the
932 tree and/or get information from it: >
938 See the code/comments in NERD_tree.vim to find how to use these objects. The
939 following code conventions are used:
940 * class members start with a capital letter
941 * instance members start with a lower case letter
942 * private members start with an underscore
944 See this blog post for more details:
945 http://got-ravings.blogspot.com/2008/09/vim-pr0n-prototype-based-objects.html
947 ------------------------------------------------------------------------------
948 4.1. Key map API *NERDTreeKeymapAPI*
950 NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()*
951 Adds a new keymapping for all NERD tree buffers.
952 {options} must be a dictionary, and must contain the following keys:
953 "key" - the trigger key for the new mapping
954 "callback" - the function the new mapping will be bound to
955 "quickhelpText" - the text that will appear in the quickhelp (see
959 call NERDTreeAddKeyMap({
961 \ 'callback': 'NERDTreeEchoCurrentNode',
962 \ 'quickhelpText': 'echo full path of current node' })
964 function! NERDTreeEchoCurrentNode()
965 let n = g:NERDTreeFileNode.GetSelected()
967 echomsg 'Current node: ' . n.path.str()
971 This code should sit in a file like ~/.vim/nerdtree_plugin/mymapping.vim.
972 It adds a (rather useless) mapping on 'b' which echos the full path to the
975 ------------------------------------------------------------------------------
976 4.2. Menu API *NERDTreeMenuAPI*
978 NERDTreeAddSubmenu({options}) *NERDTreeAddSubmenu()*
979 Creates and returns a new submenu.
981 {options} must be a dictionary and must contain the following keys:
982 "text" - the text of the submenu that the user will see
983 "shortcut" - a shortcut key for the submenu (need not be unique)
985 The following keys are optional:
986 "isActiveCallback" - a function that will be called to determine whether
987 this submenu item will be displayed or not. The callback function must return
989 "parent" - the parent submenu of the new submenu (returned from a previous
990 invocation of NERDTreeAddSubmenu()). If this key is left out then the new
991 submenu will sit under the top level menu.
993 See below for an example.
995 NERDTreeAddMenuItem({options}) *NERDTreeAddMenuItem()*
996 Adds a new menu item to the NERD tree menu (see |NERDTreeMenu|).
998 {options} must be a dictionary and must contain the
1000 "text" - the text of the menu item which the user will see
1001 "shortcut" - a shortcut key for the menu item (need not be unique)
1002 "callback" - the function that will be called when the user activates the
1005 The following keys are optional:
1006 "isActiveCallback" - a function that will be called to determine whether
1007 this menu item will be displayed or not. The callback function must return
1009 "parent" - if the menu item belongs under a submenu then this key must be
1010 specified. This value for this key will be the object that
1011 was returned when the submenu was created with |NERDTreeAddSubmenu()|.
1013 See below for an example.
1015 NERDTreeAddMenuSeparator([{options}]) *NERDTreeAddMenuSeparator()*
1016 Adds a menu separator (a row of dashes).
1018 {options} is an optional dictionary that may contain the following keys:
1019 "isActiveCallback" - see description in |NERDTreeAddMenuItem()|.
1021 Below is an example of the menu API in action. >
1022 call NERDTreeAddMenuSeparator()
1024 call NERDTreeAddMenuItem({
1025 \ 'text': 'a (t)op level menu item',
1027 \ 'callback': 'SomeFunction' })
1029 let submenu = NERDTreeAddSubmenu({
1030 \ 'text': 'a (s)ub menu',
1031 \ 'shortcut': 's' })
1033 call NERDTreeAddMenuItem({
1034 \ 'text': '(n)ested item 1',
1036 \ 'callback': 'SomeFunction',
1037 \ 'parent': submenu })
1039 call NERDTreeAddMenuItem({
1040 \ 'text': '(n)ested item 2',
1042 \ 'callback': 'SomeFunction',
1043 \ 'parent': submenu })
1045 This will create the following menu: >
1046 --------------------
1047 a (t)op level menu item
1050 Where selecting "a (s)ub menu" will lead to a second menu: >
1054 When any of the 3 concrete menu items are selected the function "SomeFunction"
1057 ------------------------------------------------------------------------------
1058 NERDTreeRender() *NERDTreeRender()*
1059 Re-renders the NERD tree buffer. Useful if you change the state of the
1060 tree and you want to it to be reflected in the UI.
1062 ==============================================================================
1063 5. About *NERDTreeAbout*
1065 The author of the NERD tree is a terrible terrible monster called Martyzilla
1066 who gobbles up small children with milk and sugar for breakfast.
1068 He can be reached at martin.grenfell at gmail dot com. He would love to hear
1069 from you, so feel free to send him suggestions and/or comments about this
1070 plugin. Don't be shy --- the worst he can do is slaughter you and stuff you in
1071 the fridge for later ;)
1073 The latest stable versions can be found at
1074 http://www.vim.org/scripts/script.php?script_id=1658
1076 The latest dev versions are on github
1077 http://github.com/scrooloose/nerdtree
1080 ==============================================================================
1081 6. Changelog *NERDTreeChangelog*
1084 - Fix a bug with :NERDTreeFind and symlinks. Thanks to Vitaly Bogdanov.
1088 - NERDTreeFind to reveal the node for the current buffer in the tree,
1089 see |NERDTreeFind|. This effectively merges the FindInNERDTree plugin (by
1090 Doug McInnes) into the script.
1091 - make NERDTreeQuitOnOpen apply to the t/T keymaps too. Thanks to Stefan
1092 Ritter and Rémi Prévost.
1093 - truncate the root node if wider than the tree window. Thanks to Victor
1097 - really fix window state restoring
1098 - fix some win32 path escaping issues. Thanks to Stephan Baumeister, Ricky,
1099 jfilip1024, and Chris Chambers
1102 - add a new programmable menu system (see :help NERDTreeMenu).
1103 - add new APIs to add menus/menu-items to the menu system as well as
1104 custom key mappings to the NERD tree buffer (see :help NERDTreeAPI).
1105 - removed the old API functions
1106 - added a mapping to maximize/restore the size of nerd tree window, thanks
1107 to Guillaume Duranceau for the patch. See :help NERDTree-A for details.
1109 - fix a bug where secondary nerd trees (netrw hijacked trees) and
1110 NERDTreeQuitOnOpen didnt play nicely, thanks to Curtis Harvey.
1111 - fix a bug where the script ignored directories whose name ended in a dot,
1112 thanks to Aggelos Orfanakos for the patch.
1113 - fix a bug when using the x mapping on the tree root, thanks to Bryan
1114 Venteicher for the patch.
1115 - fix a bug where the cursor position/window size of the nerd tree buffer
1116 wasnt being stored on closing the window, thanks to Richard Hart.
1117 - fix a bug where NERDTreeMirror would mirror the wrong tree
1120 - fix a bug where a non-listed no-name buffer was getting created every
1121 time the tree windows was created, thanks to Derek Wyatt and owen1
1122 - make <CR> behave the same as the 'o' mapping
1123 - some helptag fixes in the doc, thanks strull
1124 - fix a bug when using :set nohidden and opening a file where the previous
1125 buf was modified. Thanks iElectric
1130 - add mappings to open files in a vsplit, see :help NERDTree-s and :help
1132 - make the statusline for the nerd tree window default to something
1133 hopefully more useful. See :help 'NERDTreeStatusline'
1135 - make the hijack netrw functionality work when vim is started with "vim
1136 <some dir>" (thanks to Alf Mikula for the patch).
1137 - fix a bug where the CWD wasnt being changed for some operations even when
1138 NERDTreeChDirMode==2 (thanks to Lucas S. Buchala)
1139 - add -bar to all the nerd tree :commands so they can chain with other
1140 :commands (thanks to tpope)
1141 - fix bugs when ignorecase was set (thanks to nach)
1142 - fix a bug with the relative path code (thanks to nach)
1143 - fix a bug where doing a :cd would cause :NERDTreeToggle to fail (thanks nach)
1148 - fix bugs with :NERDTreeToggle and :NERDTreeMirror when 'hidden
1150 - fix a bug where :NERDTree <path> would fail if <path> was relative and
1151 didnt start with a ./ or ../ Thanks to James Kanze.
1152 - make the q mapping work with secondary (:e <dir> style) trees,
1154 - fix a bunch of small bugs with secondary trees
1156 More insane refactoring.
1159 - hijack netrw so that doing an :edit <directory> will put a NERD tree in
1160 the window rather than a netrw browser. See :help 'NERDTreeHijackNetrw'
1161 - allow sharing of trees across tabs, see :help :NERDTreeMirror
1162 - remove "top" and "bottom" as valid settings for NERDTreeWinPos
1163 - change the '<tab>' mapping to 'i'
1164 - change the 'H' mapping to 'I'
1165 - lots of refactoring
1167 ==============================================================================
1168 7. Credits *NERDTreeCredits*
1170 Thanks to the following people for testing, bug reports, ideas etc. Without
1171 you I probably would have got bored of the hacking the NERD tree and
1172 just downloaded pr0n instead.
1174 Tim Carey-Smith (halorgium)
1181 Michael Geddes (frogonwheels)
1195 Matt Wozniski (godlygeek)
1199 Simon Peter Nicholls
1205 James Vega (jamessan)
1206 Frederic Chanal (nach)
1211 Richard Hart (hates)
1222 ==============================================================================
1223 8. License *NERDTreeLicense*
1225 The NERD tree is released under the wtfpl.
1226 See http://sam.zoy.org/wtfpl/COPYING.