mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
577ddc73f0 | ||
|
|
23000acd7f | ||
|
|
6b5d70e5bf |
@@ -5,6 +5,9 @@
|
|||||||
- **.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.9
|
||||||
|
- **.9**: Updated Readme, removed typo (H3RSKO) [#1167](https://github.com/preservim/nerdtree/pull/1167)
|
||||||
|
- **.8**: Refactor sort comparison functions, removing redundancy (PhilRunninger) [#1166](https://github.com/preservim/nerdtree/pull/1166)
|
||||||
|
- **.7**: Fix argument of `exists()` function calls checking for autocommands. (PhilRunninger) [#1165](https://github.com/preservim/nerdtree/pull/1165)
|
||||||
- **.6**: Don't use silent when raising User events (PhilRunninger) [#1164](https://github.com/preservim/nerdtree/pull/1164)
|
- **.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)
|
- **.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)
|
- **.4**: Make sure symbolic links' flags are highlighted correctly. (PhilRunninger) [#1156](https://github.com/preservim/nerdtree/pull/1156)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ git clone https://github.com/preservim/nerdtree.git ~/.vim/pack/vendor/start/ner
|
|||||||
vim -u NONE -c "helptags ~/.vim/pack/vendor/start/nerdtree/doc" -c q
|
vim -u NONE -c "helptags ~/.vim/pack/vendor/start/nerdtree/doc" -c q
|
||||||
```
|
```
|
||||||
|
|
||||||
Otherwise, these are some of the several 3rd-party plugin managers you can choose from. Be sure you read the instructions for your chosen plugin, as there typically are additional steps you nee d to take.
|
Otherwise, these are some of the several 3rd-party plugin managers you can choose from. Be sure you read the instructions for your chosen plugin, as there typically are additional steps you need to take.
|
||||||
|
|
||||||
#### [pathogen.vim](https://github.com/tpope/vim-pathogen)
|
#### [pathogen.vim](https://github.com/tpope/vim-pathogen)
|
||||||
|
|
||||||
|
|||||||
@@ -110,15 +110,15 @@ function! nerdtree#completeBookmarks(A,L,P) abort
|
|||||||
return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"')
|
return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: nerdtree#compareNodes(dir) {{{2
|
"FUNCTION: nerdtree#compareNodes(n1, n2) {{{2
|
||||||
function! nerdtree#compareNodes(n1, n2) abort
|
function! nerdtree#compareNodes(n1, n2) abort
|
||||||
return a:n1.path.compareTo(a:n2.path)
|
return nerdtree#compareNodePaths(a:n1.path, a:n2.path)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: nerdtree#compareNodesBySortKey(n1, n2) {{{2
|
"FUNCTION: nerdtree#compareNodePaths(p1, p2) {{{2
|
||||||
function! nerdtree#compareNodesBySortKey(n1, n2) abort
|
function! nerdtree#compareNodePaths(p1, p2) abort
|
||||||
let sortKey1 = a:n1.path.getSortKey()
|
let sortKey1 = a:p1.getSortKey()
|
||||||
let sortKey2 = a:n2.path.getSortKey()
|
let sortKey2 = a:p2.getSortKey()
|
||||||
let i = 0
|
let i = 0
|
||||||
while i < min([len(sortKey1), len(sortKey2)])
|
while i < min([len(sortKey1), len(sortKey2)])
|
||||||
" Compare chunks upto common length.
|
" Compare chunks upto common length.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: s:Creator._broadcastInitEvent() {{{1
|
" FUNCTION: s:Creator._broadcastInitEvent() {{{1
|
||||||
function! s:Creator._broadcastInitEvent()
|
function! s:Creator._broadcastInitEvent()
|
||||||
if exists('#NERDTreeInit')
|
if exists('#User#NERDTreeInit')
|
||||||
doautocmd User NERDTreeInit
|
doautocmd User NERDTreeInit
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ function! s:NERDTree.changeRoot(node)
|
|||||||
call self.render()
|
call self.render()
|
||||||
call self.root.putCursorHere(0, 0)
|
call self.root.putCursorHere(0, 0)
|
||||||
|
|
||||||
if exists('#NERDTreeNewRoot')
|
if exists('#User#NERDTreeNewRoot')
|
||||||
doautocmd User NERDTreeNewRoot
|
doautocmd User NERDTreeNewRoot
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -99,50 +99,6 @@ function! s:Path.changeToDir()
|
|||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Path.compareTo() {{{1
|
|
||||||
"
|
|
||||||
" Compares this Path to the given path and returns 0 if they are equal, -1 if
|
|
||||||
" this Path is 'less than' the given path, or 1 if it is 'greater'.
|
|
||||||
"
|
|
||||||
" Args:
|
|
||||||
" path: the path object to compare this to
|
|
||||||
"
|
|
||||||
" Return:
|
|
||||||
" 1, -1 or 0
|
|
||||||
function! s:Path.compareTo(path)
|
|
||||||
let thisPath = self.getLastPathComponent(1)
|
|
||||||
let thatPath = a:path.getLastPathComponent(1)
|
|
||||||
|
|
||||||
"if the paths are the same then clearly we return 0
|
|
||||||
if thisPath ==# thatPath
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
let thisSS = self.getSortOrderIndex()
|
|
||||||
let thatSS = a:path.getSortOrderIndex()
|
|
||||||
|
|
||||||
"compare the sort sequences, if they are different then the return
|
|
||||||
"value is easy
|
|
||||||
if thisSS < thatSS
|
|
||||||
return -1
|
|
||||||
elseif thisSS > thatSS
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
if !g:NERDTreeSortHiddenFirst
|
|
||||||
let thisPath = substitute(thisPath, '^[._]', '', '')
|
|
||||||
let thatPath = substitute(thatPath, '^[._]', '', '')
|
|
||||||
endif
|
|
||||||
"if the sort sequences are the same then compare the paths
|
|
||||||
"alphabetically
|
|
||||||
let pathCompare = g:NERDTreeCaseSensitiveSort ? thisPath <# thatPath : thisPath <? thatPath
|
|
||||||
if pathCompare
|
|
||||||
return -1
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" FUNCTION: Path.Create(fullpath) {{{1
|
" FUNCTION: Path.Create(fullpath) {{{1
|
||||||
"
|
"
|
||||||
" Factory method.
|
" Factory method.
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ function! s:TreeDirNode.getChildIndex(path)
|
|||||||
let z = self.getChildCount()
|
let z = self.getChildCount()
|
||||||
while a < z
|
while a < z
|
||||||
let mid = (a+z)/2
|
let mid = (a+z)/2
|
||||||
let diff = a:path.compareTo(self.children[mid].path)
|
let diff = nerdtree#compareNodePaths(a:path, self.children[mid].path)
|
||||||
|
|
||||||
if diff ==# -1
|
if diff ==# -1
|
||||||
let z = mid
|
let z = mid
|
||||||
@@ -666,7 +666,7 @@ function! s:TreeDirNode.sortChildren()
|
|||||||
if count(g:NERDTreeSortOrder, '*') < 1
|
if count(g:NERDTreeSortOrder, '*') < 1
|
||||||
call add(g:NERDTreeSortOrder, '*')
|
call add(g:NERDTreeSortOrder, '*')
|
||||||
endif
|
endif
|
||||||
let CompareFunc = function('nerdtree#compareNodesBySortKey')
|
let CompareFunc = function('nerdtree#compareNodes')
|
||||||
call sort(self.children, CompareFunc)
|
call sort(self.children, CompareFunc)
|
||||||
let g:NERDTreeOldSortOrder = g:NERDTreeSortOrder
|
let g:NERDTreeOldSortOrder = g:NERDTreeSortOrder
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user