Compare commits

..

3 Commits
5.3.0 ... 5.3.1

Author SHA1 Message Date
Phil Runninger
3d508aedce Fix the e key mapping to use netrw if desired (#1031)
* Use :edit in openExplorer to allow NERDTreeHijackNetrw to do its thing.

* Remove commented-out code.

* Make `e` work on file nodes, opening a new NERDTree or netrw buffer.

* Update change log.
2019-08-27 20:53:23 -04:00
Phil Runninger (mac)
9afab6257b Condense code: ternary operators vs. if-then-else blocks. 2019-08-19 14:39:17 -04:00
Phil Runninger (mac)
877f41e243 Update PR template with instructions to tag the release. 2019-08-19 09:36:50 -04:00
6 changed files with 16 additions and 25 deletions

View File

@@ -9,11 +9,5 @@ Closes # <!-- Issue number this PR addresses. If none, remove this line. -->
- [ ] `MAJOR` version when you make incompatible API changes
- [ ] `MINOR` version when you add functionality in a backwards-compatible manner
- [ ] `PATCH` version when you make backwards-compatible bug fixes
- [ ] Update [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md).
<!--
Use this format in CHANGELOG.md. Use the existing text as a template.
#### MAJOR.MINOR...
- **.PATCH**: PR Title (Author) [#PR Number](link to PR)
-->
- [ ] Update [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md), following the established pattern.
- [ ] Tag the merge commit, e.g. `git tag -a 3.1.4 -m "v3.1.4" && git push origin --tags`

View File

@@ -1,6 +1,7 @@
# Change Log
#### 5.3...
- **.1**: Fix the `e` key mapping to use netrw if desired [#1031](https://github.com/scrooloose/nerdtree/pull/1031)
- **.0**: Add file extension and size to sorting capabilities [#1029](https://github.com/scrooloose/nerdtree/pull/1029)
#### 5.2...
- **.9**: Suppress events for intermediate window/tab/buffer changes [#1026](https://github.com/scrooloose/nerdtree/pull/1026)

View File

@@ -72,6 +72,7 @@ function! nerdtree#ui_glue#createDefaultBindings()
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': 'Bookmark', 'callback': s . 'openInNewTabSilent' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': "DirNode", 'callback': s."openExplorer" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': "FileNode", 'callback': s."openExplorer" })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapDeleteBookmark, 'scope': "Bookmark", 'callback': s."deleteBookmark" })
endfunction

View File

@@ -413,24 +413,12 @@ function! s:Path.getSortKey()
let metadata = []
for tag in g:NERDTreeSortOrder
if tag =~? '\[\[-\?timestamp\]\]'
if self.isDirectory
call add(metadata, 0)
else
call add(metadata, (tag =~ '-' ? -1 : 1) * getftime(self.str()))
endif
let metadata += [self.isDirectory ? 0 : getftime(self.str()) * (tag =~ '-' ? -1 : 1)]
elseif tag =~? '\[\[-\?size\]\]'
if self.isDirectory
call add(metadata, 0)
else
call add(metadata, (tag =~ '-' ? -1 : 1) * getfsize(self.str()))
endif
let metadata += [self.isDirectory ? 0 : getfsize(self.str()) * (tag =~ '-' ? -1 : 1)]
elseif tag =~? '\[\[extension\]\]'
if self.isDirectory
call add(metadata, '')
else
let extension = matchstr(self.getLastPathComponent(0), '[^.]\+\.\zs[^.]\+$')
call add(metadata, extension == '' ? nr2char(str2nr('0x10ffff',16)) : extension)
endif
let extension = matchstr(self.getLastPathComponent(0), '[^.]\+\.\zs[^.]\+$')
let metadata += [self.isDirectory ? '' : (extension == '' ? nr2char(str2nr('0x10ffff',16)) : extension)]
endif
endfor

View File

@@ -523,7 +523,8 @@ endfunction
" Open an explorer window for this node in the previous window. The explorer
" can be a NERDTree window or a netrw window.
function! s:TreeDirNode.openExplorer()
call self.open({'where': 'p'})
execute "wincmd p"
execute "edit ".self.path.str({'format':'Edit'})
endfunction
" FUNCTION: TreeDirNode.openInNewTab(options) {{{1

View File

@@ -246,6 +246,12 @@ function! s:TreeFileNode.openInNewTab(options)
call self.open(extend({'where': 't'}, a:options))
endfunction
" FUNCTION: TreeFileNode.openExplorer()
function! s:TreeFileNode.openExplorer()
execute "wincmd p"
execute "edit ".self.path.getParent().str({'format':'Edit'})
endfunction
" FUNCTION: TreeFileNode.putCursorHere(isJump, recurseUpward){{{1
" Places the cursor on the line number this node is rendered on
"