mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e67324fdea | ||
|
|
5249b30fbf | ||
|
|
09b165cfac | ||
|
|
6224d20698 | ||
|
|
07612557eb | ||
|
|
7a0312f492 | ||
|
|
41a44be8d5 | ||
|
|
85103aa607 | ||
|
|
1f5018dc45 | ||
|
|
d706f40ae7 | ||
|
|
e41dd019d9 | ||
|
|
2388af7754 | ||
|
|
c3d7c141bb | ||
|
|
450abd1820 | ||
|
|
6d3743549c | ||
|
|
961c3571c4 | ||
|
|
26333ceeab |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,12 +1,14 @@
|
|||||||
# NERDTree Change Log
|
# NERDTree Change Log
|
||||||
|
<!-- Introduce a new MAJOR or MINOR version with a 4-hash header.
|
||||||
<!--
|
PATCH versions are listed from newest to oldest under their respective MAJOR.MINOR
|
||||||
Introduce a new MAJOR.MINOR version with a 4-hash header.
|
version in an unordered list. The format is:
|
||||||
|
|
||||||
PATCH versions are listed from newest to oldest under their respective MAJOR.MINOR version
|
|
||||||
in an unordered list. The format is:
|
|
||||||
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
||||||
-->
|
-->
|
||||||
|
#### 6.7
|
||||||
|
- **.0**: Open the parent directory when revealing a non-existent file with :NERDTreeFind (bouk) [#1090](https://github.com/preservim/nerdtree/pull/1090)
|
||||||
|
#### 6.6
|
||||||
|
- **.1**: [add] How to install using dein.vim (kazukazuinaina) [#1087](https://github.com/preservim/nerdtree/pull/1087)
|
||||||
|
- **.0**: Add the ability to turn off directory arrows (PhilRunninger) [#1085](https://github.com/preservim/nerdtree/pull/1085)
|
||||||
#### 6.5
|
#### 6.5
|
||||||
- **.0**: `NERDTreeToggle <start-directory>` always sets NERDTree root. (PhilRunninger) [#1083](https://github.com/preservim/nerdtree/pull/1083)
|
- **.0**: `NERDTreeToggle <start-directory>` always sets NERDTree root. (PhilRunninger) [#1083](https://github.com/preservim/nerdtree/pull/1083)
|
||||||
#### 6.4
|
#### 6.4
|
||||||
|
|||||||
@@ -59,6 +59,13 @@ Plug 'preservim/nerdtree'
|
|||||||
call plug#end()
|
call plug#end()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### [dein.vim](https://github.com/Shougo/dein.vim)
|
||||||
|
```vim
|
||||||
|
call dein#begin()
|
||||||
|
call dein#add('preservim/nerdtree')
|
||||||
|
call dein#end()
|
||||||
|
```
|
||||||
|
|
||||||
#### [apt-vim](https://github.com/egalpin/apt-vim)
|
#### [apt-vim](https://github.com/egalpin/apt-vim)
|
||||||
```bash
|
```bash
|
||||||
apt-vim install -y https://github.com/preservim/nerdtree.git
|
apt-vim install -y https://github.com/preservim/nerdtree.git
|
||||||
@@ -143,3 +150,8 @@ Use these variables in your vimrc. Note that below are default arrow symbols
|
|||||||
let g:NERDTreeDirArrowExpandable = '▸'
|
let g:NERDTreeDirArrowExpandable = '▸'
|
||||||
let g:NERDTreeDirArrowCollapsible = '▾'
|
let g:NERDTreeDirArrowCollapsible = '▾'
|
||||||
```
|
```
|
||||||
|
You can remove the arrows altogether by setting these variables to empty strings, as shown below. This will remove not only the arrows, but a single space following them, shifting the whole tree two character positions to the left.
|
||||||
|
```vim
|
||||||
|
let g:NERDTreeDirArrowExpandable = ''
|
||||||
|
let g:NERDTreeDirArrowCollapsible = ''
|
||||||
|
```
|
||||||
|
|||||||
@@ -284,6 +284,7 @@ endfunction
|
|||||||
" FUNCTION: s:findAndRevealPath(pathStr) {{{1
|
" FUNCTION: s:findAndRevealPath(pathStr) {{{1
|
||||||
function! s:findAndRevealPath(pathStr) abort
|
function! s:findAndRevealPath(pathStr) abort
|
||||||
let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p')
|
let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p')
|
||||||
|
let l:revealOpts = {}
|
||||||
|
|
||||||
if empty(l:pathStr)
|
if empty(l:pathStr)
|
||||||
call nerdtree#echoWarning('no file for the current buffer')
|
call nerdtree#echoWarning('no file for the current buffer')
|
||||||
@@ -292,6 +293,7 @@ function! s:findAndRevealPath(pathStr) abort
|
|||||||
|
|
||||||
if !filereadable(l:pathStr)
|
if !filereadable(l:pathStr)
|
||||||
let l:pathStr = fnamemodify(l:pathStr, ':h')
|
let l:pathStr = fnamemodify(l:pathStr, ':h')
|
||||||
|
let l:revealOpts['open'] = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -327,7 +329,7 @@ function! s:findAndRevealPath(pathStr) abort
|
|||||||
call b:NERDTree.ui.setShowHidden(1)
|
call b:NERDTree.ui.setShowHidden(1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:node = b:NERDTree.root.reveal(l:pathObj)
|
let l:node = b:NERDTree.root.reveal(l:pathObj, l:revealOpts)
|
||||||
call b:NERDTree.render()
|
call b:NERDTree.render()
|
||||||
call l:node.putCursorHere(1, 0)
|
call l:node.putCursorHere(1, 0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -1223,13 +1223,19 @@ Values: Any single character.
|
|||||||
Defaults: Windows: ~ and + Others: ▾ and ▸
|
Defaults: Windows: ~ and + Others: ▾ and ▸
|
||||||
|
|
||||||
These characters indicate whether a directory is collapsible or expandable.
|
These characters indicate whether a directory is collapsible or expandable.
|
||||||
|
Example: >
|
||||||
They can be set to "\u00a0" to hide the arrows, but if you do this you may
|
|
||||||
need to change the node delimiter. See |NERDTreeNodeDelimiter|. You cannot use
|
|
||||||
the same character for both the arrows and the delimiter. Example: >
|
|
||||||
let NERDTreeDirArrowExpandable=">"
|
let NERDTreeDirArrowExpandable=">"
|
||||||
let NERDTreeDirArrowCollapsible="v"
|
let NERDTreeDirArrowCollapsible="v"
|
||||||
<
|
<
|
||||||
|
They can be set to "\u00a0" to replace the arrows with a non-breaking space.
|
||||||
|
If you do this you may need to change the node delimiter. See
|
||||||
|
|NERDTreeNodeDelimiter|. You cannot use the same character for both the arrows
|
||||||
|
and the delimiter.
|
||||||
|
|
||||||
|
Alternatively, they can be set to '' (an empty string). This removes the
|
||||||
|
arrows and the single space that follows them, shifting the entire tree two
|
||||||
|
character positions to the left.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTreeNodeDelimiter*
|
*NERDTreeNodeDelimiter*
|
||||||
Values: Any single character.
|
Values: Any single character.
|
||||||
|
|||||||
@@ -104,16 +104,11 @@ function! s:TreeDirNode.displayString()
|
|||||||
endfor
|
endfor
|
||||||
|
|
||||||
" Select the appropriate open/closed status indicator symbol.
|
" Select the appropriate open/closed status indicator symbol.
|
||||||
if l:cascade[-1].isOpen
|
let l:symbol = (l:cascade[-1].isOpen ? g:NERDTreeDirArrowCollapsible : g:NERDTreeDirArrowExpandable )
|
||||||
let l:symbol = g:NERDTreeDirArrowCollapsible
|
let l:symbol .= (g:NERDTreeDirArrowExpandable ==# '' ? '' : ' ')
|
||||||
else
|
|
||||||
let l:symbol = g:NERDTreeDirArrowExpandable
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:flags = l:cascade[-1].path.flagSet.renderToString()
|
let l:flags = l:cascade[-1].path.flagSet.renderToString()
|
||||||
|
|
||||||
let l:result = l:symbol . ' ' . l:flags . l:label
|
return l:symbol . l:flags . l:label
|
||||||
return l:result
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: TreeDirNode.findNode(path) {{{1
|
" FUNCTION: TreeDirNode.findNode(path) {{{1
|
||||||
|
|||||||
@@ -321,13 +321,9 @@ function! s:TreeFileNode._renderToString(depth, drawText)
|
|||||||
if a:drawText ==# 1
|
if a:drawText ==# 1
|
||||||
|
|
||||||
let treeParts = repeat(' ', a:depth - 1)
|
let treeParts = repeat(' ', a:depth - 1)
|
||||||
|
let treeParts .= (self.path.isDirectory || g:NERDTreeDirArrowExpandable ==# '' ? '' : ' ')
|
||||||
if !self.path.isDirectory
|
|
||||||
let treeParts = treeParts . ' '
|
|
||||||
endif
|
|
||||||
|
|
||||||
let line = treeParts . self.displayString()
|
let line = treeParts . self.displayString()
|
||||||
|
|
||||||
let output = output . line . "\n"
|
let output = output . line . "\n"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -284,7 +284,11 @@ endfunction
|
|||||||
function! s:UI._indentLevelFor(line)
|
function! s:UI._indentLevelFor(line)
|
||||||
" Replace multi-character DirArrows with a single space so the
|
" Replace multi-character DirArrows with a single space so the
|
||||||
" indentation calculation doesn't get messed up.
|
" indentation calculation doesn't get messed up.
|
||||||
let l:line = substitute(substitute(a:line, '\V'.g:NERDTreeDirArrowExpandable, ' ', ''), '\V'.g:NERDTreeDirArrowCollapsible, ' ', '')
|
if g:NERDTreeDirArrowExpandable ==# ''
|
||||||
|
let l:line = ' '.a:line
|
||||||
|
else
|
||||||
|
let l:line = substitute(substitute(a:line, '\V'.g:NERDTreeDirArrowExpandable, ' ', ''), '\V'.g:NERDTreeDirArrowCollapsible, ' ', '')
|
||||||
|
endif
|
||||||
let leadChars = match(l:line, '\M\[^ ]')
|
let leadChars = match(l:line, '\M\[^ ]')
|
||||||
return leadChars / s:UI.IndentWid()
|
return leadChars / s:UI.IndentWid()
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -19,24 +19,7 @@ syn match NERDTreeLinkTarget #->.*# containedin=NERDTreeDir,NERDTreeFile
|
|||||||
syn match NERDTreeLinkFile #.* ->#me=e-3 containedin=NERDTreeFile
|
syn match NERDTreeLinkFile #.* ->#me=e-3 containedin=NERDTreeFile
|
||||||
syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir
|
syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir
|
||||||
|
|
||||||
"highlighing for directory nodes and file nodes
|
"highlighting to conceal the delimiter around the file/dir name
|
||||||
syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
|
|
||||||
|
|
||||||
exec 'syn match NERDTreeClosable #' . escape(g:NERDTreeDirArrowCollapsible, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
|
|
||||||
exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
|
|
||||||
|
|
||||||
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
|
|
||||||
exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
|
|
||||||
syn match NERDTreeExecFile '^ .*\*\($\| \)' contains=NERDTreeRO,NERDTreeBookmark
|
|
||||||
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
|
|
||||||
|
|
||||||
"highlighting for readonly files
|
|
||||||
exec 'syn match NERDTreeRO # *\zs.*\ze \['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
|
|
||||||
|
|
||||||
syn match NERDTreeFlags #^ *\zs\[[^\]]*\]# containedin=NERDTreeFile,NERDTreeExecFile
|
|
||||||
syn match NERDTreeFlags #\[[^\]]*\]# containedin=NERDTreeDir
|
|
||||||
|
|
||||||
"highlighing to conceal the delimiter around the file/dir name
|
|
||||||
if has('conceal')
|
if has('conceal')
|
||||||
exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# conceal containedin=ALL'
|
exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# conceal containedin=ALL'
|
||||||
setlocal conceallevel=3 concealcursor=nvic
|
setlocal conceallevel=3 concealcursor=nvic
|
||||||
@@ -45,6 +28,27 @@ else
|
|||||||
hi! link NERDTreeNodeDelimiters Ignore
|
hi! link NERDTreeNodeDelimiters Ignore
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
"highlighing for directory nodes and file nodes
|
||||||
|
syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
|
||||||
|
|
||||||
|
if g:NERDTreeDirArrowExpandable !=# ''
|
||||||
|
exec 'syn match NERDTreeClosable #' . escape(g:NERDTreeDirArrowCollapsible, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
|
||||||
|
exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
|
||||||
|
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
|
||||||
|
exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
|
||||||
|
exec 'syn match NERDTreeExecFile #^.*'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark'
|
||||||
|
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
|
||||||
|
else
|
||||||
|
exec 'syn match NERDTreeDir #[^'.g:NERDTreeNodeDelimiter.']\{-}/\ze\($\|'.g:NERDTreeNodeDelimiter.'\)#'
|
||||||
|
exec 'syn match NERDTreeExecFile #[^'.g:NERDTreeNodeDelimiter.']\{-}'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark'
|
||||||
|
exec 'syn match NERDTreeFile #^.*'.g:NERDTreeNodeDelimiter.'.*[^\/]\($\|'.g:NERDTreeNodeDelimiter.'.*\)# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
|
||||||
|
endif
|
||||||
|
|
||||||
|
"highlighting for readonly files
|
||||||
|
exec 'syn match NERDTreeRO #.*'.g:NERDTreeNodeDelimiter.'\zs.*\ze'.g:NERDTreeNodeDelimiter.'.*\['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
|
||||||
|
|
||||||
|
exec 'syn match NERDTreeFlags #\[[^\]]*\]\ze'.g:NERDTreeNodeDelimiter.'# containedin=NERDTreeFile,NERDTreeExecFile,NERDTreeDir'
|
||||||
|
|
||||||
syn match NERDTreeCWD #^[</].*$#
|
syn match NERDTreeCWD #^[</].*$#
|
||||||
|
|
||||||
"highlighting for bookmarks
|
"highlighting for bookmarks
|
||||||
|
|||||||
Reference in New Issue
Block a user