Compare commits

..

5 Commits
5.2.0 ... 5.2.4

Author SHA1 Message Date
Phil Runninger
89a1a4355b When searching for root line num, stop at the end of the file. (#1015)
* When searching for root line num, stop at the end of the file.

When using the following NERDTreeStatusLine, Vim would lock up and not
work anymore. The problem was that when trying to find the root line
number, the loop was continuing past the end of the file, looping
"forever". The fix was to simply stop at the end of the file.

let g:NERDTreeStatusline = "%{exists('g:NERDTreeFileNode')&&" .
      \ "has_key(g:NERDTreeFileNode.GetSelected(),'path')?" .
      \ "g:NERDTreeFileNode.GetSelected().path.getLastPathComponent(0):''}"

* Update change log.
2019-07-04 00:21:50 -04:00
Phil Runninger
62b78de367 Update Change Log 2019-07-03 11:12:21 -04:00
Kebin Liu
aef6baf6e2 Update ui_glue.vim (#1014)
Fix `<CR>` key map on the bookmark
2019-07-03 11:11:25 -04:00
Phil Runninger
06c9d9c963 Make Enter work on the .. ( up a dir ) line (#1013)
* Make Enter work on the `.. ( up a dir )` line.

* Simpler instructions for getting bug info.

* Update changelog.
2019-07-02 15:45:36 -04:00
Phil Runninger
ca16df25fa Fix nerdtree#version() on Windows. 2019-07-01 23:29:56 -04:00
5 changed files with 24 additions and 6 deletions

View File

@@ -22,9 +22,8 @@ After reading, and before submitting your issue, please remove this introductory
#### Environment (for bug reports) #### Environment (for bug reports)
- [ ] Operating System: - [ ] Operating System:
- [ ] Vim/Neovim version `:version`: - [ ] Vim/Neovim version `:echo v:version`:
- [ ] NERDTree version `:echo nerdtree#version(0)` or `git rev-parse --short HEAD`: - [ ] NERDTree version, found on 1st line in NERDTree quickhelp `?`:
- [ ] A link to my [vimrc](), or
- [ ] vimrc settings - [ ] vimrc settings
- [ ] NERDTree variables - [ ] NERDTree variables
```vim ```vim

View File

@@ -1,6 +1,10 @@
# Change Log # Change Log
#### 5.2... #### 5.2...
- **.4**: When searching for root line num, stop at end of file. (PhilRunninger) #1015
- **.3**: Fix `<CR>` key map on the bookmark (lkebin) #1014
- **.2**: Make Enter work on the `.. ( up a dir )` line (PhilRunninger) #1013
- **.1**: Fix nerdtree#version() on Windows. (PhilRunninger) N/A
- **.0**: Expand functionality of `<CR>` mapping. (PhilRunninger) #1011 - **.0**: Expand functionality of `<CR>` mapping. (PhilRunninger) #1011
#### 5.1... #### 5.1...
- **.3**: Remove @mentions from PR template and change log. They weren't working. (PhilRunninger) #1009 - **.3**: Remove @mentions from PR template and change log. They weren't working. (PhilRunninger) #1009

View File

@@ -3,8 +3,9 @@ if exists("g:loaded_nerdtree_autoload")
endif endif
let g:loaded_nerdtree_autoload = 1 let g:loaded_nerdtree_autoload = 1
let s:rootNERDTreePath = resolve(expand("<sfile>:p:h:h"))
function! nerdtree#version(...) function! nerdtree#version(...)
let l:changelog = readfile(expand("<sfile>:p:h")."/CHANGELOG.md") let l:changelog = readfile(join([s:rootNERDTreePath, "CHANGELOG.md"], nerdtree#slash()))
let l:text = 'Unknown' let l:text = 'Unknown'
let l:line = 0 let l:line = 0
while l:line <= len(l:changelog) while l:line <= len(l:changelog)
@@ -21,6 +22,19 @@ endfunction
" SECTION: General Functions {{{1 " SECTION: General Functions {{{1
"============================================================ "============================================================
function! nerdtree#slash()
if nerdtree#runningWindows()
if exists('+shellslash') && &shellslash
return '/'
endif
return '\'
endif
return '/'
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.2
function! nerdtree#and(x,y) function! nerdtree#and(x,y)

View File

@@ -17,6 +17,7 @@ function! nerdtree#ui_glue#createDefaultBindings()
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'FileNode', 'callback': s."customOpenFile"}) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'FileNode', 'callback': s."customOpenFile"})
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'DirNode', 'callback': s."customOpenDir"}) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'DirNode', 'callback': s."customOpenDir"})
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'Bookmark', 'callback': s."customOpenBookmark"}) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'Bookmark', 'callback': s."customOpenBookmark"})
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCustomOpen, 'scope':'all', 'callback': s."activateAll" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "DirNode", 'callback': s."activateDirNode" }) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "DirNode", 'callback': s."activateDirNode" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "FileNode", 'callback': s."activateFileNode" }) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "FileNode", 'callback': s."activateFileNode" })
@@ -94,7 +95,7 @@ endfunction
"FUNCTION: s:customOpenBookmark() {{{1 "FUNCTION: s:customOpenBookmark() {{{1
" Open bookmark node with the "custom" key, initially <CR>. " Open bookmark node with the "custom" key, initially <CR>.
function! s:customOpenBookmark(node) function! s:customOpenBookmark(node)
if node.isDirectory if a:node.path.isDirectory
call a:node.activate(b:NERDTree, s:initCustomOpenArgs().dir) call a:node.activate(b:NERDTree, s:initCustomOpenArgs().dir)
else else
call a:node.activate(b:NERDTree, s:initCustomOpenArgs().file) call a:node.activate(b:NERDTree, s:initCustomOpenArgs().file)

View File

@@ -254,7 +254,7 @@ endfunction
" gets the line number of the root node " gets the line number of the root node
function! s:UI.getRootLineNum() function! s:UI.getRootLineNum()
let rootLine = 1 let rootLine = 1
while getline(rootLine) !~# '^\(/\|<\)' while rootLine <= line('$') && getline(rootLine) !~# '^\(/\|<\)'
let rootLine = rootLine + 1 let rootLine = rootLine + 1
endwhile endwhile
return rootLine return rootLine