mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-09 11:53:48 -05:00
Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6d2f12bf6 | ||
|
|
43ee096cee | ||
|
|
2b1eecebb2 | ||
|
|
c0d83f95a8 | ||
|
|
01ded5d150 | ||
|
|
5884cf3774 | ||
|
|
d15818bafa | ||
|
|
f74ec0661d | ||
|
|
d68dcd252e | ||
|
|
30bfb6e6b7 | ||
|
|
bfa5de8c55 | ||
|
|
6a665a588f | ||
|
|
55ff76171a | ||
|
|
a701bb71c4 | ||
|
|
6343639193 | ||
|
|
5ce5c62611 | ||
|
|
3ebff6ae54 | ||
|
|
d9a03f4600 | ||
|
|
59b132f0f7 | ||
|
|
d56bf992d2 | ||
|
|
efa7941c54 | ||
|
|
808850a464 | ||
|
|
24ad44b46f | ||
|
|
737ad58740 | ||
|
|
a856622f0c | ||
|
|
ce79c243a3 | ||
|
|
e1b369f34e | ||
|
|
0a73777381 | ||
|
|
176b551af0 |
@@ -33,6 +33,7 @@ CONTENTS *NERDTree-contents*
|
|||||||
6.The Author..............................|NERDTreeAuthor|
|
6.The Author..............................|NERDTreeAuthor|
|
||||||
7.Changelog...............................|NERDTreeChangelog|
|
7.Changelog...............................|NERDTreeChangelog|
|
||||||
8.Credits.................................|NERDTreeCredits|
|
8.Credits.................................|NERDTreeCredits|
|
||||||
|
9.License.................................|NERDTreeLicense|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
1. Intro *NERDTree*
|
1. Intro *NERDTree*
|
||||||
@@ -42,7 +43,7 @@ What is this "NERD tree"??
|
|||||||
The NERD tree allows you to explore your filesystem and to open files and
|
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
|
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
|
manipulate with the keyboard and/or mouse. It also allows you to perform
|
||||||
simple filesystem operations so you can alter the tree dynamically.
|
simple filesystem operations.
|
||||||
|
|
||||||
The following features and functionality are provided by the NERD tree:
|
The following features and functionality are provided by the NERD tree:
|
||||||
* Files and directories are displayed in a hierarchical tree structure
|
* Files and directories are displayed in a hierarchical tree structure
|
||||||
@@ -52,6 +53,7 @@ The following features and functionality are provided by the NERD tree:
|
|||||||
* sym-links
|
* sym-links
|
||||||
* windows .lnk files
|
* windows .lnk files
|
||||||
* read-only files
|
* read-only files
|
||||||
|
* executable files
|
||||||
* Many (customisable) mappings are provided to manipulate the tree:
|
* Many (customisable) mappings are provided to manipulate the tree:
|
||||||
* Mappings to open/close/explore directory nodes
|
* Mappings to open/close/explore directory nodes
|
||||||
* Mappings to open files in new/existing windows/tabs
|
* Mappings to open files in new/existing windows/tabs
|
||||||
@@ -65,7 +67,7 @@ The following features and functionality are provided by the NERD tree:
|
|||||||
* 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
|
* A textual filesystem menu is provided which allows you to
|
||||||
create/delete/rename file and directory nodes as well as copy (for
|
create/delete/move file and directory nodes as well as copy (for
|
||||||
supported OSs)
|
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.
|
||||||
@@ -265,9 +267,8 @@ Recursively opens the selelected directory.
|
|||||||
|
|
||||||
All files and directories are cached, but if a directory would not be
|
All files and directories are cached, but if a directory would not be
|
||||||
displayed due to file filters (see |NERDTreeIgnore| |NERDTree-f|) or the
|
displayed due to file filters (see |NERDTreeIgnore| |NERDTree-f|) or the
|
||||||
hidden file filter (see |NERDTreeShowHidden|) then it is not opened. This is
|
hidden file filter (see |NERDTreeShowHidden|) then its contents are not
|
||||||
handy, especially if you have .svn directories.
|
cached. This is handy, especially if you have .svn directories.
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTree-x*
|
*NERDTree-x*
|
||||||
@@ -343,8 +344,7 @@ Default key: <C-j>
|
|||||||
Map option: NERDTreeMapJumpNextSibling
|
Map option: NERDTreeMapJumpNextSibling
|
||||||
Applies to: files and directories.
|
Applies to: files and directories.
|
||||||
|
|
||||||
If a dir node is selected, jump to the next sibling of that node.
|
Jump to the next sibling of the selected node.
|
||||||
If a file node is selected, jump to the next sibling of that nodes parent.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTree-c-k*
|
*NERDTree-c-k*
|
||||||
@@ -352,8 +352,7 @@ Default key: <C-k>
|
|||||||
Map option: NERDTreeMapJumpPrevSibling
|
Map option: NERDTreeMapJumpPrevSibling
|
||||||
Applies to: files and directories.
|
Applies to: files and directories.
|
||||||
|
|
||||||
If a dir node is selected, jump to the previous sibling of that node.
|
Jump to the previous sibling of the selected node.
|
||||||
If a file node is selected, jump to the previous sibling of that nodes parent.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTree-C*
|
*NERDTree-C*
|
||||||
@@ -827,10 +826,7 @@ Window manager integration?
|
|||||||
6. The Author *NERDTreeAuthor*
|
6. The Author *NERDTreeAuthor*
|
||||||
|
|
||||||
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. He has an odd
|
who gobbles up small children with milk and sugar for breakfast.
|
||||||
love/hate relationship with computers (but monsters hate everything by nature
|
|
||||||
you know...) which can be awkward for him since he is a pro computer nerd for
|
|
||||||
a living.
|
|
||||||
|
|
||||||
He can be reached at martin_grenfell at msn.com. He would love to hear from
|
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.
|
you, so feel free to send him suggestions and/or comments about this plugin.
|
||||||
@@ -840,12 +836,29 @@ fridge for later ;)
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
7. Changelog *NERDTreeChangelog*
|
7. Changelog *NERDTreeChangelog*
|
||||||
|
|
||||||
|
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
|
2.10.0
|
||||||
- added bookmarks, see :help NERDTreeBookmarkCommands for details. Thanks
|
- added bookmarks, see :help NERDTreeBookmarkCommands for details. Thanks
|
||||||
to Piotr Czachur for all his testing and suggestions.
|
to Piotr Czachur for all his testing and suggestions.
|
||||||
- fixed screen jumping bug with when &scrolloff != 0
|
- fixed screen jumping bug with when &scrolloff != 0
|
||||||
- fixed some bugs with copying nodes
|
- fixed some bugs with copying nodes
|
||||||
- other random fixes
|
- other random fixes
|
||||||
|
- change license to wtfpl
|
||||||
|
|
||||||
2.9.0
|
2.9.0
|
||||||
|
|
||||||
@@ -1083,3 +1096,12 @@ set the NERD tree buffers filetype to 'nerdtree'
|
|||||||
|
|
||||||
Thanks to Piotr Czachur for all his suggestions and testing for the bookmarks
|
Thanks to Piotr Czachur for all his suggestions and testing for the bookmarks
|
||||||
feature.
|
feature.
|
||||||
|
|
||||||
|
Thanks to Yuan Jiang for suggesting the "o" mapping shouldnt clobber "special"
|
||||||
|
windows, like taglist.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
9. License *NERDTreeLicense*
|
||||||
|
|
||||||
|
The NERD tree is released under the wtfpl.
|
||||||
|
See http://sam.zoy.org/wtfpl/COPYING.
|
||||||
|
|||||||
@@ -1,7 +1,16 @@
|
|||||||
" vim global plugin that provides a nice tree explorer
|
" ============================================================================
|
||||||
" Last Change: 17 May 2008
|
" File: NERD_tree.vim
|
||||||
|
" Description: vim global plugin that provides a nice tree explorer
|
||||||
" Maintainer: Martin Grenfell <martin_grenfell at msn dot com>
|
" Maintainer: Martin Grenfell <martin_grenfell at msn dot com>
|
||||||
let s:NERD_tree_version = '2.10.0rc1'
|
" Last Change: 23 June, 2008
|
||||||
|
" 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.
|
||||||
|
"
|
||||||
|
" ============================================================================
|
||||||
|
let s:NERD_tree_version = '2.11.0'
|
||||||
|
|
||||||
" SECTION: Script init stuff {{{1
|
" SECTION: Script init stuff {{{1
|
||||||
"============================================================
|
"============================================================
|
||||||
@@ -114,20 +123,10 @@ call s:InitVariable("g:NERDTreeMapUpdirKeepOpen", "U")
|
|||||||
let s:escape_chars = " \\`\|\"#%&,?()\*^<>"
|
let s:escape_chars = " \\`\|\"#%&,?()\*^<>"
|
||||||
let s:NERDTreeWinName = '_NERD_tree_'
|
let s:NERDTreeWinName = '_NERD_tree_'
|
||||||
|
|
||||||
"init all the nerd tree markup
|
|
||||||
let s:tree_vert = '|'
|
|
||||||
let s:tree_vert_last = '`'
|
|
||||||
let s:tree_wid = 2
|
let s:tree_wid = 2
|
||||||
let s:tree_wid_str = ' '
|
|
||||||
let s:tree_wid_strM1 = ' '
|
|
||||||
let s:tree_dir_open = '~'
|
|
||||||
let s:tree_dir_closed = '+'
|
|
||||||
let s:tree_file = '-'
|
|
||||||
let s:tree_markup_reg = '[ \-+~`|]'
|
let s:tree_markup_reg = '[ \-+~`|]'
|
||||||
let s:tree_markup_reg_neg = '[^ \-+~`|]'
|
let s:tree_markup_reg_neg = '[^ \-+~`|]'
|
||||||
let s:tree_up_dir_line = '.. (up a dir)'
|
let s:tree_up_dir_line = '.. (up a dir)'
|
||||||
let s:tree_RO_str = ' [RO]'
|
|
||||||
let s:tree_RO_str_reg = ' \[RO\]'
|
|
||||||
|
|
||||||
let s:os_slash = '/'
|
let s:os_slash = '/'
|
||||||
if s:running_windows
|
if s:running_windows
|
||||||
@@ -1001,7 +1000,7 @@ function! s:oPath.Delete() dict
|
|||||||
throw "NERDTree.Path.Deletion Exception: Could not delete directory: '" . self.StrForOS(0) . "'"
|
throw "NERDTree.Path.Deletion Exception: Could not delete directory: '" . self.StrForOS(0) . "'"
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let success = delete(self.StrForOS(!s:running_windows))
|
let success = delete(self.StrForOS(0))
|
||||||
if success != 0
|
if success != 0
|
||||||
throw "NERDTree.Path.Deletion Exception: Could not delete file: '" . self.Str(0) . "'"
|
throw "NERDTree.Path.Deletion Exception: Could not delete file: '" . self.Str(0) . "'"
|
||||||
endif
|
endif
|
||||||
@@ -1160,6 +1159,11 @@ function! s:oPath.ReadInfoFromDisk(fullpath) dict
|
|||||||
throw "NERDTree.Path.InvalidArguments Exception: Invalid path = " . a:fullpath
|
throw "NERDTree.Path.InvalidArguments Exception: Invalid path = " . a:fullpath
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let self.isExecutable = 0
|
||||||
|
if !self.isDirectory
|
||||||
|
let self.isExecutable = getfperm(a:fullpath) =~ 'x'
|
||||||
|
endif
|
||||||
|
|
||||||
"grab the last part of the path (minus the trailing slash)
|
"grab the last part of the path (minus the trailing slash)
|
||||||
let lastPathComponent = self.GetLastPathComponent(0)
|
let lastPathComponent = self.GetLastPathComponent(0)
|
||||||
|
|
||||||
@@ -1198,7 +1202,7 @@ function! s:oPath.Rename(newPath) dict
|
|||||||
throw "NERDTree.Path.InvalidArguments exception. Invalid newPath for renaming = ". a:newPath
|
throw "NERDTree.Path.InvalidArguments exception. Invalid newPath for renaming = ". a:newPath
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let success = rename(self.StrForOS(!s:running_windows), a:newPath)
|
let success = rename(self.StrForOS(0), a:newPath)
|
||||||
if success != 0
|
if success != 0
|
||||||
throw "NERDTree.Path.Rename Exception: Could not rename: '" . self.StrForOS(0) . "'" . 'to:' . a:newPath
|
throw "NERDTree.Path.Rename Exception: Could not rename: '" . self.StrForOS(0) . "'" . 'to:' . a:newPath
|
||||||
endif
|
endif
|
||||||
@@ -1256,6 +1260,10 @@ endfunction
|
|||||||
function! s:oPath.StrDisplay() dict
|
function! s:oPath.StrDisplay() dict
|
||||||
let toReturn = self.GetLastPathComponent(1)
|
let toReturn = self.GetLastPathComponent(1)
|
||||||
|
|
||||||
|
if self.isExecutable
|
||||||
|
let toReturn = toReturn . '*'
|
||||||
|
endif
|
||||||
|
|
||||||
let bookmarks = self.BookmarkNames()
|
let bookmarks = self.BookmarkNames()
|
||||||
if !empty(bookmarks)
|
if !empty(bookmarks)
|
||||||
let toReturn .= ' {' . join(bookmarks, ',') . '}'
|
let toReturn .= ' {' . join(bookmarks, ',') . '}'
|
||||||
@@ -1266,7 +1274,7 @@ function! s:oPath.StrDisplay() dict
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if self.isReadOnly
|
if self.isReadOnly
|
||||||
let toReturn .= s:tree_RO_str
|
let toReturn .= ' [RO]'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return toReturn
|
return toReturn
|
||||||
@@ -1341,7 +1349,7 @@ function! s:oPath.UncacheBookmark(name) dict
|
|||||||
let bookmarks = self.BookmarkNames()
|
let bookmarks = self.BookmarkNames()
|
||||||
let i = index(bookmarks, a:name)
|
let i = index(bookmarks, a:name)
|
||||||
if i != -1
|
if i != -1
|
||||||
echo remove(bookmarks, i)
|
call remove(bookmarks, i)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
"FUNCTION: oPath.WinToUnixPath(pathstr){{{3
|
"FUNCTION: oPath.WinToUnixPath(pathstr){{{3
|
||||||
@@ -1500,11 +1508,21 @@ function! s:ReadBookmarks()
|
|||||||
if filereadable(g:NERDTreeBookmarksFile)
|
if filereadable(g:NERDTreeBookmarksFile)
|
||||||
let bookmarks = s:GetBookmarks()
|
let bookmarks = s:GetBookmarks()
|
||||||
let bookmarkStrings = readfile(g:NERDTreeBookmarksFile)
|
let bookmarkStrings = readfile(g:NERDTreeBookmarksFile)
|
||||||
|
let invalidBookmarksFound = 0
|
||||||
for i in bookmarkStrings
|
for i in bookmarkStrings
|
||||||
let key = substitute(i, '^\(\w.\{-}\) .*$', '\1', '')
|
let key = substitute(i, '^\(\w\{-}\) .*$', '\1', '')
|
||||||
let path = substitute(i, '^\w.\{-} \(.*\)$', '\1', '')
|
let path = substitute(i, '^\w\{-} \(.*\)$', '\1', '')
|
||||||
|
|
||||||
|
try
|
||||||
let bookmarks[key] = s:oPath.New(path)
|
let bookmarks[key] = s:oPath.New(path)
|
||||||
|
catch /NERDTree.Path.InvalidArguments/
|
||||||
|
let invalidBookmarksFound += 1
|
||||||
|
endtry
|
||||||
endfor
|
endfor
|
||||||
|
if invalidBookmarksFound
|
||||||
|
call s:Echo(invalidBookmarksFound . " invalid bookmarks were read and discarded")
|
||||||
|
call s:WriteBookmarks()
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
" Function: s:TreeExistsForTab() {{{2
|
" Function: s:TreeExistsForTab() {{{2
|
||||||
@@ -1668,9 +1686,9 @@ function! s:DrawTree(curNode, depth, drawText, vertMap, isLastChild)
|
|||||||
if a:depth > 1
|
if a:depth > 1
|
||||||
for j in a:vertMap[0:-2]
|
for j in a:vertMap[0:-2]
|
||||||
if j == 1
|
if j == 1
|
||||||
let treeParts = treeParts . s:tree_vert . s:tree_wid_strM1
|
let treeParts = treeParts . '| '
|
||||||
else
|
else
|
||||||
let treeParts = treeParts . s:tree_wid_str
|
let treeParts = treeParts . ' '
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
@@ -1678,9 +1696,9 @@ function! s:DrawTree(curNode, depth, drawText, vertMap, isLastChild)
|
|||||||
"get the last vertical tree part for this line which will be different
|
"get the last vertical tree part for this line which will be different
|
||||||
"if this node is the last child of its parent
|
"if this node is the last child of its parent
|
||||||
if a:isLastChild
|
if a:isLastChild
|
||||||
let treeParts = treeParts . s:tree_vert_last
|
let treeParts = treeParts . '`'
|
||||||
else
|
else
|
||||||
let treeParts = treeParts . s:tree_vert
|
let treeParts = treeParts . '|'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@@ -1688,12 +1706,12 @@ function! s:DrawTree(curNode, depth, drawText, vertMap, isLastChild)
|
|||||||
"name itself
|
"name itself
|
||||||
if a:curNode.path.isDirectory
|
if a:curNode.path.isDirectory
|
||||||
if a:curNode.isOpen
|
if a:curNode.isOpen
|
||||||
let treeParts = treeParts . s:tree_dir_open
|
let treeParts = treeParts . '~'
|
||||||
else
|
else
|
||||||
let treeParts = treeParts . s:tree_dir_closed
|
let treeParts = treeParts . '+'
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let treeParts = treeParts . s:tree_file
|
let treeParts = treeParts . '-'
|
||||||
endif
|
endif
|
||||||
let line = treeParts . a:curNode.StrDisplay()
|
let line = treeParts . a:curNode.StrDisplay()
|
||||||
|
|
||||||
@@ -1732,7 +1750,7 @@ function! s:DumpHelp()
|
|||||||
let @h=@h."\" File node mappings~\n"
|
let @h=@h."\" File node mappings~\n"
|
||||||
let @h=@h."\" ". (g:NERDTreeMouseMode == 3 ? "single" : "double") ."-click,\n"
|
let @h=@h."\" ". (g:NERDTreeMouseMode == 3 ? "single" : "double") ."-click,\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapActivateNode .": open in prev window\n"
|
let @h=@h."\" ". g:NERDTreeMapActivateNode .": open in prev window\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapPreview .": preview \n"
|
let @h=@h."\" ". g:NERDTreeMapPreview .": preview\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"
|
let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
let @h=@h."\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
||||||
let @h=@h."\" middle-click,\n"
|
let @h=@h."\" middle-click,\n"
|
||||||
@@ -1740,7 +1758,7 @@ function! s:DumpHelp()
|
|||||||
let @h=@h."\" ". g:NERDTreeMapPreviewSplit .": preview split\n"
|
let @h=@h."\" ". g:NERDTreeMapPreviewSplit .": preview split\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapExecute.": Execute file\n"
|
let @h=@h."\" ". g:NERDTreeMapExecute.": Execute file\n"
|
||||||
|
|
||||||
let @h=@h."\" \n\" ----------------------------\n"
|
let @h=@h."\"\n\" ----------------------------\n"
|
||||||
let @h=@h."\" Directory node mappings~\n"
|
let @h=@h."\" Directory node mappings~\n"
|
||||||
let @h=@h."\" ". (g:NERDTreeMouseMode == 1 ? "double" : "single") ."-click,\n"
|
let @h=@h."\" ". (g:NERDTreeMouseMode == 1 ? "double" : "single") ."-click,\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapActivateNode .": open & close node\n"
|
let @h=@h."\" ". g:NERDTreeMapActivateNode .": open & close node\n"
|
||||||
@@ -1750,9 +1768,9 @@ function! s:DumpHelp()
|
|||||||
let @h=@h."\" current node recursively\n"
|
let @h=@h."\" current node recursively\n"
|
||||||
let @h=@h."\" middle-click,\n"
|
let @h=@h."\" middle-click,\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapOpenExpl.": Open netrw for selected\n"
|
let @h=@h."\" ". g:NERDTreeMapOpenExpl.": Open netrw for selected\n"
|
||||||
let @h=@h."\" node \n"
|
let @h=@h."\" node\n"
|
||||||
|
|
||||||
let @h=@h."\" \n\" ----------------------------\n"
|
let @h=@h."\"\n\" ----------------------------\n"
|
||||||
let @h=@h."\" Tree navigation mappings~\n"
|
let @h=@h."\" Tree navigation mappings~\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapJumpRoot .": go to root\n"
|
let @h=@h."\" ". g:NERDTreeMapJumpRoot .": go to root\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapJumpParent .": go to parent\n"
|
let @h=@h."\" ". g:NERDTreeMapJumpParent .": go to parent\n"
|
||||||
@@ -1761,7 +1779,7 @@ function! s:DumpHelp()
|
|||||||
let @h=@h."\" ". g:NERDTreeMapJumpNextSibling .": go to next sibling\n"
|
let @h=@h."\" ". g:NERDTreeMapJumpNextSibling .": go to next sibling\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapJumpPrevSibling .": go to prev sibling\n"
|
let @h=@h."\" ". g:NERDTreeMapJumpPrevSibling .": go to prev sibling\n"
|
||||||
|
|
||||||
let @h=@h."\" \n\" ----------------------------\n"
|
let @h=@h."\"\n\" ----------------------------\n"
|
||||||
let @h=@h."\" Filesystem mappings~\n"
|
let @h=@h."\" Filesystem mappings~\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapChangeRoot .": change tree root to the\n"
|
let @h=@h."\" ". g:NERDTreeMapChangeRoot .": change tree root to the\n"
|
||||||
let @h=@h."\" selected dir\n"
|
let @h=@h."\" selected dir\n"
|
||||||
@@ -1774,17 +1792,17 @@ function! s:DumpHelp()
|
|||||||
let @h=@h."\" ". g:NERDTreeMapChdir .":change the CWD to the\n"
|
let @h=@h."\" ". g:NERDTreeMapChdir .":change the CWD to the\n"
|
||||||
let @h=@h."\" selected dir\n"
|
let @h=@h."\" selected dir\n"
|
||||||
|
|
||||||
let @h=@h."\" \n\" ----------------------------\n"
|
let @h=@h."\"\n\" ----------------------------\n"
|
||||||
let @h=@h."\" Tree filtering mappings~\n"
|
let @h=@h."\" Tree filtering mappings~\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapToggleHidden .": hidden files (" . (g:NERDTreeShowHidden ? "on" : "off") . ")\n"
|
let @h=@h."\" ". g:NERDTreeMapToggleHidden .": hidden files (" . (g:NERDTreeShowHidden ? "on" : "off") . ")\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapToggleFilters .": file filters (" . (t:NERDTreeIgnoreEnabled ? "on" : "off") . ")\n"
|
let @h=@h."\" ". g:NERDTreeMapToggleFilters .": file filters (" . (t:NERDTreeIgnoreEnabled ? "on" : "off") . ")\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapToggleFiles .": files (" . (g:NERDTreeShowFiles ? "on" : "off") . ")\n"
|
let @h=@h."\" ". g:NERDTreeMapToggleFiles .": files (" . (g:NERDTreeShowFiles ? "on" : "off") . ")\n"
|
||||||
|
|
||||||
let @h=@h."\" \n\" ----------------------------\n"
|
let @h=@h."\"\n\" ----------------------------\n"
|
||||||
let @h=@h."\" Other mappings~\n"
|
let @h=@h."\" Other mappings~\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapQuit .": Close the NERDTree window\n"
|
let @h=@h."\" ". g:NERDTreeMapQuit .": Close the NERDTree window\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapHelp .": toggle help\n"
|
let @h=@h."\" ". g:NERDTreeMapHelp .": toggle help\n"
|
||||||
let @h=@h."\" \n\" ----------------------------\n"
|
let @h=@h."\"\n\" ----------------------------\n"
|
||||||
let @h=@h."\" Bookmark commands~\n"
|
let @h=@h."\" Bookmark commands~\n"
|
||||||
let @h=@h."\" :Bookmark <name>\n"
|
let @h=@h."\" :Bookmark <name>\n"
|
||||||
let @h=@h."\" :BookmarkToRoot <name>\n"
|
let @h=@h."\" :BookmarkToRoot <name>\n"
|
||||||
@@ -1807,7 +1825,7 @@ endfunction
|
|||||||
"msg: the message to echo
|
"msg: the message to echo
|
||||||
function! s:Echo(msg)
|
function! s:Echo(msg)
|
||||||
redraw
|
redraw
|
||||||
echo "NERDTree: " . a:msg
|
echomsg "NERDTree: " . a:msg
|
||||||
endfunction
|
endfunction
|
||||||
"FUNCTION: s:EchoWarning {{{2
|
"FUNCTION: s:EchoWarning {{{2
|
||||||
"Wrapper for s:Echo, sets the message type to warningmsg for this message
|
"Wrapper for s:Echo, sets the message type to warningmsg for this message
|
||||||
@@ -1931,7 +1949,6 @@ function! s:GetPath(ln)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
"get the indent level for the file (i.e. how deep in the tree it is)
|
"get the indent level for the file (i.e. how deep in the tree it is)
|
||||||
"let indent = match(line,'[^-| `]') / s:tree_wid
|
|
||||||
let indent = match(line, s:tree_markup_reg_neg) / s:tree_wid
|
let indent = match(line, s:tree_markup_reg_neg) / s:tree_wid
|
||||||
|
|
||||||
|
|
||||||
@@ -2085,12 +2102,17 @@ endfunction
|
|||||||
function! s:OpenFileNode(treenode)
|
function! s:OpenFileNode(treenode)
|
||||||
call s:PutCursorInTreeWin()
|
call s:PutCursorInTreeWin()
|
||||||
|
|
||||||
if s:ShouldSplitToOpen(winnr("#"))
|
"if the file is already open in this tab then just stick the cursor in it
|
||||||
|
let winnr = bufwinnr(a:treenode.path.StrForOS(0))
|
||||||
|
if winnr != -1
|
||||||
|
exec winnr . "wincmd w"
|
||||||
|
|
||||||
|
elseif s:ShouldSplitToOpen(winnr("#"))
|
||||||
call s:OpenFileNodeSplit(a:treenode)
|
call s:OpenFileNodeSplit(a:treenode)
|
||||||
else
|
else
|
||||||
try
|
try
|
||||||
wincmd p
|
wincmd p
|
||||||
silent exec ("edit " . a:treenode.path.StrForEditCmd())
|
exec ("edit " . a:treenode.path.StrForEditCmd())
|
||||||
catch /^Vim\%((\a\+)\)\=:E37/
|
catch /^Vim\%((\a\+)\)\=:E37/
|
||||||
call s:PutCursorInTreeWin()
|
call s:PutCursorInTreeWin()
|
||||||
call s:Echo("Cannot open file, it is already open and modified")
|
call s:Echo("Cannot open file, it is already open and modified")
|
||||||
@@ -2182,18 +2204,9 @@ function! s:OpenNodeSplit(treenode)
|
|||||||
call s:PutCursorInTreeWin()
|
call s:PutCursorInTreeWin()
|
||||||
throw "NERDTree.view.FileOpen exception: ". a:treenode.path.Str(0) ." is already open and modified."
|
throw "NERDTree.view.FileOpen exception: ". a:treenode.path.Str(0) ." is already open and modified."
|
||||||
catch /^Vim\%((\a\+)\)\=:/
|
catch /^Vim\%((\a\+)\)\=:/
|
||||||
do nothing
|
"do nothing
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
" resize the explorer window if it is larger than the requested size
|
|
||||||
exec(there)
|
|
||||||
|
|
||||||
if g:NERDTreeWinSize =~ '[0-9]\+' && winheight("") > g:NERDTreeWinSize
|
|
||||||
exec("silent vertical resize ".g:NERDTreeWinSize)
|
|
||||||
endif
|
|
||||||
|
|
||||||
wincmd p
|
|
||||||
|
|
||||||
" Restore splitmode settings
|
" Restore splitmode settings
|
||||||
let &splitbelow=savesplitbelow
|
let &splitbelow=savesplitbelow
|
||||||
let &splitright=savesplitright
|
let &splitright=savesplitright
|
||||||
@@ -2274,7 +2287,7 @@ function! s:RenderView()
|
|||||||
call s:DumpHelp()
|
call s:DumpHelp()
|
||||||
|
|
||||||
"delete the blank line before the help and add one after it
|
"delete the blank line before the help and add one after it
|
||||||
call setline(line(".")+1, " ")
|
call setline(line(".")+1, "")
|
||||||
call cursor(line(".")+1, col("."))
|
call cursor(line(".")+1, col("."))
|
||||||
|
|
||||||
"add the 'up a dir' line
|
"add the 'up a dir' line
|
||||||
@@ -2327,13 +2340,17 @@ endfunction
|
|||||||
"
|
"
|
||||||
"Assumes the cursor is in the NERDTree window
|
"Assumes the cursor is in the NERDTree window
|
||||||
function! s:RestoreScreenState()
|
function! s:RestoreScreenState()
|
||||||
if !exists("t:NERDTreeOldTopLine") || !exists("t:NERDTreeOldPos")
|
if !exists("t:NERDTreeOldTopLine") || !exists("t:NERDTreeOldPos") || !exists("t:NERDTreeOldWindowSize")
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
exec("silent ". (g:NERDTreeSplitVertical ? "vertical" : "") ." resize ".t:NERDTreeOldWindowSize)
|
||||||
|
|
||||||
|
let old_scrolloff=&scrolloff
|
||||||
|
let &scrolloff=0
|
||||||
call cursor(t:NERDTreeOldTopLine, 0)
|
call cursor(t:NERDTreeOldTopLine, 0)
|
||||||
normal! zt
|
normal! zt
|
||||||
call setpos(".", t:NERDTreeOldPos)
|
call setpos(".", t:NERDTreeOldPos)
|
||||||
|
let &scrolloff=old_scrolloff
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:SaveScreenState() {{{2
|
"FUNCTION: s:SaveScreenState() {{{2
|
||||||
@@ -2344,6 +2361,7 @@ endfunction
|
|||||||
function! s:SaveScreenState()
|
function! s:SaveScreenState()
|
||||||
let t:NERDTreeOldPos = getpos(".")
|
let t:NERDTreeOldPos = getpos(".")
|
||||||
let t:NERDTreeOldTopLine = line("w0")
|
let t:NERDTreeOldTopLine = line("w0")
|
||||||
|
let t:NERDTreeOldWindowSize = g:NERDTreeSplitVertical ? winwidth("") : winheight("")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:SetupSyntaxHighlighting() {{{2
|
"FUNCTION: s:SetupSyntaxHighlighting() {{{2
|
||||||
@@ -2374,28 +2392,31 @@ function! s:SetupSyntaxHighlighting()
|
|||||||
syn match treeToggleOn #".*(on)#hs=e-2,he=e-1 contains=treeHelpKey
|
syn match treeToggleOn #".*(on)#hs=e-2,he=e-1 contains=treeHelpKey
|
||||||
syn match treeToggleOff #".*(off)#hs=e-3,he=e-1 contains=treeHelpKey
|
syn match treeToggleOff #".*(off)#hs=e-3,he=e-1 contains=treeHelpKey
|
||||||
syn match treeHelpCommand #" :.\{-}\>#hs=s+3
|
syn match treeHelpCommand #" :.\{-}\>#hs=s+3
|
||||||
syn match treeHelp #^" .*# contains=treeHelpKey,treeHelpTitle,treeFlag,treeToggleOff,treeToggleOn,treeHelpCommand
|
syn match treeHelp #^".*# contains=treeHelpKey,treeHelpTitle,treeFlag,treeToggleOff,treeToggleOn,treeHelpCommand
|
||||||
|
|
||||||
"highlighting for sym links
|
|
||||||
syn match treeLink #[^-| `].* -> # contains=treeBookmark
|
|
||||||
|
|
||||||
"highlighting for readonly files
|
"highlighting for readonly files
|
||||||
syn match treeRO #[0-9a-zA-Z]\+.*\[RO\]# contains=treeFlag,treeBookmark
|
syn match treeRO #[\/0-9a-zA-Z]\+.*\[RO\]# contains=treeFlag,treeBookmark
|
||||||
|
|
||||||
"highlighting for bookmarks
|
"highlighting for bookmarks
|
||||||
syn match treeBookmark # {.*}#hs=s+1
|
syn match treeBookmark # {.*}#hs=s+1
|
||||||
|
|
||||||
|
"highlighting for sym links
|
||||||
|
syn match treeLink #[^-| `].* -> # contains=treeBookmark,treeOpenable,treeClosable,treeDirSlash
|
||||||
|
|
||||||
"highlighing for directory nodes and file nodes
|
"highlighing for directory nodes and file nodes
|
||||||
syn match treeDirSlash #/#
|
syn match treeDirSlash #/#
|
||||||
syn match treeDir #[^-| `].*/# contains=treeLink,treeDirSlash,treeOpenable,treeClosable
|
syn match treeDir #[^-| `].*/# contains=treeLink,treeDirSlash,treeOpenable,treeClosable
|
||||||
syn match treeFile #|-.*# contains=treeLink,treePart,treeRO,treePartFile,treeBookmark
|
syn match treeExecFile #[|`]-.*\*\($\| \)# contains=treeLink,treePart,treeRO,treePartFile,treeBookmark
|
||||||
syn match treeFile #`-.*# contains=treeLink,treePart,treeRO,treePartFile,treeBookmark
|
syn match treeFile #|-.*# contains=treeLink,treePart,treeRO,treePartFile,treeBookmark,treeExecFile
|
||||||
|
syn match treeFile #`-.*# contains=treeLink,treePart,treeRO,treePartFile,treeBookmark,treeExecFile
|
||||||
syn match treeCWD #^/.*$#
|
syn match treeCWD #^/.*$#
|
||||||
|
|
||||||
if g:NERDChristmasTree
|
if g:NERDChristmasTree
|
||||||
hi def link treePart Special
|
hi def link treePart Special
|
||||||
hi def link treePartFile Type
|
hi def link treePartFile Type
|
||||||
hi def link treeFile Macro
|
hi def link treeFile Normal
|
||||||
|
hi def link treeExecFile Title
|
||||||
hi def link treeDirSlash Identifier
|
hi def link treeDirSlash Identifier
|
||||||
hi def link treeClosable Type
|
hi def link treeClosable Type
|
||||||
else
|
else
|
||||||
@@ -2415,7 +2436,7 @@ function! s:SetupSyntaxHighlighting()
|
|||||||
hi def link treeDir Directory
|
hi def link treeDir Directory
|
||||||
hi def link treeUp Directory
|
hi def link treeUp Directory
|
||||||
hi def link treeCWD Statement
|
hi def link treeCWD Statement
|
||||||
hi def link treeLink Title
|
hi def link treeLink Macro
|
||||||
hi def link treeOpenable Title
|
hi def link treeOpenable Title
|
||||||
hi def link treeFlag ignore
|
hi def link treeFlag ignore
|
||||||
hi def link treeRO WarningMsg
|
hi def link treeRO WarningMsg
|
||||||
@@ -2431,16 +2452,28 @@ endfunction
|
|||||||
"Args:
|
"Args:
|
||||||
"winnumber: the number of the window in question
|
"winnumber: the number of the window in question
|
||||||
function! s:ShouldSplitToOpen(winnumber)
|
function! s:ShouldSplitToOpen(winnumber)
|
||||||
if &hidden
|
"gotta split if theres only one window (i.e. the NERD tree)
|
||||||
return 0
|
if winnr("$") == 1
|
||||||
|
return 1
|
||||||
endif
|
endif
|
||||||
let oldwinnr = winnr()
|
|
||||||
|
|
||||||
|
let oldwinnr = winnr()
|
||||||
exec a:winnumber . "wincmd p"
|
exec a:winnumber . "wincmd p"
|
||||||
|
let specialWindow = getbufvar("%", '&buftype') != '' || getwinvar('%', '&previewwindow')
|
||||||
let modified = &modified
|
let modified = &modified
|
||||||
exec oldwinnr . "wincmd p"
|
exec oldwinnr . "wincmd p"
|
||||||
|
|
||||||
return winnr("$") == 1 || (modified && s:BufInWindows(winbufnr(a:winnumber)) < 2)
|
"if its a special window e.g. quickfix or another explorer plugin then we
|
||||||
|
"have to split
|
||||||
|
if specialWindow
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
if &hidden
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
return modified && s:BufInWindows(winbufnr(a:winnumber)) < 2
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:StripMarkupFromLine(line, removeLeadingSpaces){{{2
|
"FUNCTION: s:StripMarkupFromLine(line, removeLeadingSpaces){{{2
|
||||||
@@ -2456,11 +2489,14 @@ function! s:StripMarkupFromLine(line, removeLeadingSpaces)
|
|||||||
let line = substitute (line,"^" . s:tree_markup_reg . "*","","")
|
let line = substitute (line,"^" . s:tree_markup_reg . "*","","")
|
||||||
|
|
||||||
"strip off any read only flag
|
"strip off any read only flag
|
||||||
let line = substitute (line, s:tree_RO_str_reg, "","")
|
let line = substitute (line, ' \[RO\]', "","")
|
||||||
|
|
||||||
"strip off any bookmark flags
|
"strip off any bookmark flags
|
||||||
let line = substitute (line, ' {[^}]*}', "","")
|
let line = substitute (line, ' {[^}]*}', "","")
|
||||||
|
|
||||||
|
"strip off any executable flags
|
||||||
|
let line = substitute (line, '*\ze\($\| \)', "","")
|
||||||
|
|
||||||
let wasdir = 0
|
let wasdir = 0
|
||||||
if line =~ '/$'
|
if line =~ '/$'
|
||||||
let wasdir = 1
|
let wasdir = 1
|
||||||
@@ -2635,7 +2671,7 @@ function! s:CheckForActivate()
|
|||||||
"if they clicked a dir, check if they clicked on the + or ~ sign
|
"if they clicked a dir, check if they clicked on the + or ~ sign
|
||||||
"beside it
|
"beside it
|
||||||
if currentNode.path.isDirectory
|
if currentNode.path.isDirectory
|
||||||
let reg = '^' . s:tree_markup_reg .'*[' . s:tree_dir_open . s:tree_dir_closed . ']$'
|
let reg = '^' . s:tree_markup_reg .'*[~+]$'
|
||||||
if startToCur =~ reg
|
if startToCur =~ reg
|
||||||
call s:ActivateNode()
|
call s:ActivateNode()
|
||||||
return
|
return
|
||||||
@@ -2950,18 +2986,7 @@ endfunction
|
|||||||
function! s:JumpToSibling(forward)
|
function! s:JumpToSibling(forward)
|
||||||
let currentNode = s:GetSelectedNode()
|
let currentNode = s:GetSelectedNode()
|
||||||
if !empty(currentNode)
|
if !empty(currentNode)
|
||||||
|
|
||||||
if !currentNode.path.isDirectory
|
|
||||||
|
|
||||||
if a:forward
|
|
||||||
let sibling = currentNode.parent.FindSibling(1)
|
|
||||||
else
|
|
||||||
let sibling = currentNode.parent
|
|
||||||
endif
|
|
||||||
|
|
||||||
else
|
|
||||||
let sibling = currentNode.FindSibling(a:forward)
|
let sibling = currentNode.FindSibling(a:forward)
|
||||||
endif
|
|
||||||
|
|
||||||
if !empty(sibling)
|
if !empty(sibling)
|
||||||
call s:PutCursorOnNode(sibling, 1, 0)
|
call s:PutCursorOnNode(sibling, 1, 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user