mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-09 11:53:48 -05:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9310f91476 | ||
|
|
e731b84559 | ||
|
|
7eee457efa | ||
|
|
aa7e97b7ff | ||
|
|
e5f24e2b8b | ||
|
|
0e71462f90 | ||
|
|
2c14ed0e15 |
2
.github/ISSUE_TEMPLATE/question.md
vendored
2
.github/ISSUE_TEMPLATE/question.md
vendored
@@ -6,7 +6,7 @@ labels: "general question"
|
|||||||
Before creating an issue, take some time to search these resources. It's possible that someone else has already asked your question and gotten an answer.
|
Before creating an issue, take some time to search these resources. It's possible that someone else has already asked your question and gotten an answer.
|
||||||
- [old NERDTree issues](https://github.com/preservim/nerdtree/issues?q=is%3Aissue)
|
- [old NERDTree issues](https://github.com/preservim/nerdtree/issues?q=is%3Aissue)
|
||||||
- NERDTree documentation - `:h NERDTree`
|
- NERDTree documentation - `:h NERDTree`
|
||||||
- [NERDTree Wiki](https://github.com/scrooloose/nerdtree/wiki)
|
- [NERDTree Wiki](https://github.com/preservim/nerdtree/wiki)
|
||||||
- Other resource: <https://stackoverflow.com>, <https://vi.stackexchange.com>, etc.
|
- Other resource: <https://stackoverflow.com>, <https://vi.stackexchange.com>, etc.
|
||||||
|
|
||||||
#### State Your Question
|
#### State Your Question
|
||||||
|
|||||||
@@ -5,6 +5,12 @@
|
|||||||
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
||||||
-->
|
-->
|
||||||
#### 6.10
|
#### 6.10
|
||||||
|
- **.16**: Fix documentation errors. (lifecrisis) [#1269](https://github.com/preservim/nerdtree/pull/1269)
|
||||||
|
- **.15**: Ensure backward compatible testing of types. (lifecrisis) [#1266](https://github.com/preservim/nerdtree/pull/1266)
|
||||||
|
- **.14**: Replace trim() with a version-compatible alternative. (PhilRunninger) [#1265](https://github.com/preservim/nerdtree/pull/1265)
|
||||||
|
- **.13**: Change highlighting of bookmarks in the tree. (PhilRunninger) [#1261](https://github.com/preservim/nerdtree/pull/1261)
|
||||||
|
- **.12**: Answer the question about accessing files over scp or ftp. (PhilRunninger) [#1259](https://github.com/preservim/nerdtree/pull/1259)
|
||||||
|
- **.11**: Trim filenames created via the fs_menu (elanorigby) [#1243](https://github.com/preservim/nerdtree/pull/1243)
|
||||||
- **.10**: Improve F.A.Q. Answers and Issue Templates (PhilRunninger) [#1249](https://github.com/preservim/nerdtree/pull/1249)
|
- **.10**: Improve F.A.Q. Answers and Issue Templates (PhilRunninger) [#1249](https://github.com/preservim/nerdtree/pull/1249)
|
||||||
- **.9**: `go` on a bookmark directory will NERDTreeFind it. (PhilRunninger) [#1236](https://github.com/preservim/nerdtree/pull/1236)
|
- **.9**: `go` on a bookmark directory will NERDTreeFind it. (PhilRunninger) [#1236](https://github.com/preservim/nerdtree/pull/1236)
|
||||||
- **.8**: Put `Callback` function variables in local scope. (PhilRunninger) [#1230](https://github.com/preservim/nerdtree/pull/1230)
|
- **.8**: Put `Callback` function variables in local scope. (PhilRunninger) [#1230](https://github.com/preservim/nerdtree/pull/1230)
|
||||||
|
|||||||
@@ -187,3 +187,35 @@ let g:NERDTreeDirArrowExpandable = '▸'
|
|||||||
let g:NERDTreeDirArrowCollapsible = '▾'
|
let g:NERDTreeDirArrowCollapsible = '▾'
|
||||||
```
|
```
|
||||||
The preceding values are the non-Windows default arrow symbols. Setting these variables to empty strings will remove the arrows completely and shift the entire tree two character positions to the left. See `:h NERDTreeDirArrowExpandable` for more details.
|
The preceding values are the non-Windows default arrow symbols. Setting these variables to empty strings will remove the arrows completely and shift the entire tree two character positions to the left. See `:h NERDTreeDirArrowExpandable` for more details.
|
||||||
|
|
||||||
|
### Can NERDTree access remote files via scp or ftp?
|
||||||
|
|
||||||
|
Short answer: No, and there are no plans to add that functionality. However, Vim ships with a plugin that does just that. It's called netrw, and by adding the following lines to your `.vimrc`, you can use it to open files over the `scp:`, `ftp:`, or other protocols, while still using NERDTree for all local files. The function seamlessly makes the decision to open NERDTree or netrw, and other supported protocols can be added to the regular expression.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
" Function to open the file or NERDTree or netrw.
|
||||||
|
" Returns: 1 if either file explorer was opened; otherwise, 0.
|
||||||
|
function! s:OpenFileOrExplorer(...)
|
||||||
|
if a:0 == 0 || a:1 == ''
|
||||||
|
NERDTree
|
||||||
|
elseif filereadable(a:1)
|
||||||
|
execute 'edit '.a:1
|
||||||
|
return 0
|
||||||
|
elseif a:1 =~? '^\(scp\|ftp\)://' " Add other protocols as needed.
|
||||||
|
execute 'Vexplore '.a:1
|
||||||
|
elseif isdirectory(a:1)
|
||||||
|
execute 'NERDTree '.a:1
|
||||||
|
endif
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Auto commands to handle OS commandline arguments
|
||||||
|
autocmd StdinReadPre * let s:std_in=1
|
||||||
|
autocmd VimEnter * if argc()==1 && !exists('s:std_in') | if <SID>OpenFileOrExplorer(argv()[0]) | wincmd p | enew | wincmd p | endif | endif
|
||||||
|
|
||||||
|
" Command to call the OpenFileOrExplorer function.
|
||||||
|
command! -n=? -complete=file -bar Edit :call <SID>OpenFileOrExplorer('<args>')
|
||||||
|
|
||||||
|
" Command-mode abbreviation to replace the :edit Vim command.
|
||||||
|
cnoreabbrev e Edit
|
||||||
|
```
|
||||||
|
|||||||
@@ -112,18 +112,18 @@ function! nerdtree#compareNodePaths(p1, p2) abort
|
|||||||
" Compare chunks upto common length.
|
" Compare chunks upto common length.
|
||||||
" If chunks have different type, the one which has
|
" If chunks have different type, the one which has
|
||||||
" integer type is the lesser.
|
" integer type is the lesser.
|
||||||
if type(sortKey1[i]) ==# type(sortKey2[i])
|
if type(sortKey1[i]) == type(sortKey2[i])
|
||||||
if sortKey1[i] <# sortKey2[i]
|
if sortKey1[i] <# sortKey2[i]
|
||||||
return - 1
|
return - 1
|
||||||
elseif sortKey1[i] ># sortKey2[i]
|
elseif sortKey1[i] ># sortKey2[i]
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
elseif type(sortKey1[i]) ==# v:t_number
|
elseif type(sortKey1[i]) == type(0)
|
||||||
return -1
|
return -1
|
||||||
elseif type(sortKey2[i]) ==# v:t_number
|
elseif type(sortKey2[i]) == type(0)
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
let i = i + 1
|
let i += 1
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" Keys are identical upto common length.
|
" Keys are identical upto common length.
|
||||||
|
|||||||
@@ -1256,10 +1256,10 @@ responsible pull request: https://github.com/preservim/nerdtree/pull/868.
|
|||||||
The default value of this variable depends on the features compiled into your
|
The default value of this variable depends on the features compiled into your
|
||||||
vim and the values of |NERDTreeDirArrowCollapsible| and
|
vim and the values of |NERDTreeDirArrowCollapsible| and
|
||||||
|NERDTreeDirArrowExpandable|.
|
|NERDTreeDirArrowExpandable|.
|
||||||
* If your vim is compiled with the +conceal feature, it is the "\x07" (BELL)
|
* If your vim is compiled with the +conceal feature, it is the "\x07"
|
||||||
character, and it is hidden by setting 'conceallevel' to 3. If you use
|
(BEL) character, and it is hidden by setting 'conceallevel' to 2. If you
|
||||||
autocommands, make sure none of them change that setting in the NERDTree_*
|
use autocommands, make sure none of them change that setting in the
|
||||||
buffers.
|
NERD_Tree_* buffers.
|
||||||
* If your vim does NOT have the +conceal feature and you're using "\u00a0"
|
* If your vim does NOT have the +conceal feature and you're using "\u00a0"
|
||||||
(non-breaking space) to hide the directory arrows, "\u00b7" (middle dot)
|
(non-breaking space) to hide the directory arrows, "\u00b7" (middle dot)
|
||||||
is used as the default delimiter.
|
is used as the default delimiter.
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ endfunction
|
|||||||
function! NERDTreeAddNode()
|
function! NERDTreeAddNode()
|
||||||
let curDirNode = g:NERDTreeDirNode.GetSelected()
|
let curDirNode = g:NERDTreeDirNode.GetSelected()
|
||||||
let prompt = s:inputPrompt('add')
|
let prompt = s:inputPrompt('add')
|
||||||
let newNodeName = input(prompt, curDirNode.path.str() . nerdtree#slash(), 'file')
|
let newNodeName = substitute(input(prompt, curDirNode.path.str() . nerdtree#slash(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
|
||||||
|
|
||||||
if newNodeName ==# ''
|
if newNodeName ==# ''
|
||||||
call nerdtree#echo('Node Creation Aborted.')
|
call nerdtree#echo('Node Creation Aborted.')
|
||||||
@@ -206,7 +206,7 @@ function! NERDTreeMoveNode()
|
|||||||
let newNodePath = input(prompt, curNode.path.str(), 'file')
|
let newNodePath = input(prompt, curNode.path.str(), 'file')
|
||||||
while filereadable(newNodePath)
|
while filereadable(newNodePath)
|
||||||
call nerdtree#echoWarning('This destination already exists. Try again.')
|
call nerdtree#echoWarning('This destination already exists. Try again.')
|
||||||
let newNodePath = input(prompt, curNode.path.str(), 'file')
|
let newNodePath = substitute(input(prompt, curNode.path.str(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
|
|
||||||
@@ -337,7 +337,7 @@ endfunction
|
|||||||
function! NERDTreeCopyNode()
|
function! NERDTreeCopyNode()
|
||||||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||||
let prompt = s:inputPrompt('copy')
|
let prompt = s:inputPrompt('copy')
|
||||||
let newNodePath = input(prompt, currentNode.path.str(), 'file')
|
let newNodePath = substitute(input(prompt, currentNode.path.str(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
|
||||||
|
|
||||||
if newNodePath !=# ''
|
if newNodePath !=# ''
|
||||||
"strip trailing slash
|
"strip trailing slash
|
||||||
|
|||||||
@@ -36,23 +36,23 @@ if g:NERDTreeDirArrowExpandable !=# ''
|
|||||||
exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
|
exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
|
||||||
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
|
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
|
||||||
exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
|
exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
|
||||||
exec 'syn match NERDTreeExecFile #^.*'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark'
|
exec 'syn match NERDTreeExecFile #^.*'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmarkName'
|
||||||
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
|
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmarkName,NERDTreeExecFile'
|
||||||
else
|
else
|
||||||
exec 'syn match NERDTreeDir #[^'.g:NERDTreeNodeDelimiter.']\{-}/\ze\($\|'.g:NERDTreeNodeDelimiter.'\)#'
|
exec 'syn match NERDTreeDir #[^'.g:NERDTreeNodeDelimiter.']\{-}/\ze\($\|'.g:NERDTreeNodeDelimiter.'\)#'
|
||||||
exec 'syn match NERDTreeExecFile #[^'.g:NERDTreeNodeDelimiter.']\{-}'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark'
|
exec 'syn match NERDTreeExecFile #[^'.g:NERDTreeNodeDelimiter.']\{-}'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmarkName'
|
||||||
exec 'syn match NERDTreeFile #^.*'.g:NERDTreeNodeDelimiter.'.*[^\/]\($\|'.g:NERDTreeNodeDelimiter.'.*\)# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
|
exec 'syn match NERDTreeFile #^.*'.g:NERDTreeNodeDelimiter.'.*[^\/]\($\|'.g:NERDTreeNodeDelimiter.'.*\)# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmarkName,NERDTreeExecFile'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"highlighting for readonly files
|
"highlighting for readonly files
|
||||||
exec 'syn match NERDTreeRO #.*'.g:NERDTreeNodeDelimiter.'\zs.*\ze'.g:NERDTreeNodeDelimiter.'.*\['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
|
exec 'syn match NERDTreeRO #.*'.g:NERDTreeNodeDelimiter.'\zs.*\ze'.g:NERDTreeNodeDelimiter.'.*\['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmarkName,NERDTreeFile'
|
||||||
|
|
||||||
exec 'syn match NERDTreeFlags #\[[^\]]*\]\ze'.g:NERDTreeNodeDelimiter.'# containedin=NERDTreeFile,NERDTreeExecFile,NERDTreeLinkFile,NERDTreeRO,NERDTreeDir'
|
exec 'syn match NERDTreeFlags #\[[^\]]*\]\ze'.g:NERDTreeNodeDelimiter.'# containedin=NERDTreeFile,NERDTreeExecFile,NERDTreeLinkFile,NERDTreeRO,NERDTreeDir'
|
||||||
|
|
||||||
syn match NERDTreeCWD #^[</].*$#
|
syn match NERDTreeCWD #^[</].*$#
|
||||||
|
|
||||||
"highlighting for bookmarks
|
"highlighting for bookmarks
|
||||||
syn match NERDTreeBookmark # {.*}#hs=s+1
|
syn match NERDTreeBookmarkName # {.*}#hs=s+2,he=e-1
|
||||||
|
|
||||||
"highlighting for the bookmarks table
|
"highlighting for the bookmarks table
|
||||||
syn match NERDTreeBookmarksLeader #^>#
|
syn match NERDTreeBookmarksLeader #^>#
|
||||||
|
|||||||
Reference in New Issue
Block a user