Compare commits

...

8 Commits
5.3.0 ... 5.3.3

Author SHA1 Message Date
Phil Runninger
9193962ad8 Update version number in change log. 2019-09-15 14:44:09 -04:00
Chris Patuzzo
2eaedd8bf4 Fix (p)ath not displaying in the minimal menu (#1038)
The ‘copy (p)ath to clipboard’ menu item was added
recently in this pull request:
https://github.com/scrooloose/nerdtree/pull/1002/files

However, this caused the NERDTreeMinimalMenu to
display ‘copy’ instead of ‘(p)ath’ because it was
simply using the first word of the item’s text.

This change fixes that bug by using a regex to
pick out the first word beginning with ‘(’
2019-09-15 14:41:27 -04:00
Phil Runninger
60ec10b477 Enable events when closing NerdTree window. (#1037)
* Enable events when closing NT window. Triggers updates in Airline.

* Update version number in change log.
2019-09-13 10:49:26 -04:00
Phil Runninger (mac)
51fc75efdb Fix version number. I was on the wrong branch. 2019-09-09 09:40:18 -04:00
Phil Runninger (mac)
79ef87b009 Update version number in change log. 2019-09-09 05:27:48 -04:00
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
8 changed files with 21 additions and 27 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 - [ ] `MAJOR` version when you make incompatible API changes
- [ ] `MINOR` version when you add functionality in a backwards-compatible manner - [ ] `MINOR` version when you add functionality in a backwards-compatible manner
- [ ] `PATCH` version when you make backwards-compatible bug fixes - [ ] `PATCH` version when you make backwards-compatible bug fixes
- [ ] Update [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md). - [ ] 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`
Use this format in CHANGELOG.md. Use the existing text as a template.
#### MAJOR.MINOR...
- **.PATCH**: PR Title (Author) [#PR Number](link to PR)
-->

View File

@@ -1,6 +1,9 @@
# Change Log # Change Log
#### 5.3... #### 5.3...
- **.3**: Fix (p)ath not displaying in the minimal menu [#1038](https://github.com/scrooloose/nerdtree/pull/1038)
- **.2**: Enable events when closing NerdTree window. [#1037](https://github.com/scrooloose/nerdtree/pull/1037)
- **.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) - **.0**: Add file extension and size to sorting capabilities [#1029](https://github.com/scrooloose/nerdtree/pull/1029)
#### 5.2... #### 5.2...
- **.9**: Suppress events for intermediate window/tab/buffer changes [#1026](https://github.com/scrooloose/nerdtree/pull/1026) - **.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:NERDTreeMapOpenInTabSilent, 'scope': 'Bookmark', 'callback': s . 'openInNewTabSilent' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': "DirNode", 'callback': s."openExplorer" }) 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" }) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapDeleteBookmark, 'scope': "Bookmark", 'callback': s."deleteBookmark" })
endfunction endfunction

View File

@@ -62,9 +62,10 @@ function! s:MenuController._echoPrompt()
if self.isMinimal() if self.isMinimal()
let selection = self.menuItems[self.selection].text let selection = self.menuItems[self.selection].text
let keyword = matchstr(selection, "\([^ ]*")
let shortcuts = map(copy(self.menuItems), "v:val['shortcut']") let shortcuts = map(copy(self.menuItems), "v:val['shortcut']")
let shortcuts[self.selection] = " " . split(selection)[0] . " " let shortcuts[self.selection] = " " . keyword . " "
echo "Menu: [" . join(shortcuts, ",") . "] (" . navHelp . " or shortcut): " echo "Menu: [" . join(shortcuts, ",") . "] (" . navHelp . " or shortcut): "
else else

View File

@@ -52,7 +52,7 @@ function! s:NERDTree.Close()
endif endif
call nerdtree#exec(s:NERDTree.GetWinNum() . " wincmd w", 1) call nerdtree#exec(s:NERDTree.GetWinNum() . " wincmd w", 1)
call nerdtree#exec("close", 1) call nerdtree#exec("close", 0)
if l:useWinId if l:useWinId
call nerdtree#exec("call win_gotoid(" . l:activeBufOrWin . ")", 0) call nerdtree#exec("call win_gotoid(" . l:activeBufOrWin . ")", 0)
else else

View File

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

View File

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

View File

@@ -246,6 +246,12 @@ function! s:TreeFileNode.openInNewTab(options)
call self.open(extend({'where': 't'}, a:options)) call self.open(extend({'where': 't'}, a:options))
endfunction 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 " FUNCTION: TreeFileNode.putCursorHere(isJump, recurseUpward){{{1
" Places the cursor on the line number this node is rendered on " Places the cursor on the line number this node is rendered on
" "