mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
Compare commits
24 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 |
@@ -43,7 +43,7 @@ What is this "NERD tree"??
|
||||
The NERD tree allows you to explore your filesystem and to open files and
|
||||
directories. It presents the filesystem to you in the form of a tree which you
|
||||
manipulate with the keyboard and/or mouse. It also allows you to perform
|
||||
simple filesystem operations so you can alter the tree dynamically.
|
||||
simple filesystem operations.
|
||||
|
||||
The following features and functionality are provided by the NERD tree:
|
||||
* Files and directories are displayed in a hierarchical tree structure
|
||||
@@ -53,6 +53,7 @@ The following features and functionality are provided by the NERD tree:
|
||||
* sym-links
|
||||
* windows .lnk files
|
||||
* read-only files
|
||||
* executable files
|
||||
* Many (customisable) mappings are provided to manipulate the tree:
|
||||
* Mappings to open/close/explore directory nodes
|
||||
* Mappings to open files in new/existing windows/tabs
|
||||
@@ -66,7 +67,7 @@ The following features and functionality are provided by the NERD tree:
|
||||
* 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/rename file and directory nodes as well as copy (for
|
||||
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.
|
||||
@@ -266,9 +267,8 @@ Recursively opens the selelected directory.
|
||||
|
||||
All files and directories are cached, but if a directory would not be
|
||||
displayed due to file filters (see |NERDTreeIgnore| |NERDTree-f|) or the
|
||||
hidden file filter (see |NERDTreeShowHidden|) then it is not opened. This is
|
||||
handy, especially if you have .svn directories.
|
||||
|
||||
hidden file filter (see |NERDTreeShowHidden|) then its contents are not
|
||||
cached. This is handy, especially if you have .svn directories.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDTree-x*
|
||||
@@ -344,8 +344,7 @@ Default key: <C-j>
|
||||
Map option: NERDTreeMapJumpNextSibling
|
||||
Applies to: files and directories.
|
||||
|
||||
If a dir node is selected, jump to the next sibling of that node.
|
||||
If a file node is selected, jump to the next sibling of that nodes parent.
|
||||
Jump to the next sibling of the selected node.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDTree-c-k*
|
||||
@@ -353,8 +352,7 @@ Default key: <C-k>
|
||||
Map option: NERDTreeMapJumpPrevSibling
|
||||
Applies to: files and directories.
|
||||
|
||||
If a dir node is selected, jump to the previous sibling of that node.
|
||||
If a file node is selected, jump to the previous sibling of that nodes parent.
|
||||
Jump to the previous sibling of the selected node.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDTree-C*
|
||||
@@ -828,10 +826,7 @@ Window manager integration?
|
||||
6. The Author *NERDTreeAuthor*
|
||||
|
||||
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
|
||||
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.
|
||||
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.
|
||||
@@ -841,6 +836,22 @@ fridge for later ;)
|
||||
==============================================================================
|
||||
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
|
||||
- added bookmarks, see :help NERDTreeBookmarkCommands for details. Thanks
|
||||
to Piotr Czachur for all his testing and suggestions.
|
||||
@@ -1086,6 +1097,9 @@ 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.
|
||||
|
||||
==============================================================================
|
||||
9. License *NERDTreeLicense*
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
" File: NERD_tree.vim
|
||||
" Description: vim global plugin that provides a nice tree explorer
|
||||
" Maintainer: Martin Grenfell <martin_grenfell at msn dot com>
|
||||
" Last Change: 17 June, 2008
|
||||
" 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
|
||||
@@ -10,7 +10,7 @@
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
" ============================================================================
|
||||
let s:NERD_tree_version = '2.10.0'
|
||||
let s:NERD_tree_version = '2.11.0'
|
||||
|
||||
" SECTION: Script init stuff {{{1
|
||||
"============================================================
|
||||
@@ -123,20 +123,10 @@ call s:InitVariable("g:NERDTreeMapUpdirKeepOpen", "U")
|
||||
let s:escape_chars = " \\`\|\"#%&,?()\*^<>"
|
||||
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_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_neg = '[^ \-+~`|]'
|
||||
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 = '/'
|
||||
if s:running_windows
|
||||
@@ -1010,7 +1000,7 @@ function! s:oPath.Delete() dict
|
||||
throw "NERDTree.Path.Deletion Exception: Could not delete directory: '" . self.StrForOS(0) . "'"
|
||||
endif
|
||||
else
|
||||
let success = delete(self.StrForOS(!s:running_windows))
|
||||
let success = delete(self.StrForOS(0))
|
||||
if success != 0
|
||||
throw "NERDTree.Path.Deletion Exception: Could not delete file: '" . self.Str(0) . "'"
|
||||
endif
|
||||
@@ -1169,6 +1159,11 @@ function! s:oPath.ReadInfoFromDisk(fullpath) dict
|
||||
throw "NERDTree.Path.InvalidArguments Exception: Invalid path = " . a:fullpath
|
||||
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)
|
||||
let lastPathComponent = self.GetLastPathComponent(0)
|
||||
|
||||
@@ -1207,7 +1202,7 @@ function! s:oPath.Rename(newPath) dict
|
||||
throw "NERDTree.Path.InvalidArguments exception. Invalid newPath for renaming = ". a:newPath
|
||||
endif
|
||||
|
||||
let success = rename(self.StrForOS(!s:running_windows), a:newPath)
|
||||
let success = rename(self.StrForOS(0), a:newPath)
|
||||
if success != 0
|
||||
throw "NERDTree.Path.Rename Exception: Could not rename: '" . self.StrForOS(0) . "'" . 'to:' . a:newPath
|
||||
endif
|
||||
@@ -1265,6 +1260,10 @@ endfunction
|
||||
function! s:oPath.StrDisplay() dict
|
||||
let toReturn = self.GetLastPathComponent(1)
|
||||
|
||||
if self.isExecutable
|
||||
let toReturn = toReturn . '*'
|
||||
endif
|
||||
|
||||
let bookmarks = self.BookmarkNames()
|
||||
if !empty(bookmarks)
|
||||
let toReturn .= ' {' . join(bookmarks, ',') . '}'
|
||||
@@ -1275,7 +1274,7 @@ function! s:oPath.StrDisplay() dict
|
||||
endif
|
||||
|
||||
if self.isReadOnly
|
||||
let toReturn .= s:tree_RO_str
|
||||
let toReturn .= ' [RO]'
|
||||
endif
|
||||
|
||||
return toReturn
|
||||
@@ -1350,7 +1349,7 @@ function! s:oPath.UncacheBookmark(name) dict
|
||||
let bookmarks = self.BookmarkNames()
|
||||
let i = index(bookmarks, a:name)
|
||||
if i != -1
|
||||
echo remove(bookmarks, i)
|
||||
call remove(bookmarks, i)
|
||||
endif
|
||||
endfunction
|
||||
"FUNCTION: oPath.WinToUnixPath(pathstr){{{3
|
||||
@@ -1687,9 +1686,9 @@ function! s:DrawTree(curNode, depth, drawText, vertMap, isLastChild)
|
||||
if a:depth > 1
|
||||
for j in a:vertMap[0:-2]
|
||||
if j == 1
|
||||
let treeParts = treeParts . s:tree_vert . s:tree_wid_strM1
|
||||
let treeParts = treeParts . '| '
|
||||
else
|
||||
let treeParts = treeParts . s:tree_wid_str
|
||||
let treeParts = treeParts . ' '
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
@@ -1697,9 +1696,9 @@ function! s:DrawTree(curNode, depth, drawText, vertMap, isLastChild)
|
||||
"get the last vertical tree part for this line which will be different
|
||||
"if this node is the last child of its parent
|
||||
if a:isLastChild
|
||||
let treeParts = treeParts . s:tree_vert_last
|
||||
let treeParts = treeParts . '`'
|
||||
else
|
||||
let treeParts = treeParts . s:tree_vert
|
||||
let treeParts = treeParts . '|'
|
||||
endif
|
||||
|
||||
|
||||
@@ -1707,12 +1706,12 @@ function! s:DrawTree(curNode, depth, drawText, vertMap, isLastChild)
|
||||
"name itself
|
||||
if a:curNode.path.isDirectory
|
||||
if a:curNode.isOpen
|
||||
let treeParts = treeParts . s:tree_dir_open
|
||||
let treeParts = treeParts . '~'
|
||||
else
|
||||
let treeParts = treeParts . s:tree_dir_closed
|
||||
let treeParts = treeParts . '+'
|
||||
endif
|
||||
else
|
||||
let treeParts = treeParts . s:tree_file
|
||||
let treeParts = treeParts . '-'
|
||||
endif
|
||||
let line = treeParts . a:curNode.StrDisplay()
|
||||
|
||||
@@ -1751,7 +1750,7 @@ function! s:DumpHelp()
|
||||
let @h=@h."\" File node mappings~\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:NERDTreeMapPreview .": preview \n"
|
||||
let @h=@h."\" ". g:NERDTreeMapPreview .": preview\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."\" middle-click,\n"
|
||||
@@ -1759,7 +1758,7 @@ function! s:DumpHelp()
|
||||
let @h=@h."\" ". g:NERDTreeMapPreviewSplit .": preview split\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."\" ". (g:NERDTreeMouseMode == 1 ? "double" : "single") ."-click,\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapActivateNode .": open & close node\n"
|
||||
@@ -1769,9 +1768,9 @@ function! s:DumpHelp()
|
||||
let @h=@h."\" current node recursively\n"
|
||||
let @h=@h."\" middle-click,\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."\" ". g:NERDTreeMapJumpRoot .": go to root\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapJumpParent .": go to parent\n"
|
||||
@@ -1780,7 +1779,7 @@ function! s:DumpHelp()
|
||||
let @h=@h."\" ". g:NERDTreeMapJumpNextSibling .": go to next 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."\" ". g:NERDTreeMapChangeRoot .": change tree root to the\n"
|
||||
let @h=@h."\" selected dir\n"
|
||||
@@ -1793,17 +1792,17 @@ function! s:DumpHelp()
|
||||
let @h=@h."\" ". g:NERDTreeMapChdir .":change the CWD to the\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."\" ". 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: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."\" ". g:NERDTreeMapQuit .": Close the NERDTree window\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 <name>\n"
|
||||
let @h=@h."\" :BookmarkToRoot <name>\n"
|
||||
@@ -1826,7 +1825,7 @@ endfunction
|
||||
"msg: the message to echo
|
||||
function! s:Echo(msg)
|
||||
redraw
|
||||
echo "NERDTree: " . a:msg
|
||||
echomsg "NERDTree: " . a:msg
|
||||
endfunction
|
||||
"FUNCTION: s:EchoWarning {{{2
|
||||
"Wrapper for s:Echo, sets the message type to warningmsg for this message
|
||||
@@ -1950,7 +1949,6 @@ function! s:GetPath(ln)
|
||||
endif
|
||||
|
||||
"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
|
||||
|
||||
|
||||
@@ -2104,12 +2102,17 @@ endfunction
|
||||
function! s:OpenFileNode(treenode)
|
||||
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)
|
||||
else
|
||||
try
|
||||
wincmd p
|
||||
silent exec ("edit " . a:treenode.path.StrForEditCmd())
|
||||
exec ("edit " . a:treenode.path.StrForEditCmd())
|
||||
catch /^Vim\%((\a\+)\)\=:E37/
|
||||
call s:PutCursorInTreeWin()
|
||||
call s:Echo("Cannot open file, it is already open and modified")
|
||||
@@ -2201,18 +2204,9 @@ function! s:OpenNodeSplit(treenode)
|
||||
call s:PutCursorInTreeWin()
|
||||
throw "NERDTree.view.FileOpen exception: ". a:treenode.path.Str(0) ." is already open and modified."
|
||||
catch /^Vim\%((\a\+)\)\=:/
|
||||
do nothing
|
||||
"do nothing
|
||||
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
|
||||
let &splitbelow=savesplitbelow
|
||||
let &splitright=savesplitright
|
||||
@@ -2293,7 +2287,7 @@ function! s:RenderView()
|
||||
call s:DumpHelp()
|
||||
|
||||
"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("."))
|
||||
|
||||
"add the 'up a dir' line
|
||||
@@ -2346,13 +2340,17 @@ endfunction
|
||||
"
|
||||
"Assumes the cursor is in the NERDTree window
|
||||
function! s:RestoreScreenState()
|
||||
if !exists("t:NERDTreeOldTopLine") || !exists("t:NERDTreeOldPos")
|
||||
if !exists("t:NERDTreeOldTopLine") || !exists("t:NERDTreeOldPos") || !exists("t:NERDTreeOldWindowSize")
|
||||
return
|
||||
endif
|
||||
exec("silent ". (g:NERDTreeSplitVertical ? "vertical" : "") ." resize ".t:NERDTreeOldWindowSize)
|
||||
|
||||
let old_scrolloff=&scrolloff
|
||||
let &scrolloff=0
|
||||
call cursor(t:NERDTreeOldTopLine, 0)
|
||||
normal! zt
|
||||
call setpos(".", t:NERDTreeOldPos)
|
||||
let &scrolloff=old_scrolloff
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:SaveScreenState() {{{2
|
||||
@@ -2363,6 +2361,7 @@ endfunction
|
||||
function! s:SaveScreenState()
|
||||
let t:NERDTreeOldPos = getpos(".")
|
||||
let t:NERDTreeOldTopLine = line("w0")
|
||||
let t:NERDTreeOldWindowSize = g:NERDTreeSplitVertical ? winwidth("") : winheight("")
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:SetupSyntaxHighlighting() {{{2
|
||||
@@ -2393,28 +2392,31 @@ function! s:SetupSyntaxHighlighting()
|
||||
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 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
|
||||
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
|
||||
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
|
||||
syn match treeDirSlash #/#
|
||||
syn match treeDir #[^-| `].*/# contains=treeLink,treeDirSlash,treeOpenable,treeClosable
|
||||
syn match treeFile #|-.*# contains=treeLink,treePart,treeRO,treePartFile,treeBookmark
|
||||
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,treeExecFile
|
||||
syn match treeFile #`-.*# contains=treeLink,treePart,treeRO,treePartFile,treeBookmark,treeExecFile
|
||||
syn match treeCWD #^/.*$#
|
||||
|
||||
if g:NERDChristmasTree
|
||||
hi def link treePart Special
|
||||
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 treeClosable Type
|
||||
else
|
||||
@@ -2434,7 +2436,7 @@ function! s:SetupSyntaxHighlighting()
|
||||
hi def link treeDir Directory
|
||||
hi def link treeUp Directory
|
||||
hi def link treeCWD Statement
|
||||
hi def link treeLink Title
|
||||
hi def link treeLink Macro
|
||||
hi def link treeOpenable Title
|
||||
hi def link treeFlag ignore
|
||||
hi def link treeRO WarningMsg
|
||||
@@ -2450,16 +2452,28 @@ endfunction
|
||||
"Args:
|
||||
"winnumber: the number of the window in question
|
||||
function! s:ShouldSplitToOpen(winnumber)
|
||||
if &hidden
|
||||
return 0
|
||||
"gotta split if theres only one window (i.e. the NERD tree)
|
||||
if winnr("$") == 1
|
||||
return 1
|
||||
endif
|
||||
let oldwinnr = winnr()
|
||||
|
||||
let oldwinnr = winnr()
|
||||
exec a:winnumber . "wincmd p"
|
||||
let specialWindow = getbufvar("%", '&buftype') != '' || getwinvar('%', '&previewwindow')
|
||||
let modified = &modified
|
||||
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
|
||||
|
||||
"FUNCTION: s:StripMarkupFromLine(line, removeLeadingSpaces){{{2
|
||||
@@ -2475,11 +2489,14 @@ function! s:StripMarkupFromLine(line, removeLeadingSpaces)
|
||||
let line = substitute (line,"^" . s:tree_markup_reg . "*","","")
|
||||
|
||||
"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
|
||||
let line = substitute (line, ' {[^}]*}', "","")
|
||||
|
||||
"strip off any executable flags
|
||||
let line = substitute (line, '*\ze\($\| \)', "","")
|
||||
|
||||
let wasdir = 0
|
||||
if line =~ '/$'
|
||||
let wasdir = 1
|
||||
@@ -2654,7 +2671,7 @@ function! s:CheckForActivate()
|
||||
"if they clicked a dir, check if they clicked on the + or ~ sign
|
||||
"beside it
|
||||
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
|
||||
call s:ActivateNode()
|
||||
return
|
||||
@@ -2969,18 +2986,7 @@ endfunction
|
||||
function! s:JumpToSibling(forward)
|
||||
let currentNode = s:GetSelectedNode()
|
||||
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)
|
||||
endif
|
||||
let sibling = currentNode.FindSibling(a:forward)
|
||||
|
||||
if !empty(sibling)
|
||||
call s:PutCursorOnNode(sibling, 1, 0)
|
||||
|
||||
Reference in New Issue
Block a user