]> git.r.bdr.sh - rbdr/dotfiles/blame - vim/doc/NERD_tree.txt
Better tmux powerline activity highlight
[rbdr/dotfiles] / vim / doc / NERD_tree.txt
CommitLineData
0d23b6e5
BB
1*NERD_tree.txt* A tree explorer plugin that owns your momma!
2
3
4
5 omg its ... ~
6
7 ________ ________ _ ____________ ____ __________ ____________~
8 /_ __/ / / / ____/ / | / / ____/ __ \/ __ \ /_ __/ __ \/ ____/ ____/~
9 / / / /_/ / __/ / |/ / __/ / /_/ / / / / / / / /_/ / __/ / __/ ~
10 / / / __ / /___ / /| / /___/ _, _/ /_/ / / / / _, _/ /___/ /___ ~
11 /_/ /_/ /_/_____/ /_/ |_/_____/_/ |_/_____/ /_/ /_/ |_/_____/_____/ ~
12
13
14 Reference Manual~
15
16
17
18
19==============================================================================
20CONTENTS *NERDTree-contents*
21
22 1.Intro...................................|NERDTree|
23 2.Functionality provided..................|NERDTreeFunctionality|
24 2.1.Global commands...................|NERDTreeGlobalCommands|
25 2.2.Bookmarks.........................|NERDTreeBookmarks|
26 2.2.1.The bookmark table..........|NERDTreeBookmarkTable|
27 2.2.2.Bookmark commands...........|NERDTreeBookmarkCommands|
28 2.2.3.Invalid bookmarks...........|NERDTreeInvalidBookmarks|
29 2.3.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|
41
42==============================================================================
431. Intro *NERDTree*
44
45What is this "NERD tree"??
46
47The NERD tree allows you to explore your filesystem and to open files and
48directories. It presents the filesystem to you in the form of a tree which you
49manipulate with the keyboard and/or mouse. It also allows you to perform
50simple filesystem operations.
51
52The 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:
55 * files
56 * directories
57 * sym-links
58 * windows .lnk files
59 * read-only files
60 * executable files
61 * Many (customisable) mappings are provided to manipulate the tree:
62 * Mappings to open/close/explore directory nodes
63 * Mappings to open files in new/existing windows/tabs
64 * Mappings to change the current root of the tree
65 * Mappings to navigate around the tree
66 * ...
67 * Directories and files can be bookmarked.
68 * Most 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
83 as you left it
84 * You can have a separate NERD tree for each tab, share trees across tabs,
85 or a mix of both.
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
88 current window
89 * A programmable menu system is provided (simulates right clicking on a
90 node)
91 * one default menu plugin is provided to perform basic filesytem
92 operations (create/delete/move/copy files/directories)
93 * There's an API for adding your own keymappings
94
95
96==============================================================================
972. Functionality provided *NERDTreeFunctionality*
98
99------------------------------------------------------------------------------
1002.1. Global Commands *NERDTreeGlobalCommands*
101
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)
109<
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).
114
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.
119
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
123 same buffer.
124
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.
127
128:NERDTreeClose *:NERDTreeClose*
129 Close the NERD tree in this tab.
130
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.
135
136------------------------------------------------------------------------------
1372.2. Bookmarks *NERDTreeBookmarks*
138
139Bookmarks in the NERD tree are a way to tag files or directories of interest.
140For example, you could use bookmarks to tag all of your project directories.
141
142------------------------------------------------------------------------------
1432.2.1. The Bookmark Table *NERDTreeBookmarkTable*
144
145If the bookmark table is active (see |NERDTree-B| and
146|'NERDTreeShowBookmarks'|), it will be rendered above the tree. You can double
147click bookmarks or use the |NERDTree-o| mapping to activate them. See also,
148|NERDTree-t| and |NERDTree-T|
149
150------------------------------------------------------------------------------
1512.2.2. Bookmark commands *NERDTreeBookmarkCommands*
152
153Note that the following commands are only available in the NERD tree buffer.
154
155:Bookmark <name>
156 Bookmark the current node as <name>. If there is already a <name>
157 bookmark, it is overwritten. <name> must not contain spaces.
158
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
164 instead.
165
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
169 placed on it.
170
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.
175
176:ClearBookmarks [<bookmarks>]
177 Remove all the given bookmarks. If no bookmarks are given then remove all
178 bookmarks on the current node.
179
180:ClearAllBookmarks
181 Remove all bookmarks.
182
183:ReadBookmarks
184 Re-read the bookmarks in the |'NERDTreeBookmarksFile'|.
185
186See also |:NERDTree| and |:NERDTreeFromBookmark|.
187
188------------------------------------------------------------------------------
1892.2.3. Invalid Bookmarks *NERDTreeInvalidBookmarks*
190
191If invalid bookmarks are detected, the script will issue an error message and
192the invalid bookmarks will become unavailable for use.
193
194These bookmarks will still be stored in the bookmarks file (see
195|'NERDTreeBookmarksFile'|), down the bottom. There will always be a blank line
196after the valid bookmarks but before the invalid ones.
197
198Each line in the bookmarks file represents one bookmark. The proper format is:
199<bookmark name><space><full path to the bookmark location>
200
201After you have corrected any invalid bookmarks, either restart vim, or go
202:ReadBookmarks from the NERD tree window.
203
204------------------------------------------------------------------------------
2052.3. NERD tree Mappings *NERDTreeMappings*
206
207Default Description~ help-tag~
208Key~
209
210o.......Open files, directories and bookmarks....................|NERDTree-o|
211go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
212t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
213T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
214i.......Open selected file in a split window.....................|NERDTree-i|
215gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
216s.......Open selected file in a new vsplit.......................|NERDTree-s|
217gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|
218O.......Recursively open the selected directory..................|NERDTree-O|
219x.......Close the current nodes parent...........................|NERDTree-x|
220X.......Recursively close all children of the current node.......|NERDTree-X|
221e.......Edit the current dif.....................................|NERDTree-e|
222
223<CR>...............same as |NERDTree-o|.
224double-click.......same as the |NERDTree-o| map.
225middle-click.......same as |NERDTree-i| for files, same as
226 |NERDTree-e| for dirs.
227
228D.......Delete the current bookmark .............................|NERDTree-D|
229
230P.......Jump to the root node....................................|NERDTree-P|
231p.......Jump to current nodes parent.............................|NERDTree-p|
232K.......Jump up inside directories at the current tree depth.....|NERDTree-K|
233J.......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|
236
237C.......Change the tree root to the selected dir.................|NERDTree-C|
238u.......Move the tree root up one directory......................|NERDTree-u|
239U.......Same as 'u' except the old root node is left open........|NERDTree-U|
240r.......Recursively refresh the current directory................|NERDTree-r|
241R.......Recursively refresh the current root.....................|NERDTree-R|
242m.......Display the NERD tree menu...............................|NERDTree-m|
243cd......Change the CWD to the dir of the selected node...........|NERDTree-cd|
244
245I.......Toggle whether hidden files displayed....................|NERDTree-I|
246f.......Toggle whether the file filters are used.................|NERDTree-f|
247F.......Toggle whether files are displayed.......................|NERDTree-F|
248B.......Toggle whether the bookmark table is displayed...........|NERDTree-B|
249
250q.......Close the NERDTree window................................|NERDTree-q|
251A.......Zoom (maximize/minimize) the NERDTree window.............|NERDTree-A|
252?.......Toggle the display of the quick help.....................|NERDTree-?|
253
254------------------------------------------------------------------------------
255 *NERDTree-o*
256Default key: o
257Map option: NERDTreeMapActivateNode
258Applies to: files and directories.
259
260If a file node is selected, it is opened in the previous window.
261
262If a directory is selected it is opened or closed depending on its current
263state.
264
265If a bookmark that links to a directory is selected then that directory
266becomes the new root.
267
268If a bookmark that links to a file is selected then that file is opened in the
269previous window.
270
271------------------------------------------------------------------------------
272 *NERDTree-go*
273Default key: go
274Map option: None
275Applies to: files.
276
277If a file node is selected, it is opened in the previous window, but the
278cursor does not move.
279
280The key combo for this mapping is always "g" + NERDTreeMapActivateNode (see
281|NERDTree-o|).
282
283------------------------------------------------------------------------------
284 *NERDTree-t*
285Default key: t
286Map option: NERDTreeMapOpenInTab
287Applies to: files and directories.
288
289Opens the selected file in a new tab. If a directory is selected, a fresh
290NERD Tree for that directory is opened in a new tab.
291
292If a bookmark which points to a directory is selected, open a NERD tree for
293that directory in a new tab. If the bookmark points to a file, open that file
294in a new tab.
295
296------------------------------------------------------------------------------
297 *NERDTree-T*
298Default key: T
299Map option: NERDTreeMapOpenInTabSilent
300Applies to: files and directories.
301
302The same as |NERDTree-t| except that the focus is kept in the current tab.
303
304------------------------------------------------------------------------------
305 *NERDTree-i*
306Default key: i
307Map option: NERDTreeMapOpenSplit
308Applies to: files.
309
310Opens the selected file in a new split window and puts the cursor in the new
311window.
312
313------------------------------------------------------------------------------
314 *NERDTree-gi*
315Default key: gi
316Map option: None
317Applies to: files.
318
319The same as |NERDTree-i| except that the cursor is not moved.
320
321The key combo for this mapping is always "g" + NERDTreeMapOpenSplit (see
322|NERDTree-i|).
323
324------------------------------------------------------------------------------
325 *NERDTree-s*
326Default key: s
327Map option: NERDTreeMapOpenVSplit
328Applies to: files.
329
330Opens the selected file in a new vertically split window and puts the cursor in
331the new window.
332
333------------------------------------------------------------------------------
334 *NERDTree-gs*
335Default key: gs
336Map option: None
337Applies to: files.
338
339The same as |NERDTree-s| except that the cursor is not moved.
340
341The key combo for this mapping is always "g" + NERDTreeMapOpenVSplit (see
342|NERDTree-s|).
343
344------------------------------------------------------------------------------
345 *NERDTree-O*
346Default key: O
347Map option: NERDTreeMapOpenRecursively
348Applies to: directories.
349
350Recursively opens the selelected directory.
351
352All files and directories are cached, but if a directory would not be
353displayed due to file filters (see |'NERDTreeIgnore'| |NERDTree-f|) or the
354hidden file filter (see |'NERDTreeShowHidden'|) then its contents are not
355cached. This is handy, especially if you have .svn directories.
356
357------------------------------------------------------------------------------
358 *NERDTree-x*
359Default key: x
360Map option: NERDTreeMapCloseDir
361Applies to: files and directories.
362
363Closes the parent of the selected node.
364
365------------------------------------------------------------------------------
366 *NERDTree-X*
367Default key: X
368Map option: NERDTreeMapCloseChildren
369Applies to: directories.
370
371Recursively closes all children of the selected directory.
372
373Tip: To quickly "reset" the tree, use |NERDTree-P| with this mapping.
374
375------------------------------------------------------------------------------
376 *NERDTree-e*
377Default key: e
378Map option: NERDTreeMapOpenExpl
379Applies to: files and directories.
380
381|:edit|s the selected directory, or the selected file's directory. This could
382result in a NERD tree or a netrw being opened, depending on
383|'NERDTreeHijackNetrw'|.
384
385------------------------------------------------------------------------------
386 *NERDTree-D*
387Default key: D
388Map option: NERDTreeMapDeleteBookmark
389Applies to: lines in the bookmarks table
390
391Deletes the currently selected bookmark.
392
393------------------------------------------------------------------------------
394 *NERDTree-P*
395Default key: P
396Map option: NERDTreeMapJumpRoot
397Applies to: no restrictions.
398
399Jump to the tree root.
400
401------------------------------------------------------------------------------
402 *NERDTree-p*
403Default key: p
404Map option: NERDTreeMapJumpParent
405Applies to: files and directories.
406
407Jump to the parent node of the selected node.
408
409------------------------------------------------------------------------------
410 *NERDTree-K*
411Default key: K
412Map option: NERDTreeMapJumpFirstChild
413Applies to: files and directories.
414
415Jump to the first child of the current nodes parent.
416
417If 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
421
422------------------------------------------------------------------------------
423 *NERDTree-J*
424Default key: J
425Map option: NERDTreeMapJumpLastChild
426Applies to: files and directories.
427
428Jump to the last child of the current nodes parent.
429
430If 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
434
435------------------------------------------------------------------------------
436 *NERDTree-C-J*
437Default key: <C-J>
438Map option: NERDTreeMapJumpNextSibling
439Applies to: files and directories.
440
441Jump to the next sibling of the selected node.
442
443------------------------------------------------------------------------------
444 *NERDTree-C-K*
445Default key: <C-K>
446Map option: NERDTreeMapJumpPrevSibling
447Applies to: files and directories.
448
449Jump to the previous sibling of the selected node.
450
451------------------------------------------------------------------------------
452 *NERDTree-C*
453Default key: C
454Map option: NERDTreeMapChdir
455Applies to: directories.
456
457Make the selected directory node the new tree root. If a file is selected, its
458parent is used.
459
460------------------------------------------------------------------------------
461 *NERDTree-u*
462Default key: u
463Map option: NERDTreeMapUpdir
464Applies to: no restrictions.
465
466Move the tree root up a dir (like doing a "cd ..").
467
468------------------------------------------------------------------------------
469 *NERDTree-U*
470Default key: U
471Map option: NERDTreeMapUpdirKeepOpen
472Applies to: no restrictions.
473
474Like |NERDTree-u| except that the old tree root is kept open.
475
476------------------------------------------------------------------------------
477 *NERDTree-r*
478Default key: r
479Map option: NERDTreeMapRefresh
480Applies to: files and directories.
481
482If a dir is selected, recursively refresh that dir, i.e. scan the filesystem
483for changes and represent them in the tree.
484
485If a file node is selected then the above is done on it's parent.
486
487------------------------------------------------------------------------------
488 *NERDTree-R*
489Default key: R
490Map option: NERDTreeMapRefreshRoot
491Applies to: no restrictions.
492
493Recursively refresh the tree root.
494
495------------------------------------------------------------------------------
496 *NERDTree-m*
497Default key: m
498Map option: NERDTreeMapMenu
499Applies to: files and directories.
500
501Display the NERD tree menu. See |NERDTreeMenu| for details.
502
503------------------------------------------------------------------------------
504 *NERDTree-cd*
505Default key: cd
506Map option: NERDTreeMapChdir
507Applies to: files and directories.
508
509Change vims current working directory to that of the selected node.
510
511------------------------------------------------------------------------------
512 *NERDTree-I*
513Default key: I
514Map option: NERDTreeMapToggleHidden
515Applies to: no restrictions.
516
517Toggles whether hidden files (i.e. "dot files") are displayed.
518
519------------------------------------------------------------------------------
520 *NERDTree-f*
521Default key: f
522Map option: NERDTreeMapToggleFilters
523Applies to: no restrictions.
524
525Toggles whether file filters are used. See |'NERDTreeIgnore'| for details.
526
527------------------------------------------------------------------------------
528 *NERDTree-F*
529Default key: F
530Map option: NERDTreeMapToggleFiles
531Applies to: no restrictions.
532
533Toggles whether file nodes are displayed.
534
535------------------------------------------------------------------------------
536 *NERDTree-B*
537Default key: B
538Map option: NERDTreeMapToggleBookmarks
539Applies to: no restrictions.
540
541Toggles whether the bookmarks table is displayed.
542
543------------------------------------------------------------------------------
544 *NERDTree-q*
545Default key: q
546Map option: NERDTreeMapQuit
547Applies to: no restrictions.
548
549Closes the NERDtree window.
550
551------------------------------------------------------------------------------
552 *NERDTree-A*
553Default key: A
554Map option: NERDTreeMapToggleZoom
555Applies to: no restrictions.
556
557Maximize (zoom) and minimize the NERDtree window.
558
559------------------------------------------------------------------------------
560 *NERDTree-?*
561Default key: ?
562Map option: NERDTreeMapHelp
563Applies to: no restrictions.
564
565Toggles whether the quickhelp is displayed.
566
567------------------------------------------------------------------------------
5682.3. The NERD tree menu *NERDTreeMenu*
569
570The 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
572file explorers have.
573
574The script comes with two default menu plugins: exec_menuitem.vim and
575fs_menu.vim. fs_menu.vim adds some basic filesystem operations to the menu for
576creating/deleting/moving/copying files and dirs. exec_menuitem.vim provides a
577menu item to execute executable files.
578
579Related tags: |NERDTree-m| |NERDTreeApi|
580
581==============================================================================
5823. Customisation *NERDTreeOptions*
583
584
585------------------------------------------------------------------------------
5863.1. Customisation summary *NERDTreeOptionSummary*
587
588The script provides the following options that can customise the behaviour the
589NERD tree. These options should be set in your vimrc.
590
591|'loaded_nerd_tree'| Turns off the script.
592
593|'NERDChristmasTree'| Tells the NERD tree to make itself colourful
594 and pretty.
595
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.
600
601|'NERDTreeCaseSensitiveSort'| Tells the NERD tree whether to be case
602 sensitive or not when sorting nodes.
603
604|'NERDTreeChDirMode'| Tells the NERD tree if/when it should change
605 vim's current working directory.
606
607|'NERDTreeHighlightCursorline'| Tell the NERD tree whether to highlight the
608 current cursor line.
609
610|'NERDTreeHijackNetrw'| Tell the NERD tree whether to replace the netrw
611 autocommands for exploring local directories.
612
613|'NERDTreeIgnore'| Tells the NERD tree which files to ignore.
614
615|'NERDTreeBookmarksFile'| Where the bookmarks are stored.
616
617|'NERDTreeMouseMode'| Tells the NERD tree how to handle mouse
618 clicks.
619
620|'NERDTreeQuitOnOpen'| Closes the tree window after opening a file.
621
622|'NERDTreeShowBookmarks'| Tells the NERD tree whether to display the
623 bookmarks table on startup.
624
625|'NERDTreeShowFiles'| Tells the NERD tree whether to display files
626 in the tree on startup.
627
628|'NERDTreeShowHidden'| Tells the NERD tree whether to display hidden
629 files on startup.
630
631|'NERDTreeShowLineNumbers'| Tells the NERD tree whether to display line
632 numbers in the tree window.
633
634|'NERDTreeSortOrder'| Tell the NERD tree how to sort the nodes in
635 the tree.
636
637|'NERDTreeStatusline'| Set a statusline for NERD tree windows.
638
639|'NERDTreeWinPos'| Tells the script where to put the NERD tree
640 window.
641
642|'NERDTreeWinSize'| Sets the window size when the NERD tree is
643 opened.
644
645------------------------------------------------------------------------------
6463.2. Customisation details *NERDTreeOptionDetails*
647
648To enable any of the below options you should put the given line in your
649~/.vimrc
650
651 *'loaded_nerd_tree'*
652If this plugin is making you feel homicidal, it may be a good idea to turn it
653off with this line in your vimrc: >
654 let loaded_nerd_tree=1
655<
656------------------------------------------------------------------------------
657 *'NERDChristmasTree'*
658Values: 0 or 1.
659Default: 1.
660
661If this option is set to 1 then some extra syntax highlighting elements are
662added to the nerd tree to make it more colourful.
663
664Set it to 0 for a more vanilla looking tree.
665
666------------------------------------------------------------------------------
667 *'NERDTreeAutoCenter'*
668Values: 0 or 1.
669Default: 1
670
671If set to 1, the NERD tree window will center around the cursor if it moves to
672within |'NERDTreeAutoCenterThreshold'| lines of the top/bottom of the window.
673
674This is ONLY done in response to tree navigation mappings,
675i.e. |NERDTree-J| |NERDTree-K| |NERDTree-C-J| |NERDTree-C-K| |NERDTree-p|
676|NERDTree-P|
677
678The centering is done with a |zz| operation.
679
680------------------------------------------------------------------------------
681 *'NERDTreeAutoCenterThreshold'*
682Values: Any natural number.
683Default: 3
684
685This option controls the "sensitivity" of the NERD tree auto centering. See
686|'NERDTreeAutoCenter'| for details.
687
688------------------------------------------------------------------------------
689 *'NERDTreeCaseSensitiveSort'*
690Values: 0 or 1.
691Default: 0.
692
693By default the NERD tree does not sort nodes case sensitively, i.e. nodes
694could appear like this: >
695 bar.c
696 Baz.c
697 blarg.c
698 boner.c
699 Foo.c
700<
701But, if you set this option to 1 then the case of the nodes will be taken into
702account. The above nodes would then be sorted like this: >
703 Baz.c
704 Foo.c
705 bar.c
706 blarg.c
707 boner.c
708<
709------------------------------------------------------------------------------
710 *'NERDTreeChDirMode'*
711
712Values: 0, 1 or 2.
713Default: 0.
714
715Use this option to tell the script when (if at all) to change the current
716working directory (CWD) for vim.
717
718If it is set to 0 then the CWD is never changed by the NERD tree.
719
720If set to 1 then the CWD is changed when the NERD tree is first loaded to the
721directory it is initialized in. For example, if you start the NERD tree with >
722 :NERDTree /home/marty/foobar
723<
724then the CWD will be changed to /home/marty/foobar and will not be changed
725again unless you init another NERD tree with a similar command.
726
727If the option is set to 2 then it behaves the same as if set to 1 except that
728the CWD is changed whenever the tree root is changed. For example, if the CWD
729is /home/marty/foobar and you make the node for /home/marty/foobar/baz the new
730root then the CWD will become /home/marty/foobar/baz.
731
732------------------------------------------------------------------------------
733 *'NERDTreeHighlightCursorline'*
734Values: 0 or 1.
735Default: 1.
736
737If set to 1, the current cursor line in the NERD tree buffer will be
738highlighted. This is done using the |'cursorline'| option.
739
740------------------------------------------------------------------------------
741 *'NERDTreeHijackNetrw'*
742Values: 0 or 1.
743Default: 1.
744
745If set to 1, doing a >
746 :edit <some directory>
747<
748will open up a "secondary" NERD tree instead of a netrw in the target window.
749
750Secondary NERD trees behaves slighly different from a regular trees in the
751following respects:
752 1. 'o' will open the selected file in the same window as the tree,
753 replacing it.
754 2. you can have as many secondary tree as you want in the same tab.
755
756------------------------------------------------------------------------------
757 *'NERDTreeIgnore'*
758Values: a list of regular expressions.
759Default: ['\~$'].
760
761This option is used to specify which files the NERD tree should ignore. It
762must be a list of regular expressions. When the NERD tree is rendered, any
763files/dirs that match any of the regex's in 'NERDTreeIgnore' wont be
764displayed.
765
766For example if you put the following line in your vimrc: >
767 let NERDTreeIgnore=['\.vim$', '\~$']
768<
769then all files ending in .vim or ~ will be ignored.
770
771Note: to tell the NERD tree not to ignore any files you must use the following
772line: >
773 let NERDTreeIgnore=[]
774<
775
776The file filters can be turned on and off dynamically with the |NERDTree-f|
777mapping.
778
779------------------------------------------------------------------------------
780 *'NERDTreeBookmarksFile'*
781Values: a path
782Default: $HOME/.NERDTreeBookmarks
783
784This is where bookmarks are saved. See |NERDTreeBookmarkCommands|.
785
786------------------------------------------------------------------------------
787 *'NERDTreeMouseMode'*
788Values: 1, 2 or 3.
789Default: 1.
790
791If set to 1 then a double click on a node is required to open it.
792If set to 2 then a single click will open directory nodes, while a double
793click will still be required for file nodes.
794If set to 3 then a single click will open any node.
795
796Note: a double click anywhere on a line that a tree node is on will
797activate it, but all single-click activations must be done on name of the node
798itself. For example, if you have the following node: >
799 | | |-application.rb
800<
801then (to single click activate it) you must click somewhere in
802'application.rb'.
803
804------------------------------------------------------------------------------
805 *'NERDTreeQuitOnOpen'*
806
807Values: 0 or 1.
808Default: 0
809
810If 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.
812
813------------------------------------------------------------------------------
814 *'NERDTreeShowBookmarks'*
815Values: 0 or 1.
816Default: 0.
817
818If this option is set to 1 then the bookmarks table will be displayed.
819
820This option can be toggled dynamically, per tree, with the |NERDTree-B|
821mapping.
822
823------------------------------------------------------------------------------
824 *'NERDTreeShowFiles'*
825Values: 0 or 1.
826Default: 1.
827
828If this option is set to 1 then files are displayed in the NERD tree. If it is
829set to 0 then only directories are displayed.
830
831This option can be toggled dynamically, per tree, with the |NERDTree-F|
832mapping and is useful for drastically shrinking the tree when you are
833navigating to a different part of the tree.
834
835------------------------------------------------------------------------------
836 *'NERDTreeShowHidden'*
837Values: 0 or 1.
838Default: 0.
839
840This option tells vim whether to display hidden files by default. This option
841can be dynamically toggled, per tree, with the |NERDTree-I| mapping. Use one
842of the follow lines to set this option: >
843 let NERDTreeShowHidden=0
844 let NERDTreeShowHidden=1
845<
846
847------------------------------------------------------------------------------
848 *'NERDTreeShowLineNumbers'*
849Values: 0 or 1.
850Default: 0.
851
852This option tells vim whether to display line numbers for the NERD tree
853window. Use one of the follow lines to set this option: >
854 let NERDTreeShowLineNumbers=0
855 let NERDTreeShowLineNumbers=1
856<
857
858------------------------------------------------------------------------------
859 *'NERDTreeSortOrder'*
860Values: a list of regular expressions.
861Default: ['\/$', '*', '\.swp$', '\.bak$', '\~$']
862
863This option is set to a list of regular expressions which are used to
864specify the order of nodes under their parent.
865
866For example, if the option is set to: >
867 ['\.vim$', '\.c$', '\.h$', '*', 'foobar']
868<
869then all .vim files will be placed at the top, followed by all .c files then
870all .h files. All files containing the string 'foobar' will be placed at the
871end. The star is a special flag: it tells the script that every node that
872doesnt match any of the other regexps should be placed here.
873
874If no star is present in 'NERDTreeSortOrder' then one is automatically
875appended to the array.
876
877The regex '\/$' should be used to match directory nodes.
878
879After this sorting is done, the files in each group are sorted alphabetically.
880
881Other examples: >
882 (1) ['*', '\/$']
883 (2) []
884 (3) ['\/$', '\.rb$', '\.php$', '*', '\.swp$', '\.bak$', '\~$']
885<
8861. Directories will appear last, everything else will appear above.
8872. Everything will simply appear in alphabetical order.
8883. 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.
890
891------------------------------------------------------------------------------
892 *'NERDTreeStatusline'*
893Values: Any valid statusline setting.
894Default: %{b:NERDTreeRoot.path.strForOS(0)}
895
896Tells the script what to use as the |'statusline'| setting for NERD tree
897windows.
898
899Note that the statusline is set using |:let-&| not |:set| so escaping spaces
900isn't necessary.
901
902Setting this option to -1 will will deactivate it so that your global
903statusline setting is used instead.
904
905------------------------------------------------------------------------------
906 *'NERDTreeWinPos'*
907Values: "left" or "right"
908Default: "left".
909
910This option is used to determine where NERD tree window is placed on the
911screen.
912
913This option makes it possible to use two different explorer plugins
914simultaneously. For example, you could have the taglist plugin on the left of
915the window and the NERD tree on the right.
916
917------------------------------------------------------------------------------
918 *'NERDTreeWinSize'*
919Values: a positive integer.
920Default: 31.
921
922This option is used to change the size of the NERD tree when it is loaded.
923
924==============================================================================
9254. The NERD tree API *NERDTreeAPI*
926
927The NERD tree script allows you to add custom key mappings and menu items via
928a set of API calls. Any scripts that use this API should be placed in
929~/.vim/nerdtree_plugin/ (*nix) or ~/vimfiles/nerdtree_plugin (windows).
930
931The script exposes some prototype objects that can be used to manipulate the
932tree and/or get information from it: >
933 g:NERDTreePath
934 g:NERDTreeDirNode
935 g:NERDTreeFileNode
936 g:NERDTreeBookmark
937<
938See the code/comments in NERD_tree.vim to find how to use these objects. The
939following 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
943
944See this blog post for more details:
945 http://got-ravings.blogspot.com/2008/09/vim-pr0n-prototype-based-objects.html
946
947------------------------------------------------------------------------------
9484.1. Key map API *NERDTreeKeymapAPI*
949
950NERDTreeAddKeyMap({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
956 |NERDTree-?|)
957
958 Example: >
959 call NERDTreeAddKeyMap({
960 \ 'key': 'b',
961 \ 'callback': 'NERDTreeEchoCurrentNode',
962 \ 'quickhelpText': 'echo full path of current node' })
963
964 function! NERDTreeEchoCurrentNode()
965 let n = g:NERDTreeFileNode.GetSelected()
966 if n != {}
967 echomsg 'Current node: ' . n.path.str()
968 endif
969 endfunction
970<
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
973 current node.
974
975------------------------------------------------------------------------------
9764.2. Menu API *NERDTreeMenuAPI*
977
978NERDTreeAddSubmenu({options}) *NERDTreeAddSubmenu()*
979 Creates and returns a new submenu.
980
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)
984
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
988 0 or 1.
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.
992
993 See below for an example.
994
995NERDTreeAddMenuItem({options}) *NERDTreeAddMenuItem()*
996 Adds a new menu item to the NERD tree menu (see |NERDTreeMenu|).
997
998 {options} must be a dictionary and must contain the
999 following keys:
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
1003 menu item.
1004
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
1008 0 or 1.
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()|.
1012
1013 See below for an example.
1014
1015NERDTreeAddMenuSeparator([{options}]) *NERDTreeAddMenuSeparator()*
1016 Adds a menu separator (a row of dashes).
1017
1018 {options} is an optional dictionary that may contain the following keys:
1019 "isActiveCallback" - see description in |NERDTreeAddMenuItem()|.
1020
1021Below is an example of the menu API in action. >
1022 call NERDTreeAddMenuSeparator()
1023
1024 call NERDTreeAddMenuItem({
1025 \ 'text': 'a (t)op level menu item',
1026 \ 'shortcut': 't',
1027 \ 'callback': 'SomeFunction' })
1028
1029 let submenu = NERDTreeAddSubmenu({
1030 \ 'text': 'a (s)ub menu',
1031 \ 'shortcut': 's' })
1032
1033 call NERDTreeAddMenuItem({
1034 \ 'text': '(n)ested item 1',
1035 \ 'shortcut': 'n',
1036 \ 'callback': 'SomeFunction',
1037 \ 'parent': submenu })
1038
1039 call NERDTreeAddMenuItem({
1040 \ 'text': '(n)ested item 2',
1041 \ 'shortcut': 'n',
1042 \ 'callback': 'SomeFunction',
1043 \ 'parent': submenu })
1044<
1045This will create the following menu: >
1046 --------------------
1047 a (t)op level menu item
1048 a (s)ub menu
1049<
1050Where selecting "a (s)ub menu" will lead to a second menu: >
1051 (n)ested item 1
1052 (n)ested item 2
1053<
1054When any of the 3 concrete menu items are selected the function "SomeFunction"
1055will be called.
1056
1057------------------------------------------------------------------------------
1058NERDTreeRender() *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.
1061
1062==============================================================================
10635. About *NERDTreeAbout*
1064
1065The author of the NERD tree is a terrible terrible monster called Martyzilla
1066who gobbles up small children with milk and sugar for breakfast.
1067
1068He can be reached at martin.grenfell at gmail dot com. He would love to hear
1069from you, so feel free to send him suggestions and/or comments about this
1070plugin. Don't be shy --- the worst he can do is slaughter you and stuff you in
1071the fridge for later ;)
1072
1073The latest stable versions can be found at
1074 http://www.vim.org/scripts/script.php?script_id=1658
1075
1076The latest dev versions are on github
1077 http://github.com/scrooloose/nerdtree
1078
1079
1080==============================================================================
10816. Changelog *NERDTreeChangelog*
1082
10834.x.x
1084 - Fix a bug with :NERDTreeFind and symlinks. Thanks to Vitaly Bogdanov.
1085
10864.1.0
1087 features:
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
1094 Gonzalez.
1095
1096 bugfixes:
1097 - really fix window state restoring
1098 - fix some win32 path escaping issues. Thanks to Stephan Baumeister, Ricky,
1099 jfilip1024, and Chris Chambers
1100
11014.0.0
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.
1108
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
1118
11193.1.1
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
1126 - other minor fixes
1127
11283.1.0
1129 New features:
1130 - add mappings to open files in a vsplit, see :help NERDTree-s and :help
1131 NERDTree-gs
1132 - make the statusline for the nerd tree window default to something
1133 hopefully more useful. See :help 'NERDTreeStatusline'
1134 Bugfixes:
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)
1144
1145
11463.0.1
1147 Bugfixes:
1148 - fix bugs with :NERDTreeToggle and :NERDTreeMirror when 'hidden
1149 was not set
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,
1153 thanks to jamessan
1154 - fix a bunch of small bugs with secondary trees
1155
1156 More insane refactoring.
1157
11583.0.0
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
1166
1167==============================================================================
11687. Credits *NERDTreeCredits*
1169
1170Thanks to the following people for testing, bug reports, ideas etc. Without
1171you I probably would have got bored of the hacking the NERD tree and
1172just downloaded pr0n instead.
1173
1174 Tim Carey-Smith (halorgium)
1175 Vigil
1176 Nick Brettell
1177 Thomas Scott Urban
1178 Terrance Cohen
1179 Yegappan Lakshmanan
1180 Jason Mills
1181 Michael Geddes (frogonwheels)
1182 Yu Jun
1183 Michael Madsen
1184 AOYAMA Shotaro
1185 Zhang Weiwu
1186 Niels Aan de Brugh
1187 Olivier Yiptong
1188 Zhang Shuhan
1189 Cory Echols
1190 Piotr Czachur
1191 Yuan Jiang
1192 Matan Nassau
1193 Maxim Kim
1194 Charlton Wang
1195 Matt Wozniski (godlygeek)
1196 knekk
1197 Sean Chou
1198 Ryan Penn
1199 Simon Peter Nicholls
1200 Michael Foobar
1201 Tomasz Chomiuk
1202 Denis Pokataev
1203 Tim Pope (tpope)
1204 James Kanze
1205 James Vega (jamessan)
1206 Frederic Chanal (nach)
1207 Alf Mikula
1208 Lucas S. Buchala
1209 Curtis Harvey
1210 Guillaume Duranceau
1211 Richard Hart (hates)
1212 Doug McInnes
1213 Stefan Ritter
1214 Rémi Prévost
1215 Victor Gonzalez
1216 Stephan Baumeister
1217 Ricky
1218 jfilip1024
1219 Chris Chambers
1220 Vitaly Bogdanov
1221
1222==============================================================================
12238. License *NERDTreeLicense*
1224
1225The NERD tree is released under the wtfpl.
1226See http://sam.zoy.org/wtfpl/COPYING.