mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
373a4b28e4 | ||
|
|
4a32dd0be3 | ||
|
|
e571d3e95b | ||
|
|
96e247ba74 | ||
|
|
2af10e3589 | ||
|
|
42a5a2c106 | ||
|
|
f8aa749985 | ||
|
|
aa37cb40da | ||
|
|
6571452857 | ||
|
|
d48ab70721 | ||
|
|
9de5b3e785 | ||
|
|
635071dcc8 | ||
|
|
052b1f00a0 | ||
|
|
f63132cade | ||
|
|
484dc84b47 | ||
|
|
2e9d43b6f8 | ||
|
|
10eaa3a2f4 | ||
|
|
e2670f0d19 | ||
|
|
4cc6097ecb |
10
.github/PULL_REQUEST_TEMPLATE.md
vendored
10
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,5 +1,5 @@
|
|||||||
### Description of Changes
|
### Description of Changes
|
||||||
Closes # <!-- Issue number this PR addresses. If none, remove this line. -->
|
Closes # <!-- Enter the issue number this PR addresses. If none, remove this line. -->
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -13,4 +13,10 @@ Closes # <!-- Issue number this PR addresses. If none, remove this line. -->
|
|||||||
- [ ] Update [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md), following the established pattern.
|
- [ ] Update [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md), following the established pattern.
|
||||||
#### Collaborator's Instructions
|
#### Collaborator's Instructions
|
||||||
- [ ] Review [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md), suggesting a different version number if necessary.
|
- [ ] Review [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md), suggesting a different version number if necessary.
|
||||||
- [ ] After merge, tag the merge commit, e.g. `git tag -a 3.1.4 -m "v3.1.4" && git push origin --tags`
|
- [ ] After merging, tag the commit using these (Mac-compatible) bash commands:
|
||||||
|
```bash
|
||||||
|
git checkout master
|
||||||
|
git pull
|
||||||
|
sed -n "$(grep -n -m2 '####' CHANGELOG.md | cut -f1 -d: | sed 'N;s/\n/,/')p" CHANGELOG.md | sed '$d'
|
||||||
|
git tag -a $(read -p "Tag Name: " tag;echo $tag) -m"$(git show --quiet --pretty=%s)";git push origin --tags
|
||||||
|
```
|
||||||
|
|||||||
16
CHANGELOG.md
16
CHANGELOG.md
@@ -4,7 +4,23 @@
|
|||||||
version in an unordered list. The format is:
|
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.9
|
||||||
|
- **.6**: Don't use silent when raising User events (PhilRunninger) [#1164](https://github.com/preservim/nerdtree/pull/1164)
|
||||||
|
- **.5**: Fix highlight for file node. (pirey) [#1157](https://github.com/preservim/nerdtree/pull/1157)
|
||||||
|
- **.4**: Make sure symbolic links' flags are highlighted correctly. (PhilRunninger) [#1156](https://github.com/preservim/nerdtree/pull/1156)
|
||||||
|
- **.3**: Fix new NERDTrees' width when previous one was in the only window. (PhilRunninger) [#1153](https://github.com/preservim/nerdtree/pull/1153)
|
||||||
|
- **.2**: Fix the scope of several key mappings (lifecrisis, PhilRunninger) [#1151](https://github.com/preservim/nerdtree/pull/1151)
|
||||||
|
- **.1**: Respect user's `&shellslash` setting in CopyNode and RemoveNode functions (PhilRunninger) [#1150](https://github.com/preservim/nerdtree/pull/1150)
|
||||||
|
- **.0**: Enable opening bookmarks in split windows. (PhilRunninger) [#1144](https://github.com/preservim/nerdtree/pull/1144)
|
||||||
|
#### 6.8
|
||||||
|
- **.0**: Allow concealed characters to show another character. (PhilRunninger) [#1138](https://github.com/preservim/nerdtree/pull/1138)
|
||||||
#### 6.7
|
#### 6.7
|
||||||
|
- **.15**: Add curly braces to the list of characters to be escaped. (PhilRunninger) [#1128](https://github.com/preservim/nerdtree/pull/1128)
|
||||||
|
- **.14**: Use backward-compatible `nerdtree#and()` in one place that was missed. (PhilRunninger) [#1134](https://github.com/preservim/nerdtree/pull/1134)
|
||||||
|
- **.13**: `cmd.exe /c start "" <filename>` for windows default viewer support. (J. Altayó) [#1130](https://github.com/preservim/nerdtree/pull/1130)
|
||||||
|
- **.12**: Fixed a bug that caused the file-tree construction to slow down significantly. (Eugenij-W) [#1126](https://github.com/preservim/nerdtree/pull/1126)
|
||||||
|
- **.11**: Fix exception in NERDTreeFind (on windows OS and If the file is located in the root directory of the disk) (Eugenij-W) [#1122](https://github.com/preservim/nerdtree/pull/1122)
|
||||||
|
- **.10**: Do not consider the tree root to be "cascadable". (lifecrisis) [#1120](https://github.com/preservim/nerdtree/pull/1120)
|
||||||
- **.9**: Force `:NERDTreeFocus` to allow events to be fired when switching windows. (PhilRunninger) [#1118](https://github.com/preservim/nerdtree/pull/1118)
|
- **.9**: Force `:NERDTreeFocus` to allow events to be fired when switching windows. (PhilRunninger) [#1118](https://github.com/preservim/nerdtree/pull/1118)
|
||||||
- **.8**: Fix example code for the `NERDTreeAddKeyMap()` function. (PhilRunninger) [#1116](https://github.com/preservim/nerdtree/pull/1116)
|
- **.8**: Fix example code for the `NERDTreeAddKeyMap()` function. (PhilRunninger) [#1116](https://github.com/preservim/nerdtree/pull/1116)
|
||||||
- **.7**: Put `'%'` argument in `bufname()` for backwards compatibility. (PhilRunninger) [#1105](https://github.com/preservim/nerdtree/pull/1105)
|
- **.7**: Put `'%'` argument in `bufname()` for backwards compatibility. (PhilRunninger) [#1105](https://github.com/preservim/nerdtree/pull/1105)
|
||||||
|
|||||||
@@ -30,9 +30,11 @@ endfunction
|
|||||||
" SECTION: General Functions {{{1
|
" SECTION: General Functions {{{1
|
||||||
"============================================================
|
"============================================================
|
||||||
|
|
||||||
"FUNCTION: nerdtree#slash() {{{2
|
" FUNCTION: nerdtree#slash() {{{2
|
||||||
|
" Return the path separator used by the underlying file system. Special
|
||||||
|
" consideration is taken for the use of the 'shellslash' option on Windows
|
||||||
|
" systems.
|
||||||
function! nerdtree#slash() abort
|
function! nerdtree#slash() abort
|
||||||
|
|
||||||
if nerdtree#runningWindows()
|
if nerdtree#runningWindows()
|
||||||
if exists('+shellslash') && &shellslash
|
if exists('+shellslash') && &shellslash
|
||||||
return '/'
|
return '/'
|
||||||
@@ -45,7 +47,7 @@ function! nerdtree#slash() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: nerdtree#and(x,y) {{{2
|
"FUNCTION: nerdtree#and(x,y) {{{2
|
||||||
" Implements and() function for Vim <= 7.2
|
" Implements and() function for Vim <= 7.4
|
||||||
function! nerdtree#and(x,y) abort
|
function! nerdtree#and(x,y) abort
|
||||||
if exists('*and')
|
if exists('*and')
|
||||||
return and(a:x, a:y)
|
return and(a:x, a:y)
|
||||||
|
|||||||
@@ -25,12 +25,16 @@ function! nerdtree#ui_glue#createDefaultBindings() abort
|
|||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Bookmark', 'callback': s.'previewBookmark' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Bookmark', 'callback': s.'previewBookmark' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'all', 'callback': s.'activateAll' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'all', 'callback': s.'activateAll' })
|
||||||
|
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'Node', 'callback': s.'openHSplit' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'FileNode', 'callback': s.'openHSplit' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'Node', 'callback': s.'openVSplit' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'Bookmark', 'callback': s.'openHSplitBookmark' })
|
||||||
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'FileNode', 'callback': s.'openVSplit' })
|
||||||
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'Bookmark', 'callback': s.'openVSplitBookmark' })
|
||||||
|
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Node', 'callback': s.'previewNodeCurrent' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'FileNode', 'callback': s.'previewNodeCurrent' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'Node', 'callback': s.'previewNodeVSplit' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'FileNode', 'callback': s.'previewNodeHSplit' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'Node', 'callback': s.'previewNodeHSplit' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'Bookmark', 'callback': s.'previewNodeHSplitBookmark' })
|
||||||
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'FileNode', 'callback': s.'previewNodeVSplit' })
|
||||||
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'Bookmark', 'callback': s.'previewNodeVSplitBookmark' })
|
||||||
|
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': 'DirNode', 'callback': s.'openNodeRecursively' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': 'DirNode', 'callback': s.'openNodeRecursively' })
|
||||||
|
|
||||||
@@ -511,6 +515,28 @@ function! s:openVSplit(target) abort
|
|||||||
call a:target.activate({'where': 'v'})
|
call a:target.activate({'where': 'v'})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
"FUNCTION: s:openHSplitBookmark(bookmark) {{{1
|
||||||
|
"handle the user activating a bookmark
|
||||||
|
function! s:openHSplitBookmark(bm) abort
|
||||||
|
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'h'} : {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
"FUNCTION: s:openVSplitBookmark(bookmark) {{{1
|
||||||
|
"handle the user activating a bookmark
|
||||||
|
function! s:openVSplitBookmark(bm) abort
|
||||||
|
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'v'} : {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: s:previewHSplitBookmark(bookmark) {{{1
|
||||||
|
function! s:previewNodeHSplitBookmark(bookmark) abort
|
||||||
|
call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'h', 'keepopen': 1} : {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: s:previewVSplitBookmark(bookmark) {{{1
|
||||||
|
function! s:previewNodeVSplitBookmark(bookmark) abort
|
||||||
|
call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'v', 'keepopen': 1} : {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:openExplorer(node) {{{1
|
" FUNCTION: s:openExplorer(node) {{{1
|
||||||
function! s:openExplorer(node) abort
|
function! s:openExplorer(node) abort
|
||||||
call a:node.openExplorer()
|
call a:node.openExplorer()
|
||||||
@@ -538,11 +564,7 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: s:previewBookmark(bookmark) {{{1
|
" FUNCTION: s:previewBookmark(bookmark) {{{1
|
||||||
function! s:previewBookmark(bookmark) abort
|
function! s:previewBookmark(bookmark) abort
|
||||||
if a:bookmark.path.isDirectory
|
call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'h', 'keepopen': 1} : {})
|
||||||
execute 'NERDTreeFind '.a:bookmark.path.str()
|
|
||||||
else
|
|
||||||
call a:bookmark.activate(b:NERDTree, {'stay': 1, 'where': 'p', 'keepopen': 1})
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:previewNodeCurrent(node) {{{1
|
"FUNCTION: s:previewNodeCurrent(node) {{{1
|
||||||
|
|||||||
@@ -318,9 +318,8 @@ Applies to: files.
|
|||||||
If a file node or a bookmark that links to a file is selected, it is opened in
|
If a file node or a bookmark that links to a file is selected, it is opened in
|
||||||
the previous window, but the cursor does not move.
|
the previous window, but the cursor does not move.
|
||||||
|
|
||||||
If a bookmark that links to a directory is selected, that directory is found
|
If a bookmark that links to a directory is selected then that directory
|
||||||
in the current NERDTree. If the directory couldn't be found, a new NERDTree is
|
becomes the new root.
|
||||||
created.
|
|
||||||
|
|
||||||
The default key combo for this mapping is "g" + NERDTreeMapActivateNode (see
|
The default key combo for this mapping is "g" + NERDTreeMapActivateNode (see
|
||||||
|NERDTree-o|).
|
|NERDTree-o|).
|
||||||
@@ -350,7 +349,7 @@ The same as |NERDTree-t| except that the focus is kept in the current tab.
|
|||||||
*NERDTree-i*
|
*NERDTree-i*
|
||||||
Default key: i
|
Default key: i
|
||||||
Map setting: *NERDTreeMapOpenSplit*
|
Map setting: *NERDTreeMapOpenSplit*
|
||||||
Applies to: files.
|
Applies to: files, and bookmarks pointing to files.
|
||||||
|
|
||||||
Opens the selected file in a new split window and puts the cursor in the new
|
Opens the selected file in a new split window and puts the cursor in the new
|
||||||
window.
|
window.
|
||||||
@@ -359,7 +358,7 @@ window.
|
|||||||
*NERDTree-gi*
|
*NERDTree-gi*
|
||||||
Default key: gi
|
Default key: gi
|
||||||
Map setting: *NERDTreeMapPreviewSplit*
|
Map setting: *NERDTreeMapPreviewSplit*
|
||||||
Applies to: files.
|
Applies to: files, and bookmarks pointing to files.
|
||||||
|
|
||||||
The same as |NERDTree-i| except that the cursor is not moved.
|
The same as |NERDTree-i| except that the cursor is not moved.
|
||||||
|
|
||||||
@@ -370,7 +369,7 @@ The default key combo for this mapping is "g" + NERDTreeMapOpenSplit (see
|
|||||||
*NERDTree-s*
|
*NERDTree-s*
|
||||||
Default key: s
|
Default key: s
|
||||||
Map setting: *NERDTreeMapOpenVSplit*
|
Map setting: *NERDTreeMapOpenVSplit*
|
||||||
Applies to: files.
|
Applies to: files, and bookmarks pointing to files.
|
||||||
|
|
||||||
Opens the selected file in a new vertically split window and puts the cursor
|
Opens the selected file in a new vertically split window and puts the cursor
|
||||||
in the new window.
|
in the new window.
|
||||||
@@ -379,7 +378,7 @@ in the new window.
|
|||||||
*NERDTree-gs*
|
*NERDTree-gs*
|
||||||
Default key: gs
|
Default key: gs
|
||||||
Map setting: *NERDTreeMapPreviewVSplit*
|
Map setting: *NERDTreeMapPreviewVSplit*
|
||||||
Applies to: files.
|
Applies to: files, and bookmarks pointing to files.
|
||||||
|
|
||||||
The same as |NERDTree-s| except that the cursor is not moved.
|
The same as |NERDTree-s| except that the cursor is not moved.
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: s:Creator._broadcastInitEvent() {{{1
|
" FUNCTION: s:Creator._broadcastInitEvent() {{{1
|
||||||
function! s:Creator._broadcastInitEvent()
|
function! s:Creator._broadcastInitEvent()
|
||||||
silent doautocmd User NERDTreeInit
|
if exists('#NERDTreeInit')
|
||||||
|
doautocmd User NERDTreeInit
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:Creator.BufNamePrefix() {{{1
|
" FUNCTION: s:Creator.BufNamePrefix() {{{1
|
||||||
@@ -247,9 +249,13 @@ function! s:Creator._pathForString(str)
|
|||||||
|
|
||||||
"hack to get an absolute path if a relative path is given
|
"hack to get an absolute path if a relative path is given
|
||||||
if dir =~# '^\.'
|
if dir =~# '^\.'
|
||||||
let dir = getcwd() . g:NERDTreePath.Slash() . dir
|
let dir = getcwd() . nerdtree#slash() . dir
|
||||||
|
endif
|
||||||
|
|
||||||
|
"hack to prevent removing slash if dir is the root of the file system.
|
||||||
|
if dir !=# '/'
|
||||||
|
let dir = g:NERDTreePath.Resolve(dir)
|
||||||
endif
|
endif
|
||||||
let dir = g:NERDTreePath.Resolve(dir)
|
|
||||||
|
|
||||||
try
|
try
|
||||||
let path = g:NERDTreePath.New(dir)
|
let path = g:NERDTreePath.New(dir)
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ function! s:NERDTree.changeRoot(node)
|
|||||||
call self.render()
|
call self.render()
|
||||||
call self.root.putCursorHere(0, 0)
|
call self.root.putCursorHere(0, 0)
|
||||||
|
|
||||||
silent doautocmd User NERDTreeNewRoot
|
if exists('#NERDTreeNewRoot')
|
||||||
|
doautocmd User NERDTreeNewRoot
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:NERDTree.Close() {{{1
|
"FUNCTION: s:NERDTree.Close() {{{1
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: Opener._openFile() {{{1
|
" FUNCTION: Opener._openFile() {{{1
|
||||||
function! s:Opener._openFile()
|
function! s:Opener._openFile()
|
||||||
if !self._stay && !and(g:NERDTreeQuitOnOpen,1) && exists('b:NERDTreeZoomed') && b:NERDTreeZoomed
|
if !self._stay && !nerdtree#and(g:NERDTreeQuitOnOpen,1) && exists('b:NERDTreeZoomed') && b:NERDTreeZoomed
|
||||||
call b:NERDTree.ui.toggleZoom()
|
call b:NERDTree.ui.toggleZoom()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ function! s:Path.AbsolutePathFor(pathStr)
|
|||||||
if l:prependWorkingDir
|
if l:prependWorkingDir
|
||||||
let l:result = getcwd()
|
let l:result = getcwd()
|
||||||
|
|
||||||
if l:result[-1:] ==# s:Path.Slash()
|
if l:result[-1:] == nerdtree#slash()
|
||||||
let l:result = l:result . a:pathStr
|
let l:result = l:result . a:pathStr
|
||||||
else
|
else
|
||||||
let l:result = l:result . s:Path.Slash() . a:pathStr
|
let l:result = l:result . nerdtree#slash() . a:pathStr
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -332,7 +332,7 @@ function! s:Path._escChars()
|
|||||||
return " `\|\"#%&,?()\*^<>$"
|
return " `\|\"#%&,?()\*^<>$"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return " \\`\|\"#%&,?()\*^<>[]$"
|
return " \\`\|\"#%&,?()\*^<>[]{}$"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Path.getDir() {{{1
|
" FUNCTION: Path.getDir() {{{1
|
||||||
@@ -546,26 +546,36 @@ endfunction
|
|||||||
" return 1 if this path is somewhere above the given path in the filesystem.
|
" return 1 if this path is somewhere above the given path in the filesystem.
|
||||||
"
|
"
|
||||||
" a:path should be a dir
|
" a:path should be a dir
|
||||||
function! s:Path.isAncestor(path)
|
function! s:Path.isAncestor(child)
|
||||||
if !self.isDirectory
|
return a:child.isUnder(self)
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
let this = self.str()
|
|
||||||
let that = a:path.str()
|
|
||||||
return stridx(that, this) ==# 0
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Path.isUnder(path) {{{1
|
" FUNCTION: Path.isUnder(path) {{{1
|
||||||
" return 1 if this path is somewhere under the given path in the filesystem.
|
" return 1 if this path is somewhere under the given path in the filesystem.
|
||||||
function! s:Path.isUnder(path)
|
function! s:Path.isUnder(parent)
|
||||||
if a:path.isDirectory ==# 0
|
if a:parent.isDirectory ==# 0
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
if nerdtree#runningWindows() && a:parent.drive !=# self.drive
|
||||||
let this = self.str()
|
return 0
|
||||||
let that = a:path.str()
|
endif
|
||||||
return stridx(this, that . s:Path.Slash()) ==# 0
|
let l:this_count = len(self.pathSegments)
|
||||||
|
if l:this_count ==# 0
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let l:that_count = len(a:parent.pathSegments)
|
||||||
|
if l:that_count ==# 0
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
if l:that_count >= l:this_count
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
for i in range(0, l:that_count-1)
|
||||||
|
if self.pathSegments[i] !=# a:parent.pathSegments[i]
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Path.JoinPathStrings(...) {{{1
|
" FUNCTION: Path.JoinPathStrings(...) {{{1
|
||||||
@@ -604,23 +614,6 @@ function! s:Path.New(pathStr)
|
|||||||
return l:newPath
|
return l:newPath
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Path.Slash() {{{1
|
|
||||||
" Return the path separator used by the underlying file system. Special
|
|
||||||
" consideration is taken for the use of the 'shellslash' option on Windows
|
|
||||||
" systems.
|
|
||||||
function! s:Path.Slash()
|
|
||||||
|
|
||||||
if nerdtree#runningWindows()
|
|
||||||
if exists('+shellslash') && &shellslash
|
|
||||||
return '/'
|
|
||||||
endif
|
|
||||||
|
|
||||||
return '\'
|
|
||||||
endif
|
|
||||||
|
|
||||||
return '/'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" FUNCTION: Path.Resolve() {{{1
|
" FUNCTION: Path.Resolve() {{{1
|
||||||
" Invoke the vim resolve() function and return the result
|
" Invoke the vim resolve() function and return the result
|
||||||
" This is necessary because in some versions of vim resolve() removes trailing
|
" This is necessary because in some versions of vim resolve() removes trailing
|
||||||
@@ -805,7 +798,7 @@ function! s:Path._strForEdit()
|
|||||||
|
|
||||||
" On Windows, the drive letter may be removed by "fnamemodify()". Add it
|
" On Windows, the drive letter may be removed by "fnamemodify()". Add it
|
||||||
" back, if necessary.
|
" back, if necessary.
|
||||||
if nerdtree#runningWindows() && l:result[0] ==# s:Path.Slash()
|
if nerdtree#runningWindows() && l:result[0] == nerdtree#slash()
|
||||||
let l:result = self.drive . l:result
|
let l:result = self.drive . l:result
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -820,14 +813,14 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: Path._strForGlob() {{{1
|
" FUNCTION: Path._strForGlob() {{{1
|
||||||
function! s:Path._strForGlob()
|
function! s:Path._strForGlob()
|
||||||
let lead = s:Path.Slash()
|
let lead = nerdtree#slash()
|
||||||
|
|
||||||
"if we are running windows then slap a drive letter on the front
|
"if we are running windows then slap a drive letter on the front
|
||||||
if nerdtree#runningWindows()
|
if nerdtree#runningWindows()
|
||||||
let lead = self.drive . '\'
|
let lead = self.drive . '\'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let toReturn = lead . join(self.pathSegments, s:Path.Slash())
|
let toReturn = lead . join(self.pathSegments, nerdtree#slash())
|
||||||
|
|
||||||
if !nerdtree#runningWindows()
|
if !nerdtree#runningWindows()
|
||||||
let toReturn = escape(toReturn, self._escChars())
|
let toReturn = escape(toReturn, self._escChars())
|
||||||
@@ -839,7 +832,7 @@ endfunction
|
|||||||
" Return the absolute pathname associated with this Path object. The pathname
|
" Return the absolute pathname associated with this Path object. The pathname
|
||||||
" returned is appropriate for the underlying file system.
|
" returned is appropriate for the underlying file system.
|
||||||
function! s:Path._str()
|
function! s:Path._str()
|
||||||
let l:separator = s:Path.Slash()
|
let l:separator = nerdtree#slash()
|
||||||
let l:leader = l:separator
|
let l:leader = l:separator
|
||||||
|
|
||||||
if nerdtree#runningWindows()
|
if nerdtree#runningWindows()
|
||||||
|
|||||||
@@ -278,8 +278,8 @@ function! s:TreeDirNode._glob(pattern, all)
|
|||||||
else
|
else
|
||||||
let l:pathSpec = escape(fnamemodify(self.path.str({'format': 'Glob'}), ':.'), ',')
|
let l:pathSpec = escape(fnamemodify(self.path.str({'format': 'Glob'}), ':.'), ',')
|
||||||
|
|
||||||
" On Windows, the drive letter may be removed by fnamemodify().
|
" On Windows, the drive letter may be removed by "fnamemodify()".
|
||||||
if nerdtree#runningWindows() && l:pathSpec[0] ==# g:NERDTreePath.Slash()
|
if nerdtree#runningWindows() && l:pathSpec[0] == nerdtree#slash()
|
||||||
let l:pathSpec = self.path.drive . l:pathSpec
|
let l:pathSpec = self.path.drive . l:pathSpec
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -377,11 +377,17 @@ endfunction
|
|||||||
" 1. If cascaded, we don't know which dir is bookmarked or is a symlink.
|
" 1. If cascaded, we don't know which dir is bookmarked or is a symlink.
|
||||||
" 2. If the parent is a symlink or is bookmarked, you end up with unparsable
|
" 2. If the parent is a symlink or is bookmarked, you end up with unparsable
|
||||||
" text, and NERDTree cannot get the path of any child node.
|
" text, and NERDTree cannot get the path of any child node.
|
||||||
|
" Also, return false if this directory is the tree root, which should never be
|
||||||
|
" part of a cascade.
|
||||||
function! s:TreeDirNode.isCascadable()
|
function! s:TreeDirNode.isCascadable()
|
||||||
if g:NERDTreeCascadeSingleChildDir ==# 0
|
if g:NERDTreeCascadeSingleChildDir ==# 0
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if self.isRoot()
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
if self.path.isSymLink
|
if self.path.isSymLink
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
@@ -425,6 +431,7 @@ function! s:TreeDirNode._initChildren(silent)
|
|||||||
endtry
|
endtry
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
let g:NERDTreeOldSortOrder = g:NERDTreeSortOrder
|
||||||
call self.sortChildren()
|
call self.sortChildren()
|
||||||
|
|
||||||
call nerdtree#echo('')
|
call nerdtree#echo('')
|
||||||
|
|||||||
@@ -67,6 +67,10 @@ function! s:UI._dumpHelp()
|
|||||||
let help .= '" '. g:NERDTreeMapPreview .": find dir in tree\n"
|
let help .= '" '. g:NERDTreeMapPreview .": find dir in tree\n"
|
||||||
let help .= '" '. g:NERDTreeMapOpenInTab.": open in new tab\n"
|
let help .= '" '. g:NERDTreeMapOpenInTab.": open in new tab\n"
|
||||||
let help .= '" '. g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
let help .= '" '. g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
||||||
|
let help .= '" '. g:NERDTreeMapOpenSplit .": open split\n"
|
||||||
|
let help .= '" '. g:NERDTreeMapPreviewSplit .": preview split\n"
|
||||||
|
let help .= '" '. g:NERDTreeMapOpenVSplit .": open vsplit\n"
|
||||||
|
let help .= '" '. g:NERDTreeMapPreviewVSplit .": preview vsplit\n"
|
||||||
let help .= '" '. g:NERDTreeMapCustomOpen .": custom open\n"
|
let help .= '" '. g:NERDTreeMapCustomOpen .": custom open\n"
|
||||||
let help .= '" '. g:NERDTreeMapDeleteBookmark .": delete bookmark\n"
|
let help .= '" '. g:NERDTreeMapDeleteBookmark .": delete bookmark\n"
|
||||||
|
|
||||||
@@ -364,7 +368,7 @@ function! s:UI.saveScreenState()
|
|||||||
call g:NERDTree.CursorToTreeWin()
|
call g:NERDTree.CursorToTreeWin()
|
||||||
let self._screenState['oldPos'] = getpos('.')
|
let self._screenState['oldPos'] = getpos('.')
|
||||||
let self._screenState['oldTopLine'] = line('w0')
|
let self._screenState['oldTopLine'] = line('w0')
|
||||||
let self._screenState['oldWindowSize']= winwidth('')
|
let self._screenState['oldWindowSize'] = winnr('$')==1 ? g:NERDTreeWinSize : winwidth('')
|
||||||
call nerdtree#exec(win . 'wincmd w', 1)
|
call nerdtree#exec(win . 'wincmd w', 1)
|
||||||
catch
|
catch
|
||||||
endtry
|
endtry
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ if executable('xdg-open')
|
|||||||
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileLinux'})
|
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileLinux'})
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if nerdtree#runningWindows()
|
||||||
|
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileWindows'})
|
||||||
|
endif
|
||||||
|
|
||||||
if g:NERDTreePath.CopyingSupported()
|
if g:NERDTreePath.CopyingSupported()
|
||||||
call NERDTreeAddMenuItem({'text': '(c)opy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'})
|
call NERDTreeAddMenuItem({'text': '(c)opy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'})
|
||||||
endif
|
endif
|
||||||
@@ -161,7 +165,7 @@ endfunction
|
|||||||
function! NERDTreeAddNode()
|
function! NERDTreeAddNode()
|
||||||
let curDirNode = g:NERDTreeDirNode.GetSelected()
|
let curDirNode = g:NERDTreeDirNode.GetSelected()
|
||||||
let prompt = s:inputPrompt('add')
|
let prompt = s:inputPrompt('add')
|
||||||
let newNodeName = input(prompt, curDirNode.path.str() . g:NERDTreePath.Slash(), 'file')
|
let newNodeName = input(prompt, curDirNode.path.str() . nerdtree#slash(), 'file')
|
||||||
|
|
||||||
if newNodeName ==# ''
|
if newNodeName ==# ''
|
||||||
call nerdtree#echo('Node Creation Aborted.')
|
call nerdtree#echo('Node Creation Aborted.')
|
||||||
@@ -248,8 +252,6 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: NERDTreeDeleteNode() {{{1
|
" FUNCTION: NERDTreeDeleteNode() {{{1
|
||||||
function! NERDTreeDeleteNode()
|
function! NERDTreeDeleteNode()
|
||||||
let l:shellslash = &shellslash
|
|
||||||
let &shellslash = 0
|
|
||||||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||||
let confirmed = 0
|
let confirmed = 0
|
||||||
|
|
||||||
@@ -285,7 +287,6 @@ function! NERDTreeDeleteNode()
|
|||||||
else
|
else
|
||||||
call nerdtree#echo('delete aborted')
|
call nerdtree#echo('delete aborted')
|
||||||
endif
|
endif
|
||||||
let &shellslash = l:shellslash
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: NERDTreeListNode() {{{1
|
" FUNCTION: NERDTreeListNode() {{{1
|
||||||
@@ -330,8 +331,6 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: NERDTreeCopyNode() {{{1
|
" FUNCTION: NERDTreeCopyNode() {{{1
|
||||||
function! NERDTreeCopyNode()
|
function! NERDTreeCopyNode()
|
||||||
let l:shellslash = &shellslash
|
|
||||||
let &shellslash = 0
|
|
||||||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||||
let prompt = s:inputPrompt('copy')
|
let prompt = s:inputPrompt('copy')
|
||||||
let newNodePath = input(prompt, currentNode.path.str(), 'file')
|
let newNodePath = input(prompt, currentNode.path.str(), 'file')
|
||||||
@@ -367,7 +366,6 @@ function! NERDTreeCopyNode()
|
|||||||
else
|
else
|
||||||
call nerdtree#echo('Copy aborted.')
|
call nerdtree#echo('Copy aborted.')
|
||||||
endif
|
endif
|
||||||
let &shellslash = l:shellslash
|
|
||||||
redraw!
|
redraw!
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -451,4 +449,15 @@ function! NERDTreeExecuteFileLinux()
|
|||||||
call system('xdg-open ' . shellescape(l:node.path.str()))
|
call system('xdg-open ' . shellescape(l:node.path.str()))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: NERDTreeExecuteFileWindows() {{{1
|
||||||
|
function! NERDTreeExecuteFileWindows()
|
||||||
|
let l:node = g:NERDTreeFileNode.GetSelected()
|
||||||
|
|
||||||
|
if empty(l:node)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
call system('cmd.exe /c start "" ' . shellescape(l:node.path.str()))
|
||||||
|
endfunction
|
||||||
|
|
||||||
" vim: set sw=4 sts=4 et fdm=marker:
|
" vim: set sw=4 sts=4 et fdm=marker:
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir
|
|||||||
"highlighting to conceal the delimiter around the file/dir name
|
"highlighting 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=2 concealcursor=nvic
|
||||||
else
|
else
|
||||||
exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# containedin=ALL'
|
exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# containedin=ALL'
|
||||||
hi! link NERDTreeNodeDelimiters Ignore
|
hi! link NERDTreeNodeDelimiters Ignore
|
||||||
@@ -47,7 +47,7 @@ endif
|
|||||||
"highlighting for readonly files
|
"highlighting for readonly files
|
||||||
exec 'syn match NERDTreeRO #.*'.g:NERDTreeNodeDelimiter.'\zs.*\ze'.g:NERDTreeNodeDelimiter.'.*\['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
|
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'
|
exec 'syn match NERDTreeFlags #\[[^\]]*\]\ze'.g:NERDTreeNodeDelimiter.'# containedin=NERDTreeFile,NERDTreeExecFile,NERDTreeLinkFile,NERDTreeRO,NERDTreeDir'
|
||||||
|
|
||||||
syn match NERDTreeCWD #^[</].*$#
|
syn match NERDTreeCWD #^[</].*$#
|
||||||
|
|
||||||
@@ -93,3 +93,5 @@ hi def link NERDTreeBookmark Statement
|
|||||||
hi def link NERDTreeFlags Number
|
hi def link NERDTreeFlags Number
|
||||||
|
|
||||||
hi def link NERDTreeCurrentNode Search
|
hi def link NERDTreeCurrentNode Search
|
||||||
|
|
||||||
|
hi NERDTreeFile ctermbg=NONE guibg=NONE
|
||||||
|
|||||||
Reference in New Issue
Block a user