mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 19:33:50 -05:00
Compare commits
159 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
205367ab3f | ||
|
|
4bd0def6fb | ||
|
|
4411344f7c | ||
|
|
7ff9def95b | ||
|
|
b3b394c329 | ||
|
|
4dd1bc9ef6 | ||
|
|
1b4dfc8745 | ||
|
|
0747198ee3 | ||
|
|
23d1746bbf | ||
|
|
aa28ae7863 | ||
|
|
02f1d828d9 | ||
|
|
b528910e7a | ||
|
|
dcccd0e532 | ||
|
|
af833e3006 | ||
|
|
82c93a6448 | ||
|
|
49b88757b0 | ||
|
|
30f6bcc30c | ||
|
|
796a40b5d7 | ||
|
|
1c568a4916 | ||
|
|
12f692f436 | ||
|
|
9b5851c36c | ||
|
|
077e330b64 | ||
|
|
86364c2150 | ||
|
|
2dd198c6c4 | ||
|
|
c08d7e9f19 | ||
|
|
5bd641834d | ||
|
|
2fbd578a77 | ||
|
|
04aa45fcd8 | ||
|
|
71d6c1d3c6 | ||
|
|
063e4d0870 | ||
|
|
70ba0d60ec | ||
|
|
1cd50482d2 | ||
|
|
bf73470723 | ||
|
|
2e072fe0e2 | ||
|
|
7f5a8c3aac | ||
|
|
f621df68ae | ||
|
|
6a6ffe2ad6 | ||
|
|
1dd345c56d | ||
|
|
bc0c64ef82 | ||
|
|
702a88956b | ||
|
|
fad6f06ace | ||
|
|
e697444f29 | ||
|
|
d595605ff1 | ||
|
|
b9e970d934 | ||
|
|
999ba49857 | ||
|
|
21bd141866 | ||
|
|
e88f436302 | ||
|
|
2d17132f48 | ||
|
|
8accb0978e | ||
|
|
867de91643 | ||
|
|
1de3c22a44 | ||
|
|
eac32148a4 | ||
|
|
37bfae0d2f | ||
|
|
2504666a72 | ||
|
|
9e415dcc6d | ||
|
|
e4efdb3bd4 | ||
|
|
721ad3ecc2 | ||
|
|
8618929e9a | ||
|
|
b3df8fb1e6 | ||
|
|
492f491056 | ||
|
|
7650cdc662 | ||
|
|
a72cb80337 | ||
|
|
e1abd4d373 | ||
|
|
37859888b5 | ||
|
|
88aaba22b5 | ||
|
|
a997ab3341 | ||
|
|
153041ac93 | ||
|
|
68cb5fc2eb | ||
|
|
ee7aafb135 | ||
|
|
b047d7f312 | ||
|
|
1537d42706 | ||
|
|
4b566f153f | ||
|
|
f34986d30f | ||
|
|
a713a86f06 | ||
|
|
08bc9870bc | ||
|
|
94e085f1a2 | ||
|
|
241f2e9dfe | ||
|
|
c864c6e463 | ||
|
|
bc55f3dda8 | ||
|
|
39a3a78729 | ||
|
|
31f65b97b1 | ||
|
|
3837ea85e0 | ||
|
|
fedd5f1162 | ||
|
|
dc108f555e | ||
|
|
93a0a422b4 | ||
|
|
e899bed4d7 | ||
|
|
87fbc2e5e4 | ||
|
|
cf61ad3285 | ||
|
|
f772cfdefb | ||
|
|
a1e7bc0b01 | ||
|
|
e5c79fc5c1 | ||
|
|
a3b05e8e38 | ||
|
|
89cfedd39b | ||
|
|
1be18ed53c | ||
|
|
e2265ec3b3 | ||
|
|
5ba3b3a5a8 | ||
|
|
6a513e4340 | ||
|
|
1ea2a0c29b | ||
|
|
3a163fca64 | ||
|
|
36e4402550 | ||
|
|
effb5d4de0 | ||
|
|
a854feeb1e | ||
|
|
cbb0a8698f | ||
|
|
d21b00c767 | ||
|
|
5311777308 | ||
|
|
7a5685af57 | ||
|
|
38e2bcaf85 | ||
|
|
0dda0ce5d7 | ||
|
|
8fc72fd352 | ||
|
|
dc3f1b5edf | ||
|
|
dd38ab8f43 | ||
|
|
7051977808 | ||
|
|
d9f315d63e | ||
|
|
5e9635dfa4 | ||
|
|
f2a9e9a360 | ||
|
|
1080246af9 | ||
|
|
fcb4ec0303 | ||
|
|
8211554efa | ||
|
|
464699215c | ||
|
|
10bb62a728 | ||
|
|
46710bfb25 | ||
|
|
fcb54eee12 | ||
|
|
a686be5c31 | ||
|
|
bd5e5d71b5 | ||
|
|
711c8e3328 | ||
|
|
ec1f7e3e6e | ||
|
|
8535a906be | ||
|
|
eef8a7b280 | ||
|
|
891f0ed3a2 | ||
|
|
e93bf0632b | ||
|
|
31c0ec6d63 | ||
|
|
fc3cb76695 | ||
|
|
389f33ea81 | ||
|
|
abc0cc4c40 | ||
|
|
1654ef820b | ||
|
|
df3485ec64 | ||
|
|
59257d7a3a | ||
|
|
a052a0db65 | ||
|
|
65dd1137da | ||
|
|
236d20946c | ||
|
|
a796715ac1 | ||
|
|
abfd4fef76 | ||
|
|
95acf7dd25 | ||
|
|
02b3cec827 | ||
|
|
c3a2f88b63 | ||
|
|
bc2a628a10 | ||
|
|
6518d1eb4c | ||
|
|
a2ead3545e | ||
|
|
a163f327eb | ||
|
|
e9d6a7209c | ||
|
|
f0290b08dd | ||
|
|
51637ec6d4 | ||
|
|
4d77c3ae45 | ||
|
|
a7f9abe827 | ||
|
|
41029aef24 | ||
|
|
c75a022a23 | ||
|
|
1acf6321a5 | ||
|
|
e164980d84 | ||
|
|
71ebe27a8d |
89
README.markdown
Normal file
89
README.markdown
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
The NERD Tree
|
||||||
|
=============
|
||||||
|
|
||||||
|
Intro
|
||||||
|
-----
|
||||||
|
|
||||||
|
The NERD tree allows you to explore your filesystem and to open files and
|
||||||
|
directories. It presents the filesystem to you in the form of a tree which you
|
||||||
|
manipulate with the keyboard and/or mouse. It also allows you to perform
|
||||||
|
simple filesystem operations.
|
||||||
|
|
||||||
|
The following features and functionality are provided by the NERD tree:
|
||||||
|
|
||||||
|
* Files and directories are displayed in a hierarchical tree structure
|
||||||
|
* Different highlighting is provided for the following types of nodes:
|
||||||
|
* files
|
||||||
|
* directories
|
||||||
|
* sym-links
|
||||||
|
* windows .lnk files
|
||||||
|
* read-only files
|
||||||
|
* executable files
|
||||||
|
* Many (customisable) mappings are provided to manipulate the tree:
|
||||||
|
* Mappings to open/close/explore directory nodes
|
||||||
|
* Mappings to open files in new/existing windows/tabs
|
||||||
|
* Mappings to change the current root of the tree
|
||||||
|
* Mappings to navigate around the tree
|
||||||
|
* ...
|
||||||
|
* Directories and files can be bookmarked.
|
||||||
|
* Most NERD tree navigation can also be done with the mouse
|
||||||
|
* Filtering of tree content (can be toggled at runtime)
|
||||||
|
* custom file filters to prevent e.g. vim backup files being displayed
|
||||||
|
* optional displaying of hidden files (. files)
|
||||||
|
* files can be "turned off" so that only directories are displayed
|
||||||
|
* The position and size of the NERD tree window can be customised
|
||||||
|
* The order in which the nodes in the tree are listed can be customised.
|
||||||
|
* A model of your filesystem is created/maintained as you explore it. This
|
||||||
|
has several advantages:
|
||||||
|
* All filesystem information is cached and is only re-read on demand
|
||||||
|
* If you revisit a part of the tree that you left earlier in your
|
||||||
|
session, the directory nodes will be opened/closed as you left them
|
||||||
|
* The script remembers the cursor position and window position in the NERD
|
||||||
|
tree so you can toggle it off (or just close the tree window) and then
|
||||||
|
reopen it (with NERDTreeToggle) the NERD tree window will appear exactly
|
||||||
|
as you left it
|
||||||
|
* You can have a separate NERD tree for each tab, share trees across tabs,
|
||||||
|
or a mix of both.
|
||||||
|
* By default the script overrides the default file browser (netw), so if
|
||||||
|
you :edit a directory a (slighly modified) NERD tree will appear in the
|
||||||
|
current window
|
||||||
|
* A programmable menu system is provided (simulates right clicking on a node)
|
||||||
|
* one default menu plugin is provided to perform basic filesytem
|
||||||
|
operations (create/delete/move/copy files/directories)
|
||||||
|
* There's an API for adding your own keymappings
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
|
||||||
|
[pathogen.vim](https://github.com/tpope/vim-pathogen) is the recommended way to install nerdtree.
|
||||||
|
|
||||||
|
cd ~/.vim/bundle
|
||||||
|
git clone https://github.com/scrooloose/nerdtree.git
|
||||||
|
|
||||||
|
Then reload vim, run `:helptags`, and check out `:help NERD_tree.txt`.
|
||||||
|
|
||||||
|
|
||||||
|
Faq
|
||||||
|
---
|
||||||
|
|
||||||
|
Q. Can I have the nerdtree on every tab automatically?
|
||||||
|
|
||||||
|
A. 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 behavour then consider [vim-nerdtree-tabs](https://github.com/jistr/vim-nerdtree-tabs)
|
||||||
|
|
||||||
|
Changelog
|
||||||
|
---------
|
||||||
|
|
||||||
|
4.2.0 (2011-12-28)
|
||||||
|
|
||||||
|
* 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!)
|
||||||
|
|
||||||
18
Rakefile
18
Rakefile
@@ -1,18 +0,0 @@
|
|||||||
desc "Copy the vim/doc files into ~/.vim"
|
|
||||||
task :deploy_local do
|
|
||||||
run "cp plugin/NERD_tree.vim ~/.vim/plugin"
|
|
||||||
run "cp doc/NERD_tree.txt ~/.vim/doc"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
desc "Create a zip archive for release to vim.org"
|
|
||||||
task :zip do
|
|
||||||
abort "NERD_tree.zip already exists, aborting" if File.exist?("NERD_tree.zip")
|
|
||||||
run "zip NERD_tree.zip plugin/NERD_tree.vim doc/NERD_tree.txt"
|
|
||||||
end
|
|
||||||
|
|
||||||
def run(cmd)
|
|
||||||
puts "Executing: #{cmd}"
|
|
||||||
system cmd
|
|
||||||
end
|
|
||||||
|
|
||||||
@@ -27,11 +27,13 @@ CONTENTS *NERDTree-contents*
|
|||||||
2.2.2.Bookmark commands...........|NERDTreeBookmarkCommands|
|
2.2.2.Bookmark commands...........|NERDTreeBookmarkCommands|
|
||||||
2.2.3.Invalid bookmarks...........|NERDTreeInvalidBookmarks|
|
2.2.3.Invalid bookmarks...........|NERDTreeInvalidBookmarks|
|
||||||
2.3.NERD tree mappings................|NERDTreeMappings|
|
2.3.NERD tree mappings................|NERDTreeMappings|
|
||||||
2.4.The filesystem menu...............|NERDTreeFilesysMenu|
|
2.4.The NERD tree menu................|NERDTreeMenu|
|
||||||
3.Options.................................|NERDTreeOptions|
|
3.Options.................................|NERDTreeOptions|
|
||||||
3.1.Option summary....................|NERDTreeOptionSummary|
|
3.1.Option summary....................|NERDTreeOptionSummary|
|
||||||
3.2.Option details....................|NERDTreeOptionDetails|
|
3.2.Option details....................|NERDTreeOptionDetails|
|
||||||
4.Hacking the NERD tree...................|NERDTreeHacking|
|
4.The NERD tree API.......................|NERDTreeAPI|
|
||||||
|
4.1.Key map API.......................|NERDTreeKeymapAPI|
|
||||||
|
4.2.Menu API..........................|NERDTreeMenuAPI|
|
||||||
5.About...................................|NERDTreeAbout|
|
5.About...................................|NERDTreeAbout|
|
||||||
6.Changelog...............................|NERDTreeChangelog|
|
6.Changelog...............................|NERDTreeChangelog|
|
||||||
7.Credits.................................|NERDTreeCredits|
|
7.Credits.................................|NERDTreeCredits|
|
||||||
@@ -68,9 +70,6 @@ The following features and functionality are provided by the NERD tree:
|
|||||||
* custom file filters to prevent e.g. vim backup files being displayed
|
* custom file filters to prevent e.g. vim backup files being displayed
|
||||||
* optional displaying of hidden files (. files)
|
* optional displaying of hidden files (. files)
|
||||||
* files can be "turned off" so that only directories are displayed
|
* files can be "turned off" so that only directories are displayed
|
||||||
* A textual filesystem menu is provided which allows you to
|
|
||||||
create/delete/move file and directory nodes as well as copy (for
|
|
||||||
supported OSs)
|
|
||||||
* The position and size of the NERD tree window can be customised
|
* The position and size of the NERD tree window can be customised
|
||||||
* The order in which the nodes in the tree are listed can be customised.
|
* The order in which the nodes in the tree are listed can be customised.
|
||||||
* A model of your filesystem is created/maintained as you explore it. This
|
* A model of your filesystem is created/maintained as you explore it. This
|
||||||
@@ -87,6 +86,12 @@ The following features and functionality are provided by the NERD tree:
|
|||||||
* By default the script overrides the default file browser (netw), so if
|
* By default the script overrides the default file browser (netw), so if
|
||||||
you :edit a directory a (slighly modified) NERD tree will appear in the
|
you :edit a directory a (slighly modified) NERD tree will appear in the
|
||||||
current window
|
current window
|
||||||
|
* A programmable menu system is provided (simulates right clicking on a
|
||||||
|
node)
|
||||||
|
* one default menu plugin is provided to perform basic filesytem
|
||||||
|
operations (create/delete/move/copy files/directories)
|
||||||
|
* There's an API for adding your own keymappings
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
2. Functionality provided *NERDTreeFunctionality*
|
2. Functionality provided *NERDTreeFunctionality*
|
||||||
@@ -123,6 +128,15 @@ The following features and functionality are provided by the NERD tree:
|
|||||||
:NERDTreeClose *:NERDTreeClose*
|
:NERDTreeClose *:NERDTreeClose*
|
||||||
Close the NERD tree in this tab.
|
Close the NERD tree in this tab.
|
||||||
|
|
||||||
|
:NERDTreeFind *:NERDTreeFind*
|
||||||
|
Find the current file in the tree.
|
||||||
|
|
||||||
|
If not tree exists and the current file is under vim's CWD, then init a
|
||||||
|
tree at the CWD and reveal the file. Otherwise init a tree in the current
|
||||||
|
file's directory.
|
||||||
|
|
||||||
|
In any case, the current file is revealed and the cursor is placed on it.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
2.2. Bookmarks *NERDTreeBookmarks*
|
2.2. Bookmarks *NERDTreeBookmarks*
|
||||||
|
|
||||||
@@ -145,6 +159,8 @@ Note that the following commands are only available in the NERD tree buffer.
|
|||||||
:Bookmark <name>
|
:Bookmark <name>
|
||||||
Bookmark the current node as <name>. If there is already a <name>
|
Bookmark the current node as <name>. If there is already a <name>
|
||||||
bookmark, it is overwritten. <name> must not contain spaces.
|
bookmark, it is overwritten. <name> must not contain spaces.
|
||||||
|
If <name> is not provided, it defaults to the file or directory name.
|
||||||
|
For directories, a trailing slash is present.
|
||||||
|
|
||||||
:BookmarkToRoot <bookmark>
|
:BookmarkToRoot <bookmark>
|
||||||
Make the directory corresponding to <bookmark> the new root. If a treenode
|
Make the directory corresponding to <bookmark> the new root. If a treenode
|
||||||
@@ -205,7 +221,6 @@ i.......Open selected file in a split window.....................|NERDTree-i|
|
|||||||
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
|
||||||
s.......Open selected file in a new vsplit.......................|NERDTree-s|
|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
|
||||||
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|
|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|
|
||||||
!.......Execute the current file.................................|NERDTree-!|
|
|
||||||
O.......Recursively open the selected directory..................|NERDTree-O|
|
O.......Recursively open the selected directory..................|NERDTree-O|
|
||||||
x.......Close the current nodes parent...........................|NERDTree-x|
|
x.......Close the current nodes parent...........................|NERDTree-x|
|
||||||
X.......Recursively close all children of the current node.......|NERDTree-X|
|
X.......Recursively close all children of the current node.......|NERDTree-X|
|
||||||
@@ -230,7 +245,7 @@ u.......Move the tree root up one directory......................|NERDTree-u|
|
|||||||
U.......Same as 'u' except the old root node is left open........|NERDTree-U|
|
U.......Same as 'u' except the old root node is left open........|NERDTree-U|
|
||||||
r.......Recursively refresh the current directory................|NERDTree-r|
|
r.......Recursively refresh the current directory................|NERDTree-r|
|
||||||
R.......Recursively refresh the current root.....................|NERDTree-R|
|
R.......Recursively refresh the current root.....................|NERDTree-R|
|
||||||
m.......Display the filesystem menu..............................|NERDTree-m|
|
m.......Display the NERD tree menu...............................|NERDTree-m|
|
||||||
cd......Change the CWD to the dir of the selected node...........|NERDTree-cd|
|
cd......Change the CWD to the dir of the selected node...........|NERDTree-cd|
|
||||||
|
|
||||||
I.......Toggle whether hidden files displayed....................|NERDTree-I|
|
I.......Toggle whether hidden files displayed....................|NERDTree-I|
|
||||||
@@ -239,6 +254,7 @@ F.......Toggle whether files are displayed.......................|NERDTree-F|
|
|||||||
B.......Toggle whether the bookmark table is displayed...........|NERDTree-B|
|
B.......Toggle whether the bookmark table is displayed...........|NERDTree-B|
|
||||||
|
|
||||||
q.......Close the NERDTree window................................|NERDTree-q|
|
q.......Close the NERDTree window................................|NERDTree-q|
|
||||||
|
A.......Zoom (maximize/minimize) the NERDTree window.............|NERDTree-A|
|
||||||
?.......Toggle the display of the quick help.....................|NERDTree-?|
|
?.......Toggle the display of the quick help.....................|NERDTree-?|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
@@ -331,14 +347,6 @@ The same as |NERDTree-s| except that the cursor is not moved.
|
|||||||
The key combo for this mapping is always "g" + NERDTreeMapOpenVSplit (see
|
The key combo for this mapping is always "g" + NERDTreeMapOpenVSplit (see
|
||||||
|NERDTree-s|).
|
|NERDTree-s|).
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
*NERDTree-!*
|
|
||||||
Default key: !
|
|
||||||
Map option: NERDTreeMapExecute
|
|
||||||
Applies to: files.
|
|
||||||
|
|
||||||
Executes the selected file, prompting for arguments first.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTree-O*
|
*NERDTree-O*
|
||||||
Default key: O
|
Default key: O
|
||||||
@@ -493,10 +501,10 @@ Recursively refresh the tree root.
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTree-m*
|
*NERDTree-m*
|
||||||
Default key: m
|
Default key: m
|
||||||
Map option: NERDTreeMapFilesystemMenu
|
Map option: NERDTreeMapMenu
|
||||||
Applies to: files and directories.
|
Applies to: files and directories.
|
||||||
|
|
||||||
Display the filesystem menu. See |NERDTreeFilesysMenu| for details.
|
Display the NERD tree menu. See |NERDTreeMenu| for details.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTree-cd*
|
*NERDTree-cd*
|
||||||
@@ -546,6 +554,14 @@ Applies to: no restrictions.
|
|||||||
|
|
||||||
Closes the NERDtree window.
|
Closes the NERDtree window.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*NERDTree-A*
|
||||||
|
Default key: A
|
||||||
|
Map option: NERDTreeMapToggleZoom
|
||||||
|
Applies to: no restrictions.
|
||||||
|
|
||||||
|
Maximize (zoom) and minimize the NERDtree window.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTree-?*
|
*NERDTree-?*
|
||||||
Default key: ?
|
Default key: ?
|
||||||
@@ -555,44 +571,18 @@ Applies to: no restrictions.
|
|||||||
Toggles whether the quickhelp is displayed.
|
Toggles whether the quickhelp is displayed.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
2.3. The filesystem menu *NERDTreeFilesysMenu*
|
2.3. The NERD tree menu *NERDTreeMenu*
|
||||||
|
|
||||||
The purpose of the filesystem menu is to allow you to perform basic filesystem
|
The NERD tree has a menu that can be programmed via the an API (see
|
||||||
operations quickly from the NERD tree rather than the console.
|
|NERDTreeMenuAPI|). The idea is to simulate the "right click" menus that most
|
||||||
|
file explorers have.
|
||||||
|
|
||||||
The filesystem menu can be accessed with 'm' mapping and has four supported
|
The script comes with two default menu plugins: exec_menuitem.vim and
|
||||||
operations: >
|
fs_menu.vim. fs_menu.vim adds some basic filesystem operations to the menu for
|
||||||
1. Adding nodes.
|
creating/deleting/moving/copying files and dirs. exec_menuitem.vim provides a
|
||||||
2. Move nodes.
|
menu item to execute executable files.
|
||||||
3. Deleting nodes.
|
|
||||||
3. Copying nodes.
|
|
||||||
<
|
|
||||||
1. Adding nodes:
|
|
||||||
To add a node move the cursor onto (or anywhere inside) the directory you wish
|
|
||||||
to create the new node inside. Select the 'add node' option from the
|
|
||||||
filesystem menu and type a filename. If the filename you type ends with a '/'
|
|
||||||
character then a directory will be created. Once the operation is completed,
|
|
||||||
the cursor is placed on the new node.
|
|
||||||
|
|
||||||
2. Move nodes:
|
Related tags: |NERDTree-m| |NERDTreeApi|
|
||||||
To move/rename a node, put the cursor on it and select the 'move' option from
|
|
||||||
the filesystem menu. Enter the new location for the node and it will be
|
|
||||||
moved. If the old file is open in a buffer, you will be asked if you wish to
|
|
||||||
delete that buffer. Once the operation is complete the cursor will be placed
|
|
||||||
on the renamed node.
|
|
||||||
|
|
||||||
3. Deleting nodes:
|
|
||||||
To delete a node put the cursor on it and select the 'delete' option from the
|
|
||||||
filesystem menu. After confirmation the node will be deleted. If a file is
|
|
||||||
deleted but still exists as a buffer you will be given the option to delete
|
|
||||||
that buffer.
|
|
||||||
|
|
||||||
4. Copying nodes:
|
|
||||||
To copy a node put the cursor on it and select the 'copy' option from the
|
|
||||||
filesystem menu. Enter the new location and you're done. Note: copying is
|
|
||||||
currently only supported for *nix operating systems. If someone knows a
|
|
||||||
one line copying command for windows that doesnt require user confirmation
|
|
||||||
then id be grateful if you'd email me.
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
3. Customisation *NERDTreeOptions*
|
3. Customisation *NERDTreeOptions*
|
||||||
@@ -658,6 +648,12 @@ NERD tree. These options should be set in your vimrc.
|
|||||||
|'NERDTreeWinSize'| Sets the window size when the NERD tree is
|
|'NERDTreeWinSize'| Sets the window size when the NERD tree is
|
||||||
opened.
|
opened.
|
||||||
|
|
||||||
|
|'NERDTreeMinimalUI'| Disables display of the 'Bookmarks' label and
|
||||||
|
'Press ? for help' text.
|
||||||
|
|
||||||
|
|'NERDTreeDirArrows'| Tells the NERD tree to use arrows instead of
|
||||||
|
+ ~ chars when displaying directories.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2. Customisation details *NERDTreeOptionDetails*
|
3.2. Customisation details *NERDTreeOptionDetails*
|
||||||
|
|
||||||
@@ -824,7 +820,7 @@ Values: 0 or 1.
|
|||||||
Default: 0
|
Default: 0
|
||||||
|
|
||||||
If set to 1, the NERD tree window will close after opening a file with the
|
If set to 1, the NERD tree window will close after opening a file with the
|
||||||
|NERDTree-o| or |NERDTree-i| mappings.
|
|NERDTree-o|, |NERDTree-i|, |NERDTree-t| and |NERDTree-T| mappings.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'NERDTreeShowBookmarks'*
|
*'NERDTreeShowBookmarks'*
|
||||||
@@ -937,44 +933,167 @@ Default: 31.
|
|||||||
|
|
||||||
This option is used to change the size of the NERD tree when it is loaded.
|
This option is used to change the size of the NERD tree when it is loaded.
|
||||||
|
|
||||||
==============================================================================
|
------------------------------------------------------------------------------
|
||||||
4. Hacking the NERD tree *NERDTreeHacking*
|
*'NERDTreeMinimalUI'*
|
||||||
|
Values: 0 or 1
|
||||||
|
Default: 0
|
||||||
|
|
||||||
Public functions ~
|
This options disables the 'Bookmarks' label 'Press ? for help' text. Use one
|
||||||
|
of the following lines to set this option: >
|
||||||
The script provides 2 public functions for your hacking pleasure. Their
|
let NERDTreeMinimalUI=0
|
||||||
signatures are: >
|
let NERDTreeMinimalUI=1
|
||||||
function! NERDTreeGetCurrentNode()
|
|
||||||
function! NERDTreeGetCurrentPath()
|
|
||||||
<
|
<
|
||||||
The first returns the node object that the cursor is currently on, while the
|
|
||||||
second returns the corresponding path object.
|
|
||||||
|
|
||||||
This is probably a good time to mention that the script implements prototype
|
------------------------------------------------------------------------------
|
||||||
style OO. To see the functions that each class provides you can read look at
|
*'NERDTreeDirArrows'*
|
||||||
the code.
|
Values: 0 or 1
|
||||||
|
Default: 0.
|
||||||
|
|
||||||
Use the node objects to manipulate the structure of the tree. Use the path
|
This option is used to change the default look of directory nodes displayed in
|
||||||
objects to access the files/directories the tree nodes represent.
|
the tree. When set to 0 it shows old-school bars (|), + and ~ chars. If set to
|
||||||
|
1 it shows right and down arrows. Use one of the follow lines to set this
|
||||||
|
option: >
|
||||||
|
let NERDTreeDirArrows=0
|
||||||
|
let NERDTreeDirArrows=1
|
||||||
|
<
|
||||||
|
|
||||||
The NERD tree filetype ~
|
==============================================================================
|
||||||
|
4. The NERD tree API *NERDTreeAPI*
|
||||||
|
|
||||||
NERD tree buffers have a filetype of "nerdtree". You can use this to hack the
|
The NERD tree script allows you to add custom key mappings and menu items via
|
||||||
NERD tree via autocommands (on |FileType|) or via an ftplugin.
|
a set of API calls. Any scripts that use this API should be placed in
|
||||||
|
~/.vim/nerdtree_plugin/ (*nix) or ~/vimfiles/nerdtree_plugin (windows).
|
||||||
|
|
||||||
For example, putting this code in ~/.vim/ftplugin/nerdtree.vim would override
|
The script exposes some prototype objects that can be used to manipulate the
|
||||||
the o mapping, making it open the selected node in a new gvim instance. >
|
tree and/or get information from it: >
|
||||||
|
g:NERDTreePath
|
||||||
|
g:NERDTreeDirNode
|
||||||
|
g:NERDTreeFileNode
|
||||||
|
g:NERDTreeBookmark
|
||||||
|
<
|
||||||
|
See the code/comments in NERD_tree.vim to find how to use these objects. The
|
||||||
|
following code conventions are used:
|
||||||
|
* class members start with a capital letter
|
||||||
|
* instance members start with a lower case letter
|
||||||
|
* private members start with an underscore
|
||||||
|
|
||||||
nnoremap <silent> <buffer> o :call <sid>openInNewVimInstance()<cr>
|
See this blog post for more details:
|
||||||
function! s:openInNewVimInstance()
|
http://got-ravings.blogspot.com/2008/09/vim-pr0n-prototype-based-objects.html
|
||||||
let p = NERDTreeGetCurrentPath()
|
|
||||||
if p != {}
|
------------------------------------------------------------------------------
|
||||||
silent exec "!gvim " . p.strForOS(1) . "&"
|
4.1. Key map API *NERDTreeKeymapAPI*
|
||||||
|
|
||||||
|
NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()*
|
||||||
|
Adds a new keymapping for all NERD tree buffers.
|
||||||
|
{options} must be a dictionary, and must contain the following keys:
|
||||||
|
"key" - the trigger key for the new mapping
|
||||||
|
"callback" - the function the new mapping will be bound to
|
||||||
|
"quickhelpText" - the text that will appear in the quickhelp (see
|
||||||
|
|NERDTree-?|)
|
||||||
|
|
||||||
|
Example: >
|
||||||
|
call NERDTreeAddKeyMap({
|
||||||
|
\ 'key': 'b',
|
||||||
|
\ 'callback': 'NERDTreeEchoCurrentNode',
|
||||||
|
\ 'quickhelpText': 'echo full path of current node' })
|
||||||
|
|
||||||
|
function! NERDTreeEchoCurrentNode()
|
||||||
|
let n = g:NERDTreeFileNode.GetSelected()
|
||||||
|
if n != {}
|
||||||
|
echomsg 'Current node: ' . n.path.str()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
<
|
<
|
||||||
This way you can add new mappings or :commands or override any existing
|
This code should sit in a file like ~/.vim/nerdtree_plugin/mymapping.vim.
|
||||||
mapping.
|
It adds a (rather useless) mapping on 'b' which echos the full path to the
|
||||||
|
current node.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
4.2. Menu API *NERDTreeMenuAPI*
|
||||||
|
|
||||||
|
NERDTreeAddSubmenu({options}) *NERDTreeAddSubmenu()*
|
||||||
|
Creates and returns a new submenu.
|
||||||
|
|
||||||
|
{options} must be a dictionary and must contain the following keys:
|
||||||
|
"text" - the text of the submenu that the user will see
|
||||||
|
"shortcut" - a shortcut key for the submenu (need not be unique)
|
||||||
|
|
||||||
|
The following keys are optional:
|
||||||
|
"isActiveCallback" - a function that will be called to determine whether
|
||||||
|
this submenu item will be displayed or not. The callback function must return
|
||||||
|
0 or 1.
|
||||||
|
"parent" - the parent submenu of the new submenu (returned from a previous
|
||||||
|
invocation of NERDTreeAddSubmenu()). If this key is left out then the new
|
||||||
|
submenu will sit under the top level menu.
|
||||||
|
|
||||||
|
See below for an example.
|
||||||
|
|
||||||
|
NERDTreeAddMenuItem({options}) *NERDTreeAddMenuItem()*
|
||||||
|
Adds a new menu item to the NERD tree menu (see |NERDTreeMenu|).
|
||||||
|
|
||||||
|
{options} must be a dictionary and must contain the
|
||||||
|
following keys:
|
||||||
|
"text" - the text of the menu item which the user will see
|
||||||
|
"shortcut" - a shortcut key for the menu item (need not be unique)
|
||||||
|
"callback" - the function that will be called when the user activates the
|
||||||
|
menu item.
|
||||||
|
|
||||||
|
The following keys are optional:
|
||||||
|
"isActiveCallback" - a function that will be called to determine whether
|
||||||
|
this menu item will be displayed or not. The callback function must return
|
||||||
|
0 or 1.
|
||||||
|
"parent" - if the menu item belongs under a submenu then this key must be
|
||||||
|
specified. This value for this key will be the object that
|
||||||
|
was returned when the submenu was created with |NERDTreeAddSubmenu()|.
|
||||||
|
|
||||||
|
See below for an example.
|
||||||
|
|
||||||
|
NERDTreeAddMenuSeparator([{options}]) *NERDTreeAddMenuSeparator()*
|
||||||
|
Adds a menu separator (a row of dashes).
|
||||||
|
|
||||||
|
{options} is an optional dictionary that may contain the following keys:
|
||||||
|
"isActiveCallback" - see description in |NERDTreeAddMenuItem()|.
|
||||||
|
|
||||||
|
Below is an example of the menu API in action. >
|
||||||
|
call NERDTreeAddMenuSeparator()
|
||||||
|
|
||||||
|
call NERDTreeAddMenuItem({
|
||||||
|
\ 'text': 'a (t)op level menu item',
|
||||||
|
\ 'shortcut': 't',
|
||||||
|
\ 'callback': 'SomeFunction' })
|
||||||
|
|
||||||
|
let submenu = NERDTreeAddSubmenu({
|
||||||
|
\ 'text': 'a (s)ub menu',
|
||||||
|
\ 'shortcut': 's' })
|
||||||
|
|
||||||
|
call NERDTreeAddMenuItem({
|
||||||
|
\ 'text': '(n)ested item 1',
|
||||||
|
\ 'shortcut': 'n',
|
||||||
|
\ 'callback': 'SomeFunction',
|
||||||
|
\ 'parent': submenu })
|
||||||
|
|
||||||
|
call NERDTreeAddMenuItem({
|
||||||
|
\ 'text': '(n)ested item 2',
|
||||||
|
\ 'shortcut': 'n',
|
||||||
|
\ 'callback': 'SomeFunction',
|
||||||
|
\ 'parent': submenu })
|
||||||
|
<
|
||||||
|
This will create the following menu: >
|
||||||
|
--------------------
|
||||||
|
a (t)op level menu item
|
||||||
|
a (s)ub menu
|
||||||
|
<
|
||||||
|
Where selecting "a (s)ub menu" will lead to a second menu: >
|
||||||
|
(n)ested item 1
|
||||||
|
(n)ested item 2
|
||||||
|
<
|
||||||
|
When any of the 3 concrete menu items are selected the function "SomeFunction"
|
||||||
|
will be called.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
NERDTreeRender() *NERDTreeRender()*
|
||||||
|
Re-renders the NERD tree buffer. Useful if you change the state of the
|
||||||
|
tree and you want to it to be reflected in the UI.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
5. About *NERDTreeAbout*
|
5. About *NERDTreeAbout*
|
||||||
@@ -982,10 +1101,10 @@ mapping.
|
|||||||
The author of the NERD tree is a terrible terrible monster called Martyzilla
|
The author of the NERD tree is a terrible terrible monster called Martyzilla
|
||||||
who gobbles up small children with milk and sugar for breakfast.
|
who gobbles up small children with milk and sugar for breakfast.
|
||||||
|
|
||||||
He can be reached at martin_grenfell at msn.com. He would love to hear from
|
He can be reached at martin.grenfell at gmail dot com. He would love to hear
|
||||||
you, so feel free to send him suggestions and/or comments about this plugin.
|
from you, so feel free to send him suggestions and/or comments about this
|
||||||
Don't be shy --- the worst he can do is slaughter you and stuff you in the
|
plugin. Don't be shy --- the worst he can do is slaughter you and stuff you in
|
||||||
fridge for later ;)
|
the fridge for later ;)
|
||||||
|
|
||||||
The latest stable versions can be found at
|
The latest stable versions can be found at
|
||||||
http://www.vim.org/scripts/script.php?script_id=1658
|
http://www.vim.org/scripts/script.php?script_id=1658
|
||||||
@@ -997,6 +1116,56 @@ The latest dev versions are on github
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
6. Changelog *NERDTreeChangelog*
|
6. Changelog *NERDTreeChangelog*
|
||||||
|
|
||||||
|
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
|
3.1.1
|
||||||
- fix a bug where a non-listed no-name buffer was getting created every
|
- 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
|
time the tree windows was created, thanks to Derek Wyatt and owen1
|
||||||
@@ -1087,6 +1256,33 @@ just downloaded pr0n instead.
|
|||||||
Frederic Chanal (nach)
|
Frederic Chanal (nach)
|
||||||
Alf Mikula
|
Alf Mikula
|
||||||
Lucas S. Buchala
|
Lucas S. Buchala
|
||||||
|
Curtis Harvey
|
||||||
|
Guillaume Duranceau
|
||||||
|
Richard Hart (hates)
|
||||||
|
Doug McInnes
|
||||||
|
Stefan Ritter
|
||||||
|
Rémi Prévost
|
||||||
|
Victor Gonzalez
|
||||||
|
Stephan Baumeister
|
||||||
|
Ricky
|
||||||
|
jfilip1024
|
||||||
|
Chris Chambers
|
||||||
|
Vitaly Bogdanov
|
||||||
|
Patrick O'Loughlin (paddyoloughlin)
|
||||||
|
Cam Thompson (camthompson)
|
||||||
|
Marcin Kulik (sickill)
|
||||||
|
Steve DeWald (sdewald)
|
||||||
|
Ivan Necas (iNecas)
|
||||||
|
George Ang (gnap)
|
||||||
|
Evan Coury (EvanDotPro)
|
||||||
|
Andrew Radev (AndrewRadev)
|
||||||
|
Matt Gauger (mathias)
|
||||||
|
Scott Stevenson (scottstvnsn)
|
||||||
|
Anderson Freitas (andersonfreitas)
|
||||||
|
Kamil K. Lemański (kml)
|
||||||
|
Yehuda Katz (wycats)
|
||||||
|
Min-Young Wu (minyoung)
|
||||||
|
Benjamin Geiger (benjamingeiger)
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
8. License *NERDTreeLicense*
|
8. License *NERDTreeLicense*
|
||||||
|
|||||||
41
nerdtree_plugin/exec_menuitem.vim
Normal file
41
nerdtree_plugin/exec_menuitem.vim
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
" ============================================================================
|
||||||
|
" 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>
|
||||||
|
" Last Change: 22 July, 2009
|
||||||
|
" 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
|
||||||
224
nerdtree_plugin/fs_menu.vim
Normal file
224
nerdtree_plugin/fs_menu.vim
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
" ============================================================================
|
||||||
|
" 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>
|
||||||
|
" Last Change: 17 July, 2009
|
||||||
|
" 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
|
||||||
|
|
||||||
|
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")
|
||||||
|
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 g:NERDTreePath.CopyingSupported()
|
||||||
|
call NERDTreeAddMenuItem({'text': '(c)copy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'})
|
||||||
|
endif
|
||||||
|
|
||||||
|
"FUNCTION: s:echo(msg){{{1
|
||||||
|
function! s:echo(msg)
|
||||||
|
redraw
|
||||||
|
echomsg "NERDTree: " . a:msg
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
"FUNCTION: s:echoWarning(msg){{{1
|
||||||
|
function! s:echoWarning(msg)
|
||||||
|
echohl warningmsg
|
||||||
|
call s:echo(a:msg)
|
||||||
|
echohl normal
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
"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 nr2char(getchar()) ==# 'y'
|
||||||
|
exec "silent bdelete! " . 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 s:echo("Node Creation Aborted.")
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
try
|
||||||
|
let newPath = g:NERDTreePath.Create(newNodeName)
|
||||||
|
let parentNode = b:NERDTreeRoot.findNode(newPath.getParent())
|
||||||
|
|
||||||
|
let newTreeNode = g:NERDTreeFileNode.New(newPath)
|
||||||
|
if parentNode.isOpen || !empty(parentNode.children)
|
||||||
|
call parentNode.addChild(newTreeNode, 1)
|
||||||
|
call NERDTreeRender()
|
||||||
|
call newTreeNode.putCursorHere(1, 0)
|
||||||
|
endif
|
||||||
|
catch /^NERDTree/
|
||||||
|
call s: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 s:echo("Node Renaming Aborted.")
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
try
|
||||||
|
let bufnum = bufnr(curNode.path.str())
|
||||||
|
|
||||||
|
call curNode.rename(newNodePath)
|
||||||
|
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)" : "") .". Delete this buffer? (yN)"
|
||||||
|
call s:promptToDelBuffer(bufnum, prompt)
|
||||||
|
endif
|
||||||
|
|
||||||
|
call curNode.putCursorHere(1, 0)
|
||||||
|
|
||||||
|
redraw
|
||||||
|
catch /^NERDTree/
|
||||||
|
call s:echoWarning("Node Not Renamed.")
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: NERDTreeDeleteNode() {{{1
|
||||||
|
function! NERDTreeDeleteNode()
|
||||||
|
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||||
|
let confirmed = 0
|
||||||
|
|
||||||
|
if currentNode.path.isDirectory
|
||||||
|
let choice =input("Delete the current node\n" .
|
||||||
|
\ "==========================================================\n" .
|
||||||
|
\ "STOP! To delete this entire directory, 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 s:echoWarning("Could not remove node")
|
||||||
|
endtry
|
||||||
|
else
|
||||||
|
call s:echo("delete aborted")
|
||||||
|
endif
|
||||||
|
|
||||||
|
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 s: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 NERDTreeRender()
|
||||||
|
call newNode.putCursorHere(0, 0)
|
||||||
|
endif
|
||||||
|
catch /^NERDTree/
|
||||||
|
call s:echoWarning("Could not copy node")
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
call s:echo("Copy aborted.")
|
||||||
|
endif
|
||||||
|
redraw
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! NERDTreeQuickLook()
|
||||||
|
let treenode = g:NERDTreeFileNode.GetSelected()
|
||||||
|
if treenode != {}
|
||||||
|
call system("qlmanage -p 2>/dev/null '" . treenode.path.str() . "'")
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! NERDTreeRevealInFinder()
|
||||||
|
let treenode = g:NERDTreeFileNode.GetSelected()
|
||||||
|
if treenode != {}
|
||||||
|
let x = system("open -R '" . treenode.path.str() . "'")
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! NERDTreeExecuteFile()
|
||||||
|
let treenode = g:NERDTreeFileNode.GetSelected()
|
||||||
|
if treenode != {}
|
||||||
|
let x = system("open '" . treenode.path.str() . "'")
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" vim: set sw=4 sts=4 et fdm=marker:
|
||||||
1694
plugin/NERD_tree.vim
1694
plugin/NERD_tree.vim
File diff suppressed because it is too large
Load Diff
88
syntax/nerdtree.vim
Normal file
88
syntax/nerdtree.vim
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
let s:tree_up_dir_line = '.. (up a dir)'
|
||||||
|
"NERDTreeFlags are syntax items that should be invisible, but give clues as to
|
||||||
|
"how things should be highlighted
|
||||||
|
syn match NERDTreeFlag #\~#
|
||||||
|
syn match NERDTreeFlag #\[RO\]#
|
||||||
|
|
||||||
|
"highlighting for the .. (up dir) line at the top of the tree
|
||||||
|
execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
|
||||||
|
|
||||||
|
"highlighting for the ~/+ symbols for the directory nodes
|
||||||
|
syn match NERDTreeClosable #\~\<#
|
||||||
|
syn match NERDTreeClosable #\~\.#
|
||||||
|
syn match NERDTreeOpenable #+\<#
|
||||||
|
syn match NERDTreeOpenable #+\.#he=e-1
|
||||||
|
|
||||||
|
"highlighting for the tree structural parts
|
||||||
|
syn match NERDTreePart #|#
|
||||||
|
syn match NERDTreePart #`#
|
||||||
|
syn match NERDTreePartFile #[|`]-#hs=s+1 contains=NERDTreePart
|
||||||
|
|
||||||
|
"quickhelp syntax elements
|
||||||
|
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#hs=s+2,he=e-1
|
||||||
|
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#hs=s+2,he=e-1
|
||||||
|
syn match NERDTreeHelpTitle #" .*\~#hs=s+2,he=e-1 contains=NERDTreeFlag
|
||||||
|
syn match NERDTreeToggleOn #".*(on)#hs=e-2,he=e-1 contains=NERDTreeHelpKey
|
||||||
|
syn match NERDTreeToggleOff #".*(off)#hs=e-3,he=e-1 contains=NERDTreeHelpKey
|
||||||
|
syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3
|
||||||
|
syn match NERDTreeHelp #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeFlag,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand
|
||||||
|
|
||||||
|
"highlighting for readonly files
|
||||||
|
syn match NERDTreeRO #.*\[RO\]#hs=s+2 contains=NERDTreeFlag,NERDTreeBookmark,NERDTreePart,NERDTreePartFile
|
||||||
|
|
||||||
|
"highlighting for sym links
|
||||||
|
syn match NERDTreeLink #[^-| `].* -> # contains=NERDTreeBookmark,NERDTreeOpenable,NERDTreeClosable,NERDTreeDirSlash
|
||||||
|
|
||||||
|
"highlighing for directory nodes and file nodes
|
||||||
|
syn match NERDTreeDirSlash #/#
|
||||||
|
syn match NERDTreeDir #[^-| `].*/# contains=NERDTreeLink,NERDTreeDirSlash,NERDTreeOpenable,NERDTreeClosable
|
||||||
|
syn match NERDTreeExecFile #[|` ].*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark
|
||||||
|
syn match NERDTreeFile #|-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
|
||||||
|
syn match NERDTreeFile #`-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
|
||||||
|
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
|
||||||
|
|
||||||
|
if exists("g:NERDChristmasTree") && g:NERDChristmasTree
|
||||||
|
hi def link NERDTreePart Special
|
||||||
|
hi def link NERDTreePartFile Type
|
||||||
|
hi def link NERDTreeFile Normal
|
||||||
|
hi def link NERDTreeExecFile Title
|
||||||
|
hi def link NERDTreeDirSlash Identifier
|
||||||
|
hi def link NERDTreeClosable Type
|
||||||
|
else
|
||||||
|
hi def link NERDTreePart Normal
|
||||||
|
hi def link NERDTreePartFile Normal
|
||||||
|
hi def link NERDTreeFile Normal
|
||||||
|
hi def link NERDTreeClosable Title
|
||||||
|
endif
|
||||||
|
|
||||||
|
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 NERDTreeDir Directory
|
||||||
|
hi def link NERDTreeUp Directory
|
||||||
|
hi def link NERDTreeCWD Statement
|
||||||
|
hi def link NERDTreeLink Macro
|
||||||
|
hi def link NERDTreeOpenable Title
|
||||||
|
hi def link NERDTreeFlag ignore
|
||||||
|
hi def link NERDTreeRO WarningMsg
|
||||||
|
hi def link NERDTreeBookmark Statement
|
||||||
|
|
||||||
|
hi def link NERDTreeCurrentNode Search
|
||||||
Reference in New Issue
Block a user