mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60ec10b477 | ||
|
|
51fc75efdb | ||
|
|
79ef87b009 | ||
|
|
3d508aedce | ||
|
|
9afab6257b | ||
|
|
877f41e243 | ||
|
|
c4a7ca084e | ||
|
|
184fbb6ffe | ||
|
|
03073bb1c8 | ||
|
|
858b3c0004 |
16
.github/ISSUE_TEMPLATE/bug.md
vendored
16
.github/ISSUE_TEMPLATE/bug.md
vendored
@@ -3,18 +3,18 @@ name: "Bug Report"
|
||||
about: "NERDTree is misbehaving? Tell us about it."
|
||||
labels: bug
|
||||
---
|
||||
<!-- Attention! Please Read!
|
||||
|
||||
# Attention! Please Read!
|
||||
Please fill out ALL the information below so that the issue can be fully
|
||||
understood. Omitting information will delay the resolution of your issue. It
|
||||
will be labeled "Needs More Info", and may be closed until there is enough
|
||||
information.
|
||||
|
||||
Please fill out **ALL the information** below so that the issue can be fully understood. Omitting information will delay the resolution of your issue. It will be labeled **`Needs More Info`**, and *may* be closed until there is enough information.
|
||||
|
||||
Keep in mind that others may have the same question in the future. The better your information, the more likely they'll be able to help themselves.
|
||||
|
||||
After reading, and before submitting your issue, please remove this introductory text.
|
||||
|
||||
──────────────────── ✄ ────────────────────
|
||||
Keep in mind that others may have the same question in the future. The better
|
||||
your information, the more likely they'll be able to help themselves. -->
|
||||
|
||||
#### Self-Diagnosis
|
||||
<!-- Check the boxes after creating the issue, or use [x]. -->
|
||||
- [ ] I have searched the [issues](https://github.com/scrooloose/nerdtree/issues) for an answer to my question.
|
||||
- [ ] I have reviewed the NERDTree documentation. `:h NERDTree`
|
||||
- [ ] I have reviewed the [Wiki](https://github.com/scrooloose/nerdtree/wiki).
|
||||
|
||||
16
.github/ISSUE_TEMPLATE/question.md
vendored
16
.github/ISSUE_TEMPLATE/question.md
vendored
@@ -3,18 +3,18 @@ name: "General Question"
|
||||
about: "Having trouble setting up NERDTree? Need clarification on a setting? Ask your question here."
|
||||
labels: "general question"
|
||||
---
|
||||
<!-- Attention! Please Read!
|
||||
|
||||
# Attention! Please Read!
|
||||
Please fill out ALL the information below so that the issue can be fully
|
||||
understood. Omitting information will delay the resolution of your issue. It
|
||||
will be labeled "Needs More Info", and may be closed until there is enough
|
||||
information.
|
||||
|
||||
Please fill out **ALL the information** below so that the issue can be fully understood. Omitting information will delay the resolution of your issue. It will be labeled **`Needs More Info`**, and *may* be closed until there is enough information.
|
||||
|
||||
Keep in mind that others may have the same question in the future. The better your information, the more likely they'll be able to help themselves.
|
||||
|
||||
After reading, and before submitting your issue, please remove this introductory text.
|
||||
|
||||
──────────────────── ✄ ────────────────────
|
||||
Keep in mind that others may have the same question in the future. The better
|
||||
your information, the more likely they'll be able to help themselves. -->
|
||||
|
||||
#### Self-Diagnosis
|
||||
<!-- Check the boxes after creating the issue, or use [x]. -->
|
||||
- [ ] I have searched the [issues](https://github.com/scrooloose/nerdtree/issues) for an answer to my question.
|
||||
- [ ] I have reviewed the NERDTree documentation. `:h NERDTree`
|
||||
- [ ] I have reviewed the [Wiki](https://github.com/scrooloose/nerdtree/wiki).
|
||||
|
||||
11
.github/PULL_REQUEST_TEMPLATE.md
vendored
11
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -9,12 +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), following this format/example:
|
||||
```
|
||||
#### MAJOR.MINOR...
|
||||
- **.PATCH**: PR Title (Author) [#PR Number](link to PR)
|
||||
|
||||
#### 5.1...
|
||||
- **.1**: Update Changelog and create PR Template (PhilRunninger) [#1007](https://github.com/scrooloose/nerdtree/pull/1007)
|
||||
- **.0**: Too many changes for one patch...
|
||||
```
|
||||
- [ ] 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`
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Change Log
|
||||
|
||||
#### 5.3...
|
||||
- **.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)
|
||||
#### 5.2...
|
||||
- **.9**: Suppress events for intermediate window/tab/buffer changes [#1026](https://github.com/scrooloose/nerdtree/pull/1026)
|
||||
- **.8**: Revert [#1019](https://github.com/scrooloose/nerdtree/pull/1019) to fix nvim artifacts and flickering. (PhilRunninger) [#1021](https://github.com/scrooloose/nerdtree/pull/1021)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1043,28 +1043,31 @@ window. Use one of the follow lines for this setting: >
|
||||
Values: a list of regular expressions.
|
||||
Default: ['\/$', '*', '\.swp$', '\.bak$', '\~$']
|
||||
|
||||
This setting is a list of regular expressions which are used to specify the
|
||||
order of nodes under their parent.
|
||||
This setting is a list of regular expressions which are used to group or sort
|
||||
the nodes under their parent.
|
||||
|
||||
For example, if the setting is: >
|
||||
['\.vim$', '\.c$', '\.h$', '*', 'foobar']
|
||||
<
|
||||
then all .vim files will be placed at the top, followed by all .c files then
|
||||
then all .vim files will be grouped at the top, followed by all .c files then
|
||||
all .h files. All files containing the string 'foobar' will be placed at the
|
||||
end. The star is a special flag: it tells the script that every node that
|
||||
doesn't match any of the other regexps should be placed here.
|
||||
|
||||
If no star is present in NERDTreeSortOrder then one is automatically
|
||||
appended to the array.
|
||||
If no star is present in NERDTreeSortOrder, then one is automatically
|
||||
appended to the end of the list.
|
||||
|
||||
The regex '\/$' should be used to match directory nodes.
|
||||
|
||||
A special flag can be used to sort by the modification timestamps of files and
|
||||
directories. It is either '[[timestamp]]' for ascending, or '[[-timestamp]]'
|
||||
for descending. If placed at the beginning of the list, files and directories
|
||||
are sorted by timestamp, and then by the remaining items in the sort order
|
||||
list. If this flag is in any other position of the list, timestamp sorting is
|
||||
done secondarily. See examples 4, 5, and 6 below.
|
||||
Files can also be sorted by 1) the modification timestamp, 2) the size, or 3)
|
||||
the extension. Directories are always sorted by name. To accomplish this, the
|
||||
following special flags are used:
|
||||
[[timestamp]] [[-timestamp]] [[size]] [[-size]] [[extension]]
|
||||
The hyphen specifies a descending sort; extensions are sorted in ascending
|
||||
order only. If placed at the beginning of the list, files are sorted according
|
||||
to these flags first, and then grouped by the remaining items in the list. If
|
||||
the flags are in any other position of the list, this special sorting is done
|
||||
secondarily. See examples 4, 5, and 6 below.
|
||||
|
||||
After this sorting is done, the files in each group are sorted alphabetically.
|
||||
|
||||
@@ -1072,20 +1075,20 @@ Examples: >
|
||||
(1) ['*', '\/$']
|
||||
(2) []
|
||||
(3) ['\/$', '\.rb$', '\.php$', '*', '\.swp$', '\.bak$', '\~$']
|
||||
(4) ['[[timestamp]]']
|
||||
(5) ['\/$', '*', '[[-timestamp]]']
|
||||
(6) ['\.md$', '\.c$', '[[-timestamp]]', '*']
|
||||
(4) ['[[-size]]']
|
||||
(5) ['\/$', '*', '[[timestamp]]']
|
||||
(6) ['foo','\/$','[[extension]]']
|
||||
<
|
||||
1. Directories will appear last, everything else will appear above.
|
||||
2. Everything will simply appear in alphabetical order.
|
||||
3. Dirs will appear first, then ruby and php. Swap files, bak files and vim
|
||||
backup files will appear last with everything else preceding them.
|
||||
4. All files and directories are sorted by timestamp, oldest first. If any
|
||||
files have identical timestamps, they are sorted alphabetically.
|
||||
5. Directories are first, newest to oldest, then everything else, newest to
|
||||
oldest.
|
||||
6. Markdown files first, followed by C source files, then everything else.
|
||||
Each group is shown newest to oldest.
|
||||
4. Everything is sorted by size, largest to smallest, with directories
|
||||
considered to have size 0 bytes.
|
||||
5. Directories will appear first alphabetically, followed by files, sorted by
|
||||
timestamp, oldest first.
|
||||
6. Files and directories matching 'foo' first, followed by other directories,
|
||||
then all other files. Each section of files is sorted by file extension.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDTreeStatusline*
|
||||
|
||||
@@ -52,7 +52,7 @@ function! s:NERDTree.Close()
|
||||
endif
|
||||
|
||||
call nerdtree#exec(s:NERDTree.GetWinNum() . " wincmd w", 1)
|
||||
call nerdtree#exec("close", 1)
|
||||
call nerdtree#exec("close", 0)
|
||||
if l:useWinId
|
||||
call nerdtree#exec("call win_gotoid(" . l:activeBufOrWin . ")", 0)
|
||||
else
|
||||
|
||||
@@ -380,7 +380,8 @@ endfunction
|
||||
function! s:Path.getSortOrderIndex()
|
||||
let i = 0
|
||||
while i < len(g:NERDTreeSortOrder)
|
||||
if self.getLastPathComponent(1) =~# g:NERDTreeSortOrder[i]
|
||||
if g:NERDTreeSortOrder[i] !~? '\[\[-\?\(timestamp\|size\|extension\)\]\]' &&
|
||||
\ self.getLastPathComponent(1) =~# g:NERDTreeSortOrder[i]
|
||||
return i
|
||||
endif
|
||||
let i = i + 1
|
||||
@@ -407,15 +408,26 @@ endfunction
|
||||
" FUNCTION: Path.getSortKey() {{{1
|
||||
" returns a key used in compare function for sorting
|
||||
function! s:Path.getSortKey()
|
||||
let l:ascending = index(g:NERDTreeSortOrder,'[[timestamp]]')
|
||||
let l:descending = index(g:NERDTreeSortOrder,'[[-timestamp]]')
|
||||
if !exists("self._sortKey") || g:NERDTreeSortOrder !=# g:NERDTreeOldSortOrder || l:ascending >= 0 || l:descending >= 0
|
||||
let self._sortKey = [self.getSortOrderIndex()]
|
||||
if !exists("self._sortKey") || g:NERDTreeSortOrder !=# g:NERDTreeOldSortOrder
|
||||
" Look for file metadata tags: [[timestamp]], [[extension]], [[size]]
|
||||
let metadata = []
|
||||
for tag in g:NERDTreeSortOrder
|
||||
if tag =~? '\[\[-\?timestamp\]\]'
|
||||
let metadata += [self.isDirectory ? 0 : getftime(self.str()) * (tag =~ '-' ? -1 : 1)]
|
||||
elseif tag =~? '\[\[-\?size\]\]'
|
||||
let metadata += [self.isDirectory ? 0 : getfsize(self.str()) * (tag =~ '-' ? -1 : 1)]
|
||||
elseif tag =~? '\[\[extension\]\]'
|
||||
let extension = matchstr(self.getLastPathComponent(0), '[^.]\+\.\zs[^.]\+$')
|
||||
let metadata += [self.isDirectory ? '' : (extension == '' ? nr2char(str2nr('0x10ffff',16)) : extension)]
|
||||
endif
|
||||
endfor
|
||||
|
||||
if l:descending >= 0
|
||||
call insert(self._sortKey, -getftime(self.str()), l:descending == 0 ? 0 : len(self._sortKey))
|
||||
elseif l:ascending >= 0
|
||||
call insert(self._sortKey, getftime(self.str()), l:ascending == 0 ? 0 : len(self._sortKey))
|
||||
if g:NERDTreeSortOrder[0] =~ '\[\[.*\]\]'
|
||||
" Apply tags' sorting first if specified first.
|
||||
let self._sortKey = metadata + [self.getSortOrderIndex()]
|
||||
else
|
||||
" Otherwise, do regex grouping first.
|
||||
let self._sortKey = [self.getSortOrderIndex()] + metadata
|
||||
endif
|
||||
|
||||
let path = self.getLastPathComponent(1)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user