mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 19:33:50 -05:00
Compare commits
137 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
e7ebee3084 | ||
|
|
1239f78baf | ||
|
|
5f4c005771 | ||
|
|
9e0a0b6a43 | ||
|
|
5c85d28285 | ||
|
|
f65bc62fac | ||
|
|
9b12953343 | ||
|
|
84f9793231 | ||
|
|
1f46ecf4b8 | ||
|
|
eef90bf320 | ||
|
|
3796a8799a | ||
|
|
c726655d23 | ||
|
|
bdfac3e25c | ||
|
|
faf1459ce5 | ||
|
|
02751f4d11 | ||
|
|
992c9f24eb | ||
|
|
8164fa09d3 | ||
|
|
5e50601788 | ||
|
|
23e79de2c2 | ||
|
|
4accc8a79c | ||
|
|
7522cbf4f0 | ||
|
|
3a25a594ca | ||
|
|
40374e5056 | ||
|
|
4e4fb179e7 | ||
|
|
0f2effb049 | ||
|
|
63ee15ca6e | ||
|
|
f8a105d972 | ||
|
|
f2707106bd | ||
|
|
1586cfdb03 | ||
|
|
ca8b1d2b34 | ||
|
|
100d8d2a47 | ||
|
|
efe03d6988 | ||
|
|
7b59186dfe | ||
|
|
e9f403ac44 | ||
|
|
2038f38026 | ||
|
|
6e9a5d4cea | ||
|
|
495e906169 | ||
|
|
2e6cedcad7 | ||
|
|
d76f936698 | ||
|
|
0e9feaede3 | ||
|
|
cd55e2d522 | ||
|
|
3d2bf2d9ac | ||
|
|
2f4d1b93e8 | ||
|
|
f06d99f7b5 | ||
|
|
1b13fb05ea | ||
|
|
f90da509e1 | ||
|
|
c8afb6d92d | ||
|
|
b0950d1593 | ||
|
|
9f569c61f9 | ||
|
|
7874b3c60e | ||
|
|
99afbe9ec8 | ||
|
|
78aa2fa1db | ||
|
|
111e309507 | ||
|
|
7a86663128 |
79
Rakefile
79
Rakefile
@@ -1,18 +1,75 @@
|
||||
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
|
||||
# written by travis jeffery <travisjeffery@gmail.com>
|
||||
# contributions by scrooloose <github:scrooloose>
|
||||
|
||||
require 'rake'
|
||||
require 'find'
|
||||
require 'pathname'
|
||||
|
||||
desc "Create a zip archive for release to vim.org"
|
||||
IGNORE = [/\.gitignore$/, /Rakefile$/]
|
||||
|
||||
files = `git ls-files`.split("\n")
|
||||
files.reject! { |f| IGNORE.any? { |re| f.match(re) } }
|
||||
|
||||
desc 'Zip up the project files'
|
||||
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"
|
||||
zip_name = File.basename(File.dirname(__FILE__))
|
||||
zip_name.gsub!(/ /, '_')
|
||||
zip_name = "#{zip_name}.zip"
|
||||
|
||||
if File.exist?(zip_name)
|
||||
abort("Zip file #{zip_name} already exists. Remove it first.")
|
||||
end
|
||||
|
||||
puts "Creating zip file: #{zip_name}"
|
||||
system("zip #{zip_name} #{files.join(" ")}")
|
||||
end
|
||||
|
||||
def run(cmd)
|
||||
puts "Executing: #{cmd}"
|
||||
system cmd
|
||||
desc 'Install plugin and documentation'
|
||||
task :install do
|
||||
vimfiles = if ENV['VIMFILES']
|
||||
ENV['VIMFILES']
|
||||
elsif RUBY_PLATFORM =~ /(win|w)32$/
|
||||
File.expand_path("~/vimfiles")
|
||||
else
|
||||
File.expand_path("~/.vim")
|
||||
end
|
||||
files.each do |file|
|
||||
target_file = File.join(vimfiles, file)
|
||||
FileUtils.mkdir_p File.dirname(target_file)
|
||||
FileUtils.cp file, target_file
|
||||
|
||||
puts "Installed #{file} to #{target_file}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
desc 'Pulls from origin'
|
||||
task :pull do
|
||||
puts "Updating local repo..."
|
||||
system("cd " << Dir.new(File.dirname(__FILE__)).path << " && git pull")
|
||||
end
|
||||
|
||||
desc 'Calls pull task and then install task'
|
||||
task :update => ['pull', 'install'] do
|
||||
puts "Update of vim script complete."
|
||||
end
|
||||
|
||||
desc 'Uninstall plugin and documentation'
|
||||
task :uninstall do
|
||||
vimfiles = if ENV['VIMFILES']
|
||||
ENV['VIMFILES']
|
||||
elsif RUBY_PLATFORM =~ /(win|w)32$/
|
||||
File.expand_path("~/vimfiles")
|
||||
else
|
||||
File.expand_path("~/.vim")
|
||||
end
|
||||
files.each do |file|
|
||||
target_file = File.join(vimfiles, file)
|
||||
FileUtils.rm target_file
|
||||
|
||||
puts "Uninstalled #{target_file}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
task :default => ['update']
|
||||
|
||||
@@ -21,22 +21,23 @@ CONTENTS *NERDTree-contents*
|
||||
|
||||
1.Intro...................................|NERDTree|
|
||||
2.Functionality provided..................|NERDTreeFunctionality|
|
||||
2.1 Global commands...................|NERDTreeGlobalCommands|
|
||||
2.2 Bookmarks.........................|NERDTreeBookmarks|
|
||||
2.2.1 The bookmark table..........|NERDTreeBookmarkTable|
|
||||
2.2.2 Bookmark commands...........|NERDTreeBookmarkCommands|
|
||||
2.2.3 Invalid bookmarks...........|NERDTreeInvalidBookmarks|
|
||||
2.3 NERD tree mappings................|NERDTreeMappings|
|
||||
2.4 The filesystem menu...............|NERDTreeFilesysMenu|
|
||||
2.1.Global commands...................|NERDTreeGlobalCommands|
|
||||
2.2.Bookmarks.........................|NERDTreeBookmarks|
|
||||
2.2.1.The bookmark table..........|NERDTreeBookmarkTable|
|
||||
2.2.2.Bookmark commands...........|NERDTreeBookmarkCommands|
|
||||
2.2.3.Invalid bookmarks...........|NERDTreeInvalidBookmarks|
|
||||
2.3.NERD tree mappings................|NERDTreeMappings|
|
||||
2.4.The NERD tree menu................|NERDTreeMenu|
|
||||
3.Options.................................|NERDTreeOptions|
|
||||
3.1 Option summary....................|NERDTreeOptionSummary|
|
||||
3.2 Option details....................|NERDTreeOptionDetails|
|
||||
4.Hacking the NERD tree...................|NERDTreeHacking|
|
||||
5.TODO list...............................|NERDTreeTodo|
|
||||
6.The Author..............................|NERDTreeAuthor|
|
||||
7.Changelog...............................|NERDTreeChangelog|
|
||||
8.Credits.................................|NERDTreeCredits|
|
||||
9.License.................................|NERDTreeLicense|
|
||||
3.1.Option summary....................|NERDTreeOptionSummary|
|
||||
3.2.Option details....................|NERDTreeOptionDetails|
|
||||
4.The NERD tree API.......................|NERDTreeAPI|
|
||||
4.1.Key map API.......................|NERDTreeKeymapAPI|
|
||||
4.2.Menu API..........................|NERDTreeMenuAPI|
|
||||
5.About...................................|NERDTreeAbout|
|
||||
6.Changelog...............................|NERDTreeChangelog|
|
||||
7.Credits.................................|NERDTreeCredits|
|
||||
8.License.................................|NERDTreeLicense|
|
||||
|
||||
==============================================================================
|
||||
1. Intro *NERDTree*
|
||||
@@ -69,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
|
||||
* optional displaying of hidden files (. files)
|
||||
* 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 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
|
||||
@@ -88,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
|
||||
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
|
||||
|
||||
|
||||
==============================================================================
|
||||
2. Functionality provided *NERDTreeFunctionality*
|
||||
@@ -203,13 +207,15 @@ go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
|
||||
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
|
||||
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
|
||||
i.......Open selected file in a split window.....................|NERDTree-i|
|
||||
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-i|
|
||||
!.......Execute the current file.................................|NERDTree-!|
|
||||
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
|
||||
s.......Open selected file in a new vsplit.......................|NERDTree-s|
|
||||
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|
|
||||
O.......Recursively open the selected directory..................|NERDTree-O|
|
||||
x.......Close the current nodes parent...........................|NERDTree-x|
|
||||
X.......Recursively close all children of the current node.......|NERDTree-X|
|
||||
e.......Edit the current dif.....................................|NERDTree-e|
|
||||
|
||||
<CR>...............same as |NERDTree-o|.
|
||||
double-click.......same as the |NERDTree-o| map.
|
||||
middle-click.......same as |NERDTree-i| for files, same as
|
||||
|NERDTree-e| for dirs.
|
||||
@@ -220,15 +226,15 @@ P.......Jump to the root node....................................|NERDTree-P|
|
||||
p.......Jump to current nodes parent.............................|NERDTree-p|
|
||||
K.......Jump up inside directories at the current tree depth.....|NERDTree-K|
|
||||
J.......Jump down inside directories at the current tree depth...|NERDTree-J|
|
||||
<C-j>...Jump down to the next sibling of the current directory...|NERDTree-c-j|
|
||||
<C-k>...Jump up to the previous sibling of the current directory.|NERDTree-c-k|
|
||||
<C-J>...Jump down to the next sibling of the current directory...|NERDTree-C-J|
|
||||
<C-K>...Jump up to the previous sibling of the current directory.|NERDTree-C-K|
|
||||
|
||||
C.......Change the tree root to the selected dir.................|NERDTree-C|
|
||||
u.......Move the tree root up one directory......................|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 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|
|
||||
|
||||
I.......Toggle whether hidden files displayed....................|NERDTree-I|
|
||||
@@ -237,6 +243,7 @@ F.......Toggle whether files are displayed.......................|NERDTree-F|
|
||||
B.......Toggle whether the bookmark table is displayed...........|NERDTree-B|
|
||||
|
||||
q.......Close the NERDTree window................................|NERDTree-q|
|
||||
A.......Zoom (maximize/minimize) the NERDTree window.............|NERDTree-A|
|
||||
?.......Toggle the display of the quick help.....................|NERDTree-?|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
@@ -310,12 +317,24 @@ The key combo for this mapping is always "g" + NERDTreeMapOpenSplit (see
|
||||
|NERDTree-i|).
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDTree-!*
|
||||
Default key: !
|
||||
Map option: NERDTreeMapExecute
|
||||
*NERDTree-s*
|
||||
Default key: s
|
||||
Map option: NERDTreeMapOpenVSplit
|
||||
Applies to: files.
|
||||
|
||||
Executes the selected file, prompting for arguments first.
|
||||
Opens the selected file in a new vertically split window and puts the cursor in
|
||||
the new window.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDTree-gs*
|
||||
Default key: gs
|
||||
Map option: None
|
||||
Applies to: files.
|
||||
|
||||
The same as |NERDTree-s| except that the cursor is not moved.
|
||||
|
||||
The key combo for this mapping is always "g" + NERDTreeMapOpenVSplit (see
|
||||
|NERDTree-s|).
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDTree-O*
|
||||
@@ -409,16 +428,16 @@ If the cursor is already on the last node then do the following:
|
||||
* go to the last child of that node
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDTree-c-j*
|
||||
Default key: <C-j>
|
||||
*NERDTree-C-J*
|
||||
Default key: <C-J>
|
||||
Map option: NERDTreeMapJumpNextSibling
|
||||
Applies to: files and directories.
|
||||
|
||||
Jump to the next sibling of the selected node.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDTree-c-k*
|
||||
Default key: <C-k>
|
||||
*NERDTree-C-K*
|
||||
Default key: <C-K>
|
||||
Map option: NERDTreeMapJumpPrevSibling
|
||||
Applies to: files and directories.
|
||||
|
||||
@@ -471,10 +490,18 @@ Recursively refresh the tree root.
|
||||
------------------------------------------------------------------------------
|
||||
*NERDTree-m*
|
||||
Default key: m
|
||||
Map option: NERDTreeMapFilesystemMenu
|
||||
Map option: NERDTreeMapMenu
|
||||
Applies to: files and directories.
|
||||
|
||||
Display the filesystem menu. See |NERDTreeFilesysMenu| for details.
|
||||
Display the NERD tree menu. See |NERDTreeMenu| for details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDTree-cd*
|
||||
Default key: cd
|
||||
Map option: NERDTreeMapChdir
|
||||
Applies to: files and directories.
|
||||
|
||||
Change vims current working directory to that of the selected node.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDTree-I*
|
||||
@@ -516,6 +543,14 @@ Applies to: no restrictions.
|
||||
|
||||
Closes the NERDtree window.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDTree-A*
|
||||
Default key: A
|
||||
Map option: NERDTreeMapToggleZoom
|
||||
Applies to: no restrictions.
|
||||
|
||||
Maximize (zoom) and minimize the NERDtree window.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDTree-?*
|
||||
Default key: ?
|
||||
@@ -525,44 +560,18 @@ Applies to: no restrictions.
|
||||
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
|
||||
operations quickly from the NERD tree rather than the console.
|
||||
The NERD tree has a menu that can be programmed via the an API (see
|
||||
|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
|
||||
operations: >
|
||||
1. Adding nodes.
|
||||
2. Move nodes.
|
||||
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.
|
||||
The script comes with two default menu plugins: exec_menuitem.vim and
|
||||
fs_menu.vim. fs_menu.vim adds some basic filesystem operations to the menu for
|
||||
creating/deleting/moving/copying files and dirs. exec_menuitem.vim provides a
|
||||
menu item to execute executable files.
|
||||
|
||||
2. Move nodes:
|
||||
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.
|
||||
Related tags: |NERDTree-m| |NERDTreeApi|
|
||||
|
||||
==============================================================================
|
||||
3. Customisation *NERDTreeOptions*
|
||||
@@ -620,6 +629,8 @@ NERD tree. These options should be set in your vimrc.
|
||||
|'NERDTreeSortOrder'| Tell the NERD tree how to sort the nodes in
|
||||
the tree.
|
||||
|
||||
|'NERDTreeStatusline'| Set a statusline for NERD tree windows.
|
||||
|
||||
|'NERDTreeWinPos'| Tells the script where to put the NERD tree
|
||||
window.
|
||||
|
||||
@@ -656,7 +667,7 @@ If set to 1, the NERD tree window will center around the cursor if it moves to
|
||||
within |'NERDTreeAutoCenterThreshold'| lines of the top/bottom of the window.
|
||||
|
||||
This is ONLY done in response to tree navigation mappings,
|
||||
i.e. |NERDTree-J| |NERDTree-K| |NERDTree-C-J| |NERDTree-c-K| |NERDTree-p|
|
||||
i.e. |NERDTree-J| |NERDTree-K| |NERDTree-C-J| |NERDTree-C-K| |NERDTree-p|
|
||||
|NERDTree-P|
|
||||
|
||||
The centering is done with a |zz| operation.
|
||||
@@ -719,7 +730,7 @@ Values: 0 or 1.
|
||||
Default: 1.
|
||||
|
||||
If set to 1, the current cursor line in the NERD tree buffer will be
|
||||
highlighted. This is done using the |cursorline| option.
|
||||
highlighted. This is done using the |'cursorline'| option.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeHijackNetrw'*
|
||||
@@ -872,6 +883,20 @@ Other examples: >
|
||||
3. Dirs will appear first, then ruby and php. Swap files, bak files and vim
|
||||
backup files will appear last with everything else preceding them.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeStatusline'*
|
||||
Values: Any valid statusline setting.
|
||||
Default: %{b:NERDTreeRoot.path.strForOS(0)}
|
||||
|
||||
Tells the script what to use as the |'statusline'| setting for NERD tree
|
||||
windows.
|
||||
|
||||
Note that the statusline is set using |:let-&| not |:set| so escaping spaces
|
||||
isn't necessary.
|
||||
|
||||
Setting this option to -1 will will deactivate it so that your global
|
||||
statusline setting is used instead.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeWinPos'*
|
||||
Values: "left" or "right"
|
||||
@@ -880,9 +905,9 @@ Default: "left".
|
||||
This option is used to determine where NERD tree window is placed on the
|
||||
screen.
|
||||
|
||||
This option is makes it possible to use two different explorer type
|
||||
plugins simultaneously. For example, you could have the taglist plugin on the
|
||||
left of the window and the NERD tree on the right.
|
||||
This option makes it possible to use two different explorer plugins
|
||||
simultaneously. For example, you could have the taglist plugin on the left of
|
||||
the window and the NERD tree on the right.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeWinSize'*
|
||||
@@ -892,62 +917,220 @@ Default: 31.
|
||||
This option is used to change the size of the NERD tree when it is loaded.
|
||||
|
||||
==============================================================================
|
||||
4. Hacking the NERD tree *NERDTreeHacking*
|
||||
4. The NERD tree API *NERDTreeAPI*
|
||||
|
||||
Public functions ~
|
||||
The NERD tree script allows you to add custom key mappings and menu items via
|
||||
a set of API calls. Any scripts that use this API should be placed in
|
||||
~/.vim/nerdtree_plugin/ (*nix) or ~/vimfiles/nerdtree_plugin (windows).
|
||||
|
||||
The script provides 2 public functions for your hacking pleasure. Their
|
||||
signatures are: >
|
||||
function! NERDTreeGetCurrentNode()
|
||||
function! NERDTreeGetCurrentPath()
|
||||
The script exposes some prototype objects that can be used to manipulate the
|
||||
tree and/or get information from it: >
|
||||
g:NERDTreePath
|
||||
g:NERDTreeDirNode
|
||||
g:NERDTreeFileNode
|
||||
g:NERDTreeBookmark
|
||||
<
|
||||
The first returns the node object that the cursor is currently on, while the
|
||||
second returns the corresponding path object.
|
||||
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
|
||||
|
||||
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
|
||||
the code.
|
||||
See this blog post for more details:
|
||||
http://got-ravings.blogspot.com/2008/09/vim-pr0n-prototype-based-objects.html
|
||||
|
||||
Use the node objects to manipulate the structure of the tree. Use the path
|
||||
objects to access the files/directories the tree nodes represent.
|
||||
------------------------------------------------------------------------------
|
||||
4.1. Key map API *NERDTreeKeymapAPI*
|
||||
|
||||
The NERD tree filetype ~
|
||||
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-?|)
|
||||
|
||||
NERD tree buffers have a filetype of "nerdtree". You can use this to hack the
|
||||
NERD tree via autocommands (on |FileType|) or via an ftplugin.
|
||||
Example: >
|
||||
call NERDTreeAddKeyMap({
|
||||
\ 'key': 'b',
|
||||
\ 'callback': 'NERDTreeEchoCurrentNode',
|
||||
\ 'quickhelpText': 'echo full path of current node' })
|
||||
|
||||
For example, putting this code in ~/.vim/ftplugin/nerdtree.vim would override
|
||||
the o mapping, making it open the selected node in a new gvim instance. >
|
||||
|
||||
nnoremap <silent> <buffer> o :call <sid>openInNewVimInstance()<cr>
|
||||
function! s:openInNewVimInstance()
|
||||
let p = NERDTreeGetCurrentPath()
|
||||
if p != {}
|
||||
silent exec "!gvim " . p.strForOS(1) . "&"
|
||||
endif
|
||||
endfunction
|
||||
function! NERDTreeEchoCurrentNode()
|
||||
let n = g:NERDTreeFileNode.GetSelected()
|
||||
if n != {}
|
||||
echomsg 'Current node: ' . n.path.str()
|
||||
endif
|
||||
endfunction
|
||||
<
|
||||
This way you can add new mappings or :commands or override any existing
|
||||
mapping.
|
||||
This code should sit in a file like ~/.vim/nerdtree_plugin/mymapping.vim.
|
||||
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. TODO list *NERDTreeTodo*
|
||||
|
||||
Window manager integration?
|
||||
|
||||
==============================================================================
|
||||
6. The Author *NERDTreeAuthor*
|
||||
5. About *NERDTreeAbout*
|
||||
|
||||
The author of the NERD tree is a terrible terrible monster called Martyzilla
|
||||
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
|
||||
you, so feel free to send him suggestions and/or comments about this plugin.
|
||||
Don't be shy --- the worst he can do is slaughter you and stuff you in the
|
||||
fridge for later ;)
|
||||
He can be reached at martin.grenfell at gmail dot com. He would love to hear
|
||||
from you, so feel free to send him suggestions and/or comments about this
|
||||
plugin. Don't be shy --- the worst he can do is slaughter you and stuff you in
|
||||
the fridge for later ;)
|
||||
|
||||
The latest stable versions can be found at
|
||||
http://www.vim.org/scripts/script.php?script_id=1658
|
||||
|
||||
The latest dev versions are on github
|
||||
http://github.com/scrooloose/nerdtree
|
||||
|
||||
|
||||
==============================================================================
|
||||
7. Changelog *NERDTreeChangelog*
|
||||
6. Changelog *NERDTreeChangelog*
|
||||
|
||||
4.0.0
|
||||
- add a new programmable menu system (see :help NERDTreeMenu).
|
||||
- add new APIs to add menus/menu-items to the menu system as well as
|
||||
custom key mappings to the NERD tree buffer (see :help NERDTreeAPI).
|
||||
- removed the old API functions
|
||||
- added a mapping to maximize/restore the size of nerd tree window, thanks
|
||||
to Guillaume Duranceau for the patch. See :help NERDTree-A for details.
|
||||
|
||||
- fix a bug where secondary nerd trees (netrw hijacked trees) and
|
||||
NERDTreeQuitOnOpen didnt play nicely, thanks to Curtis Harvey.
|
||||
- fix a bug where the script ignored directories whose name ended in a dot,
|
||||
thanks to Aggelos Orfanakos for the patch.
|
||||
- fix a bug when using the x mapping on the tree root, thanks to Bryan
|
||||
Venteicher for the patch.
|
||||
- fix a bug where the cursor position/window size of the nerd tree buffer
|
||||
wasnt being stored on closing the window, thanks to Richard Hart.
|
||||
- fix a bug where NERDTreeMirror would mirror the wrong tree
|
||||
|
||||
3.1.1
|
||||
- fix a bug where a non-listed no-name buffer was getting created every
|
||||
time the tree windows was created, thanks to Derek Wyatt and owen1
|
||||
- make <CR> behave the same as the 'o' mapping
|
||||
- some helptag fixes in the doc, thanks strull
|
||||
- fix a bug when using :set nohidden and opening a file where the previous
|
||||
buf was modified. Thanks iElectric
|
||||
- other minor fixes
|
||||
|
||||
3.1.0
|
||||
New features:
|
||||
- add mappings to open files in a vsplit, see :help NERDTree-s and :help
|
||||
NERDTree-gs
|
||||
- make the statusline for the nerd tree window default to something
|
||||
hopefully more useful. See :help 'NERDTreeStatusline'
|
||||
Bugfixes:
|
||||
- make the hijack netrw functionality work when vim is started with "vim
|
||||
<some dir>" (thanks to Alf Mikula for the patch).
|
||||
- fix a bug where the CWD wasnt being changed for some operations even when
|
||||
NERDTreeChDirMode==2 (thanks to Lucas S. Buchala)
|
||||
- add -bar to all the nerd tree :commands so they can chain with other
|
||||
:commands (thanks to tpope)
|
||||
- fix bugs when ignorecase was set (thanks to nach)
|
||||
- fix a bug with the relative path code (thanks to nach)
|
||||
- fix a bug where doing a :cd would cause :NERDTreeToggle to fail (thanks nach)
|
||||
|
||||
|
||||
3.0.1
|
||||
Bugfixes:
|
||||
- fix bugs with :NERDTreeToggle and :NERDTreeMirror when 'hidden
|
||||
was not set
|
||||
- fix a bug where :NERDTree <path> would fail if <path> was relative and
|
||||
didnt start with a ./ or ../ Thanks to James Kanze.
|
||||
- make the q mapping work with secondary (:e <dir> style) trees,
|
||||
thanks to jamessan
|
||||
- fix a bunch of small bugs with secondary trees
|
||||
|
||||
More insane refactoring.
|
||||
|
||||
3.0.0
|
||||
- hijack netrw so that doing an :edit <directory> will put a NERD tree in
|
||||
@@ -958,372 +1141,54 @@ fridge for later ;)
|
||||
- change the 'H' mapping to 'I'
|
||||
- lots of refactoring
|
||||
|
||||
2.14.3
|
||||
Thanks to tpope for the following:
|
||||
- use relative paths when doing edit commands if possible (useful if you
|
||||
have %f on your statusline for example)
|
||||
- allow relative paths for :NERDTree commands, eg ":NERDTree ../foo"
|
||||
- fix a bug where the script used the directory of the current buffer
|
||||
instead of vims cwd for the :NERDTree command
|
||||
- bugfix for read only node highlighting
|
||||
==============================================================================
|
||||
7. Credits *NERDTreeCredits*
|
||||
|
||||
2.14.2
|
||||
- when opening a file (with 'o' or double click) dont split the window
|
||||
unless we absolutely have to. This should make the script work better
|
||||
with other explorer plugins. Thanks to Ryan Penn, Simon Peter Nicholls
|
||||
and Michael
|
||||
- fix a bug where directories starting with a '+' char could not be opened.
|
||||
Thanks to Tomasz Chomiuk.
|
||||
- fix a bug where closing vim with :qa with a tree open in another tab
|
||||
would break, thanks to Denis Pokataev.
|
||||
- compatibility bugfix for older versions of vim, thanks to knekk for
|
||||
helping me track it down and to Sean Chou.
|
||||
|
||||
2.14.1
|
||||
- dont clobber &cpo. Thanks to godlygeek for the bug report.
|
||||
|
||||
2.14.0
|
||||
- fix a bug where the <c-w>o mapping would cause the tree window to be
|
||||
incorrectly sized when reopened.
|
||||
- add keymapping to delete bookmarks from the bookmarks table, see
|
||||
:help NERDTree-D
|
||||
- lots of refactoring
|
||||
2.13.0
|
||||
- make NERDTreeChDir option default to 0 (i.e. never change vims current
|
||||
working dir by default)
|
||||
- when moving/deleting nodes with the filesystem menu, move/delete any
|
||||
associated bookmarks
|
||||
- make the t/T on directory nodes open a fresh NERD tree for the selected
|
||||
dir in a new tab, rather than a netrw.
|
||||
- place the cursor at the top of the bookmarks table when opening it with B
|
||||
- make NERDTreeQuitOnOpen option work with the g<tab> and go mappings,
|
||||
thanks to Maxim Kim for the bug report
|
||||
- change how invalid bookmarks are handled. Now they are not deleted. If a
|
||||
bookmark is malformed (in the bookmarks file) or points to an
|
||||
invalid/nonexisting location then print an error and place the offending
|
||||
bookmarks at the bottom of the bookmarks file. See :help
|
||||
|NERDTreeInvalidBookmarks| for info. Thanks to Zhang Shuhan for the
|
||||
suggestion and the testing.
|
||||
- fix a bug with the 'o' mapping that occurred when opening a new buffer
|
||||
for a file whose name was a substring of an already open file. Thanks to
|
||||
Charlton Wang for the report.
|
||||
- stop the script from going into an infinite loop when it tries to cache
|
||||
a named pipe. Thanks to Charlton Wang for the report.
|
||||
|
||||
2.12.0
|
||||
- added a UI for bookmarks. See :help NERDTreeBookmarkTable for details.
|
||||
Thanks to Zhang Shuhan for testing and bug reports.
|
||||
- relaxed the restrictions on bookmark names, now the only restriction is
|
||||
that they cant contain spaces. This allows for e.g. Chinese bookmark
|
||||
names. Thanks to Zhang Shuhan for the suggestion.
|
||||
- combined the NERDTreeWinPos and NERDTreeSplitVertical options. See :help
|
||||
NERDTreeWinPos.
|
||||
- applied a patch from Matan Nassau to add the NERDTreeQuitOnOpen option
|
||||
which closes the tree window after opening a file. See :help
|
||||
NERDTreeQuitOnOpen.
|
||||
- optimised the nerd tree rendering. Now it takes just over 1/3 of the
|
||||
time it previously took to render.
|
||||
- now the tree filter mappings toggle the filters "per tree" rather than
|
||||
globally. The global filter variables are used to set the initial filter
|
||||
settings for each new NERD tree.
|
||||
- fix to window resizing when opening a file when NERD tree is the only
|
||||
window open
|
||||
- other fixes
|
||||
|
||||
2.11.0
|
||||
- changes to the 'o' mapping when opening files:
|
||||
- dont clobber "special" windows (eg taglist/quickfix/etc). This should
|
||||
make the NERD tree play nicer with other explorer plugins. Thanks to
|
||||
Yuan Jiang for the suggestion.
|
||||
- if the file is already open in the current tab, just move the cursor
|
||||
to that window
|
||||
- highlight executable files, made some slight changes to other
|
||||
highlighting
|
||||
- if the user resizes the tree window, keep that new size. Dont reset to
|
||||
the default during the <tab> mapping, or :NERDTreeToggle command. Only
|
||||
reset the size if a fresh tree is started with :NERDTree.
|
||||
- remove the "magic" functionality from the <c-j>/<c-k> mappings (it was
|
||||
more confusing than helpful)
|
||||
- other minor fixes
|
||||
|
||||
2.10.0
|
||||
- added bookmarks, see :help NERDTreeBookmarkCommands for details. Thanks
|
||||
to Piotr Czachur for all his testing and suggestions.
|
||||
- fixed screen jumping bug with when &scrolloff != 0
|
||||
- fixed some bugs with copying nodes
|
||||
- other random fixes
|
||||
- change license to wtfpl
|
||||
|
||||
2.9.0
|
||||
|
||||
- path handling improvements, thanks to Zhang Shuhan for heaps of
|
||||
testing/bug reports
|
||||
* improved how paths are stored, now the script will no longer get
|
||||
confused about drives on MF Windows
|
||||
* made the script way better at handling paths with strange characters
|
||||
in them (eg '$@; etc)
|
||||
- applied a patch from Cory Echols
|
||||
* add the command :NERDTreeClose to close the tree for the current tab
|
||||
* set the filetype for the NERD tree buffer to "nerdtree"
|
||||
|
||||
2.8.0
|
||||
- added an option to enable/disable line numbers in the NERD tree window,
|
||||
thanks to Olivier Yiptong for the email.
|
||||
|
||||
2.7.1
|
||||
- Changed the keys for the filesystem menu to be mnemonic rather than
|
||||
arbitrary integers
|
||||
- Documented the copying functionality in the filesystem menu
|
||||
|
||||
2.7.0
|
||||
- Bug fix: Now when you have the tree on the right and you open it with
|
||||
multiple windows stacked, it will take up the full height of the vim
|
||||
window.
|
||||
- Now line numbers always turned off in the tree by default
|
||||
- Implemented copying of nodes (via the filesystem menu) for *nix/macosx
|
||||
- took the help doc out of the script and repackaged the whole thing as a
|
||||
zip
|
||||
|
||||
2.6.2
|
||||
- Now when you try to open a file node into a window that is modified, the
|
||||
window is not split if the &hidden option is set. Thanks to Niels Aan
|
||||
de Brugh for this suggestion.
|
||||
|
||||
2.6.1
|
||||
- Fixed a major bug with the <tab> mapping. Thanks to Zhang Weiwu for
|
||||
emailing me.
|
||||
|
||||
2.6.0
|
||||
- Extended the behaviour of <c-j/k>. Now if the cursor is on a file node
|
||||
and you use <c-j/k> the cursor will jump to its PARENTS next/previous
|
||||
sibling. Go :help NERDTree-c-j and :help NERDTree-c-k for info.
|
||||
- Extended the behaviour of the J/K mappings. Now if the cursor is on the
|
||||
last child of a node and you push J/K it will jump down to the last
|
||||
child of the next/prev of its parents siblings that is open and has
|
||||
children. Go :help NERDTree-J and :help NERDTree-K for info.
|
||||
- The goal of these changes is to make tree navigation faster.
|
||||
- Reorganised the help page a bit.
|
||||
- Removed the E mapping.
|
||||
- bugfixes
|
||||
|
||||
2.5.0
|
||||
- Added an option to enforce case sensitivity when sorting tree nodes.
|
||||
Read :help NERDTreeCaseSensitiveSort for details. (thanks to Michael
|
||||
Madsen for emailing me about this). Case sensitivity defaults to off.
|
||||
- Made the script echo a "please wait" style message when opening large
|
||||
directories. Thanks to AOYAMA Shotaro for this suggestion.
|
||||
- Added 2 public functions that can be used to retrieve the treenode and
|
||||
path that the cursor is on. Read :help NERDTreePublicFunctions for
|
||||
details (thanks again to AOYAMA Shotaro for the idea :).
|
||||
- added 2 new mappings for file nodes: "g<tab>" and "go". These are the
|
||||
same as the "<tab>" and "o" maps except that the cursor stays in the
|
||||
NERDTree. Note: these maps are slaved to the o and <tab> mappings, so if
|
||||
eg you remap "<tab>" to "i" then the "g<tab>" map will also be changed
|
||||
to "gi".
|
||||
- Renamed many of the help tags to be simpler.
|
||||
- Simplified the ascii "graphics" for the filesystem menu
|
||||
- Fixed bugs.
|
||||
- Probably created bugs.
|
||||
- Refactoring.
|
||||
|
||||
2.4.0
|
||||
- Added the P mapping to jump to the tree root.
|
||||
- Added window centering functionality that can be triggered when doing
|
||||
using any of the tree nav mappings. Essentially, if the cursor comes
|
||||
within a certain distance of the top/bottom of the window then a zz is
|
||||
done in the window. Two related options were added: NERDTreeAutoCenter
|
||||
to turn this functionality on/off, and NERDTreeAutoCenterThreshold to
|
||||
control how close the cursor has to be to the window edge to trigger the
|
||||
centering.
|
||||
|
||||
2.3.0
|
||||
- Tree navigation changes:
|
||||
- Added J and K mappings to jump to last/first child of the current dir.
|
||||
Options to customise these mappings have also been added.
|
||||
- Remapped the jump to next/prev sibling commands to be <C-j> and <C-k>
|
||||
by default.
|
||||
These changes should hopefully make tree navigation mappings easier to
|
||||
remember and use as the j and k keys are simply reused 3 times (twice
|
||||
with modifier keys).
|
||||
|
||||
- Made it so that, when any of the tree filters are toggled, the cursor
|
||||
stays with the selected node (or goes to its parent/grandparent/... if
|
||||
that node is no longer visible)
|
||||
- Fixed an error in the doc for the mouse mode option.
|
||||
- Made the quickhelp correctly display the current single/double click
|
||||
mappings for opening nodes as specified by the NERDTreeMouseMode option.
|
||||
- Fixed a bug where the script was spazzing after prompting you to delete
|
||||
a modified buffer when using the filesystem menu.
|
||||
- Refactoring
|
||||
2.2.3
|
||||
- Refactored the :echo output from the script.
|
||||
- Fixed some minor typos in the doc.
|
||||
- Made some minor changes to the output of the 'Tree filtering mappings'
|
||||
part of the quickhelp
|
||||
|
||||
2.2.2
|
||||
- More bugfixes... doh.
|
||||
|
||||
2.2.1
|
||||
- Bug fix that was causing an exception when closing the nerd tree. Thanks
|
||||
to Tim carey-smith and Yu Jun for pointing this out.
|
||||
|
||||
2.2.0
|
||||
- Now 'cursorline' is set in the NERD tree buffer by default. See :help
|
||||
NERDTreeHighlightCursorline for how to disable it.
|
||||
|
||||
2.1.2
|
||||
- Stopped the script from clobbering the 1,2,3 .. 9 registers.
|
||||
- Made it "silent!"ly delete buffers when renaming/deleting file nodes.
|
||||
- Minor correction to the doc
|
||||
- Fixed a bug when refreshing that was occurring when the node you
|
||||
refreshed had been deleted externally.
|
||||
- Fixed a bug that was occurring when you open a file that is already open
|
||||
and modified.
|
||||
|
||||
2.1.1
|
||||
- Added a bit more info about the buffers you are prompted to delete when
|
||||
renaming/deleting nodes from the filesystem menu that are already loaded
|
||||
into buffers.
|
||||
- Refactoring and bugfixes
|
||||
|
||||
2.1.0
|
||||
- Finally removed the blank line that always appears at the top of the
|
||||
NERDTree buffer
|
||||
- Added NERDTreeMouseMode option. If set to 1, then a double click is
|
||||
required to activate all nodes, if set to 2 then a single click will
|
||||
activate directory nodes, if set to 3 then a single click will activate
|
||||
all nodes.
|
||||
- Now if you delete a file node and have it open in a buffer you are given
|
||||
the option to delete that buffer as well. Similarly if you rename a file
|
||||
you are given the option to delete any buffers containing the old file
|
||||
(if any exist)
|
||||
- When you rename or create a node, the cursor is now put on the new node,
|
||||
this makes it easy immediately edit the new file.
|
||||
- Fixed a bug with the ! mapping that was occurring on windows with paths
|
||||
containing spaces.
|
||||
- Made all the mappings customisable. See |NERD_tree-mappings| for
|
||||
details. A side effect is that a lot of the "double mappings" have
|
||||
disappeared. E.g 'o' is now the key that is used to activate a node,
|
||||
<CR> is no longer mapped to the same.
|
||||
- Made the script echo warnings in some places rather than standard echos
|
||||
- Insane amounts of refactoring all over the place.
|
||||
|
||||
2.0.0
|
||||
- Added two new NERDChristmasTree decorations. First person to spot them
|
||||
and email me gets a free copy of the NERDTree.
|
||||
- Made it so that when you jump around the tree (with the p, s and S
|
||||
mappings) it is counted as a jump by vim. This means if you, eg, push
|
||||
'p' one too many times then you can go `` or ctrl-o.
|
||||
- Added a new option called NERDTreeSortOrder which takes an array of
|
||||
regexs and is used to determine the order that the treenodes are listed
|
||||
in. Go :help NERDTreeSortOrder for details.
|
||||
- Removed the NERDTreeSortDirs option because it is consumed by
|
||||
NERDTreeSortOrder
|
||||
- Added the 'i' mapping which is the same as <tab> but requires less
|
||||
effort to reach.
|
||||
- Added the ! mapping which is used to execute file in the tree (after it
|
||||
prompts you for arguments etc)
|
||||
Thanks to the following people for testing, bug reports, ideas etc. Without
|
||||
you I probably would have got bored of the hacking the NERD tree and
|
||||
just downloaded pr0n instead.
|
||||
|
||||
Tim Carey-Smith (halorgium)
|
||||
Vigil
|
||||
Nick Brettell
|
||||
Thomas Scott Urban
|
||||
Terrance Cohen
|
||||
Yegappan Lakshmanan
|
||||
Jason Mills
|
||||
Michael Geddes (frogonwheels)
|
||||
Yu Jun
|
||||
Michael Madsen
|
||||
AOYAMA Shotaro
|
||||
Zhang Weiwu
|
||||
Niels Aan de Brugh
|
||||
Olivier Yiptong
|
||||
Zhang Shuhan
|
||||
Cory Echols
|
||||
Piotr Czachur
|
||||
Yuan Jiang
|
||||
Matan Nassau
|
||||
Maxim Kim
|
||||
Charlton Wang
|
||||
Matt Wozniski (godlygeek)
|
||||
knekk
|
||||
Sean Chou
|
||||
Ryan Penn
|
||||
Simon Peter Nicholls
|
||||
Michael Foobar
|
||||
Tomasz Chomiuk
|
||||
Denis Pokataev
|
||||
Tim Pope (tpope)
|
||||
James Kanze
|
||||
James Vega (jamessan)
|
||||
Frederic Chanal (nach)
|
||||
Alf Mikula
|
||||
Lucas S. Buchala
|
||||
Curtis Harvey
|
||||
Guillaume Duranceau
|
||||
Richard Hart (hates)
|
||||
|
||||
==============================================================================
|
||||
8. Credits *NERDTreeCredits*
|
||||
|
||||
Thanks to Tim Carey-Smith for testing/using the NERD tree from the first
|
||||
pre-beta version, for his many suggestions and for his constant stream of bug
|
||||
complaints.
|
||||
|
||||
Thanks to Vigil for trying it out before the first release :) and suggesting
|
||||
that mappings to open files in new tabs should be implemented.
|
||||
|
||||
Thanks to Nick Brettell for testing, fixing my spelling and suggesting i put a
|
||||
.. (up a directory)
|
||||
line in the gui.
|
||||
|
||||
Thanks to Thomas Scott Urban - the author of the vtreeexplorer plugin - whose
|
||||
gui code i borrowed from.
|
||||
|
||||
Thanks to Terrance Cohen for pointing out a bug where the script was changing
|
||||
vims CWD all over the show.
|
||||
|
||||
Thanks to Yegappan Lakshmanan (author of Taglist and other orgasmically
|
||||
wonderful plugins) for telling me how to fix a bug that was causing vim to go
|
||||
into visual mode everytime you double clicked a node :)
|
||||
|
||||
Thanks to Jason Mills for sending me a fix that allows windows paths to use
|
||||
forward slashes as well as backward.
|
||||
|
||||
Thanks to Michael Geddes (frogonwheels on #vim at freenode) for giving me some
|
||||
tips about syntax highlighting when i was doing highlighting for the
|
||||
quickhelp.
|
||||
|
||||
Thanks to Yu Jun for emailing me about a bug that was occurring when closing
|
||||
the tree.
|
||||
|
||||
Thanks to Michael Madsen for emailing me about making case sensitivity
|
||||
optional when sorting nodes.
|
||||
|
||||
Thanks to AOYAMA Shotaro for suggesting that i echo a "please wait" message
|
||||
when opening large directories.
|
||||
|
||||
Thanks to Michael Madsen for requesting the NERDTreeCaseSensitiveSort option.
|
||||
|
||||
Thanks to AOYAMA Shotaro for suggesting that a "please wait" style message be
|
||||
echoed when opening large directories. Also, thanks for the suggestion of
|
||||
having public functions in the script to access the internal data :D
|
||||
|
||||
Thanks to Zhang Weiwu for emailing me about a bug with the the <tab> mapping
|
||||
in 2.6.0
|
||||
|
||||
Thanks to Niels Aan de Brugh for the suggestion that the script now split the
|
||||
window if you try to open a file in a window containing a modified buffer when
|
||||
the &hidden option is set.
|
||||
|
||||
Thanks to Olivier Yiptong for prompting me to make line numbers in the
|
||||
NERD tree window optional.
|
||||
|
||||
Thanks to Zhang Shuhan for all of his emails and testing to help improve the
|
||||
NERD tree path handling. Thanks also for suggesting the bookmarks gui, and for
|
||||
testing and his many suggestions and bugreports about bookmarks.
|
||||
|
||||
Thanks to Cory Echols for sending a patch to add the :NERDTreeClose command and
|
||||
set the NERD tree buffers filetype to 'nerdtree'
|
||||
|
||||
Thanks to Piotr Czachur for all his suggestions and testing for the bookmarks
|
||||
feature.
|
||||
|
||||
Thanks to Yuan Jiang for suggesting the "o" mapping shouldnt clobber "special"
|
||||
windows, like taglist.
|
||||
|
||||
Thanks to Matan Nassau for the patch to add the NERDTreeQuitOnOpen option.
|
||||
|
||||
Thanks to Maxim Kim for reporting a bug with g<tab> and go mappings when
|
||||
NERDTreeQuitOnOpen was set.
|
||||
|
||||
Thanks to Charlton Wang for reporting bugs with the 'o' mapping and with
|
||||
handling named pipes.
|
||||
|
||||
Chur to godlygeek for reporting a bug where &cpo was getting clobbered.
|
||||
|
||||
Cheers to knekk for helping me track down a bug when overwriting dictionary
|
||||
keys that only occurred in some versions of vim.
|
||||
|
||||
Thanks also to Sean Chou for the bug report about the above bug.
|
||||
|
||||
Thanks to Ryan Penn, Simon Peter Nicholls and Michael for pointing out an issue
|
||||
where the script was splitting constantly when using the 'o' mapping while
|
||||
other explorers were open.
|
||||
|
||||
Thanks to Tomasz Chomiuk for the bug report about the script failing when dir
|
||||
names began with a +.
|
||||
|
||||
Thanks to Denis Pokataev for the bug report about the script failing when
|
||||
closing vim with :qa with a tree open in another tab.
|
||||
|
||||
Thanks to tpope for his dope bug reporting.
|
||||
|
||||
==============================================================================
|
||||
9. License *NERDTreeLicense*
|
||||
8. License *NERDTreeLicense*
|
||||
|
||||
The NERD tree is released under the wtfpl.
|
||||
See http://sam.zoy.org/wtfpl/COPYING.
|
||||
|
||||
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
|
||||
194
nerdtree_plugin/fs_menu.vim
Normal file
194
nerdtree_plugin/fs_menu.vim
Normal file
@@ -0,0 +1,194 @@
|
||||
" ============================================================================
|
||||
" 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 curent node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'})
|
||||
call NERDTreeAddMenuItem({'text': '(d)elete the curent node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})
|
||||
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({'format': 'Glob'}) . g:NERDTreePath.Slash())
|
||||
|
||||
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())
|
||||
|
||||
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())
|
||||
|
||||
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)
|
||||
call NERDTreeRender()
|
||||
call newNode.putCursorHere(0, 0)
|
||||
catch /^NERDTree/
|
||||
call s:echoWarning("Could not copy node")
|
||||
endtry
|
||||
endif
|
||||
else
|
||||
call s:echo("Copy aborted.")
|
||||
endif
|
||||
redraw
|
||||
endfunction
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
1976
plugin/NERD_tree.vim
1976
plugin/NERD_tree.vim
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user