1
0
mirror of https://github.com/amix/vimrc synced 2025-07-08 18:04:59 +08:00

Merge remote-tracking branch 'refs/remotes/upstream/master'

Conflicts:
	sources_non_forked/ale/autoload/ale.vim
	sources_non_forked/lightline.vim/doc/lightline.txt
	sources_non_forked/nerdtree/.github/PULL_REQUEST_TEMPLATE.md
	sources_non_forked/nerdtree/autoload/nerdtree.vim
	sources_non_forked/nerdtree/plugin/NERD_tree.vim
	sources_non_forked/vim-fugitive/autoload/fugitive.vim
	sources_non_forked/vim-fugitive/doc/fugitive.txt
This commit is contained in:
geezuslucifer@gmail.com
2021-02-19 08:50:18 -06:00
352 changed files with 11973 additions and 4879 deletions

View File

@ -1,5 +1,5 @@
### Description of Changes
Closes # <!-- Issue number this PR addresses. If none, remove this line. -->
Closes # <!-- Enter the issue number this PR addresses. If none, remove this line. -->
---
@ -28,5 +28,15 @@ Closes # <!-- Issue number this PR addresses. If none, remove this line. -->
- [ ] Update [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md), following the established pattern.
#### Collaborator's Instructions
- [ ] Review [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md), suggesting a different version number if necessary.
<<<<<<< HEAD
- [ ] After merge, tag the merge commit, e.g. `git tag -a 3.1.4 -m "v3.1.4" && git push origin --tags`
>>>>>>> 27ad0d07862847896f691309a544a206783c94d6
=======
- [ ] After merging, tag the commit using these (Mac-compatible) bash commands:
```bash
git checkout master
git pull
sed -n "$(grep -n -m2 '####' CHANGELOG.md | cut -f1 -d: | sed 'N;s/\n/,/')p" CHANGELOG.md | sed '$d'
git tag -a $(read -p "Tag Name: " tag;echo $tag) -m"$(git show --quiet --pretty=%s)";git push origin --tags
```
>>>>>>> master

View File

@ -125,14 +125,45 @@
- Add support for copy command in Windows (SkylerLipthay) [#231](https://github.com/scrooloose/nerdtree/pull/231)
=======
# NERDTree Change Log
<!--
Introduce a new MAJOR.MINOR version with a 4-hash header.
PATCH versions are listed from newest to oldest under their respective MAJOR.MINOR version
in an unordered list. The format is:
<!-- Introduce a new MAJOR or MINOR version with a 4-hash header.
PATCH versions are listed from newest to oldest under their respective MAJOR.MINOR
version in an unordered list. The format is:
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
-->
#### 6.9
- **.10**: Open a mirrored NERDTree with correct width (PhilRunninger) [#1177](https://github.com/preservim/nerdtree/pull/1177)
- **.9**: Updated Readme, removed typo (H3RSKO) [#1167](https://github.com/preservim/nerdtree/pull/1167)
- **.8**: Refactor sort comparison functions, removing redundancy (PhilRunninger) [#1166](https://github.com/preservim/nerdtree/pull/1166)
- **.7**: Fix argument of `exists()` function calls checking for autocommands. (PhilRunninger) [#1165](https://github.com/preservim/nerdtree/pull/1165)
- **.6**: Don't use silent when raising User events (PhilRunninger) [#1164](https://github.com/preservim/nerdtree/pull/1164)
- **.5**: Fix highlight for file node. (pirey) [#1157](https://github.com/preservim/nerdtree/pull/1157)
- **.4**: Make sure symbolic links' flags are highlighted correctly. (PhilRunninger) [#1156](https://github.com/preservim/nerdtree/pull/1156)
- **.3**: Fix new NERDTrees' width when previous one was in the only window. (PhilRunninger) [#1153](https://github.com/preservim/nerdtree/pull/1153)
- **.2**: Fix the scope of several key mappings (lifecrisis, PhilRunninger) [#1151](https://github.com/preservim/nerdtree/pull/1151)
- **.1**: Respect user's `&shellslash` setting in CopyNode and RemoveNode functions (PhilRunninger) [#1150](https://github.com/preservim/nerdtree/pull/1150)
- **.0**: Enable opening bookmarks in split windows. (PhilRunninger) [#1144](https://github.com/preservim/nerdtree/pull/1144)
#### 6.8
- **.0**: Allow concealed characters to show another character. (PhilRunninger) [#1138](https://github.com/preservim/nerdtree/pull/1138)
#### 6.7
- **.15**: Add curly braces to the list of characters to be escaped. (PhilRunninger) [#1128](https://github.com/preservim/nerdtree/pull/1128)
- **.14**: Use backward-compatible `nerdtree#and()` in one place that was missed. (PhilRunninger) [#1134](https://github.com/preservim/nerdtree/pull/1134)
- **.13**: `cmd.exe /c start "" <filename>` for windows default viewer support. (J. Altayó) [#1130](https://github.com/preservim/nerdtree/pull/1130)
- **.12**: Fixed a bug that caused the file-tree construction to slow down significantly. (Eugenij-W) [#1126](https://github.com/preservim/nerdtree/pull/1126)
- **.11**: Fix exception in NERDTreeFind (on windows OS and If the file is located in the root directory of the disk) (Eugenij-W) [#1122](https://github.com/preservim/nerdtree/pull/1122)
- **.10**: Do not consider the tree root to be "cascadable". (lifecrisis) [#1120](https://github.com/preservim/nerdtree/pull/1120)
- **.9**: Force `:NERDTreeFocus` to allow events to be fired when switching windows. (PhilRunninger) [#1118](https://github.com/preservim/nerdtree/pull/1118)
- **.8**: Fix example code for the `NERDTreeAddKeyMap()` function. (PhilRunninger) [#1116](https://github.com/preservim/nerdtree/pull/1116)
- **.7**: Put `'%'` argument in `bufname()` for backwards compatibility. (PhilRunninger) [#1105](https://github.com/preservim/nerdtree/pull/1105)
- **.6**: If a file's already open in the window, don't edit it again. (PhilRunninger) [#1103](https://github.com/preservim/nerdtree/pull/1103)
- **.5**: Prevent unneeded tree creation in `:NERDTreeToggle[VCS] <path>` (PhilRunninger) [#1101](https://github.com/preservim/nerdtree/pull/1101)
- **.4**: Add missing calls to the `shellescape()` function (lifecrisis) [#1099](https://github.com/preservim/nerdtree/pull/1099)
- **.3**: Fix vsplit to not open empty buffers when opening previously closed file (AwkwardKore) [#1098](https://github.com/preservim/nerdtree/pull/1098)
- **.2**: Fix infinity loop (on winvim) in FindParentVCSRoot (Eugenij-W) [#1095](https://github.com/preservim/nerdtree/pull/1095)
- **.1**: File Move: Escape existing directory name when looking for open files. (PhilRunninger) [#1094](https://github.com/preservim/nerdtree/pull/1094)
- **.0**: Open the parent directory when revealing a non-existent file with :NERDTreeFind (bouk) [#1090](https://github.com/preservim/nerdtree/pull/1090)
#### 6.6
- **.1**: [add] How to install using dein.vim (kazukazuinaina) [#1087](https://github.com/preservim/nerdtree/pull/1087)
- **.0**: Add the ability to turn off directory arrows (PhilRunninger) [#1085](https://github.com/preservim/nerdtree/pull/1085)
#### 6.5
- **.0**: `NERDTreeToggle <start-directory>` always sets NERDTree root. (PhilRunninger) [#1083](https://github.com/preservim/nerdtree/pull/1083)
#### 6.4

View File

@ -28,7 +28,7 @@ git clone https://github.com/preservim/nerdtree.git ~/.vim/pack/vendor/start/ner
vim -u NONE -c "helptags ~/.vim/pack/vendor/start/nerdtree/doc" -c q
```
Otherwise, these are some of the several 3rd-party plugin managers you can choose from. Be sure you read the instructions for your chosen plugin, as there typically are additional steps you nee d to take.
Otherwise, these are some of the several 3rd-party plugin managers you can choose from. Be sure you read the instructions for your chosen plugin, as there typically are additional steps you need to take.
#### [pathogen.vim](https://github.com/tpope/vim-pathogen)
@ -59,6 +59,13 @@ Plug 'preservim/nerdtree'
call plug#end()
```
#### [dein.vim](https://github.com/Shougo/dein.vim)
```vim
call dein#begin()
call dein#add('preservim/nerdtree')
call dein#end()
```
#### [apt-vim](https://github.com/egalpin/apt-vim)
```bash
apt-vim install -y https://github.com/preservim/nerdtree.git
@ -143,3 +150,8 @@ Use these variables in your vimrc. Note that below are default arrow symbols
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
```
You can remove the arrows altogether by setting these variables to empty strings, as shown below. This will remove not only the arrows, but a single space following them, shifting the whole tree two character positions to the left.
```vim
let g:NERDTreeDirArrowExpandable = ''
let g:NERDTreeDirArrowCollapsible = ''
```

View File

@ -46,6 +46,7 @@ endfunction
" SECTION: General Functions {{{1
"============================================================
<<<<<<< HEAD
<<<<<<< HEAD
function! nerdtree#slash()
=======
@ -53,6 +54,13 @@ function! nerdtree#slash()
function! nerdtree#slash() abort
>>>>>>> 27ad0d07862847896f691309a544a206783c94d6
=======
" FUNCTION: nerdtree#slash() {{{2
" Return the path separator used by the underlying file system. Special
" consideration is taken for the use of the 'shellslash' option on Windows
" systems.
function! nerdtree#slash() abort
>>>>>>> master
if nerdtree#runningWindows()
if exists('+shellslash') && &shellslash
return '/'
@ -65,7 +73,7 @@ function! nerdtree#slash() abort
endfunction
"FUNCTION: nerdtree#and(x,y) {{{2
" Implements and() function for Vim <= 7.2
" Implements and() function for Vim <= 7.4
function! nerdtree#and(x,y) abort
if exists('*and')
return and(a:x, a:y)
@ -128,15 +136,15 @@ function! nerdtree#completeBookmarks(A,L,P) abort
return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"')
endfunction
"FUNCTION: nerdtree#compareNodes(dir) {{{2
"FUNCTION: nerdtree#compareNodes(n1, n2) {{{2
function! nerdtree#compareNodes(n1, n2) abort
return a:n1.path.compareTo(a:n2.path)
return nerdtree#compareNodePaths(a:n1.path, a:n2.path)
endfunction
"FUNCTION: nerdtree#compareNodesBySortKey(n1, n2) {{{2
function! nerdtree#compareNodesBySortKey(n1, n2) abort
let sortKey1 = a:n1.path.getSortKey()
let sortKey2 = a:n2.path.getSortKey()
"FUNCTION: nerdtree#compareNodePaths(p1, p2) {{{2
function! nerdtree#compareNodePaths(p1, p2) abort
let sortKey1 = a:p1.getSortKey()
let sortKey2 = a:p2.getSortKey()
let i = 0
while i < min([len(sortKey1), len(sortKey2)])
" Compare chunks upto common length.

View File

@ -32,12 +32,16 @@ function! nerdtree#ui_glue#createDefaultBindings() abort
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Bookmark', 'callback': s.'previewBookmark' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'all', 'callback': s.'activateAll' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'Node', 'callback': s.'openHSplit' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'Node', 'callback': s.'openVSplit' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'FileNode', 'callback': s.'openHSplit' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'Bookmark', 'callback': s.'openHSplitBookmark' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'FileNode', 'callback': s.'openVSplit' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'Bookmark', 'callback': s.'openVSplitBookmark' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Node', 'callback': s.'previewNodeCurrent' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'Node', 'callback': s.'previewNodeVSplit' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'Node', 'callback': s.'previewNodeHSplit' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'FileNode', 'callback': s.'previewNodeCurrent' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'FileNode', 'callback': s.'previewNodeHSplit' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'Bookmark', 'callback': s.'previewNodeHSplitBookmark' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'FileNode', 'callback': s.'previewNodeVSplit' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'Bookmark', 'callback': s.'previewNodeVSplitBookmark' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': 'DirNode', 'callback': s.'openNodeRecursively' })
@ -314,6 +318,7 @@ endfunction
" FUNCTION: s:findAndRevealPath(pathStr) {{{1
function! s:findAndRevealPath(pathStr) abort
let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p')
let l:revealOpts = {}
if empty(l:pathStr)
call nerdtree#echoWarning('no file for the current buffer')
@ -322,6 +327,7 @@ function! s:findAndRevealPath(pathStr) abort
if !filereadable(l:pathStr)
let l:pathStr = fnamemodify(l:pathStr, ':h')
let l:revealOpts['open'] = 1
endif
try
@ -357,7 +363,7 @@ function! s:findAndRevealPath(pathStr) abort
call b:NERDTree.ui.setShowHidden(1)
endif
let l:node = b:NERDTree.root.reveal(l:pathObj)
let l:node = b:NERDTree.root.reveal(l:pathObj, l:revealOpts)
call b:NERDTree.render()
call l:node.putCursorHere(1, 0)
endfunction
@ -539,6 +545,28 @@ function! s:openVSplit(target) abort
call a:target.activate({'where': 'v'})
endfunction
"FUNCTION: s:openHSplitBookmark(bookmark) {{{1
"handle the user activating a bookmark
function! s:openHSplitBookmark(bm) abort
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'h'} : {})
endfunction
"FUNCTION: s:openVSplitBookmark(bookmark) {{{1
"handle the user activating a bookmark
function! s:openVSplitBookmark(bm) abort
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'v'} : {})
endfunction
" FUNCTION: s:previewHSplitBookmark(bookmark) {{{1
function! s:previewNodeHSplitBookmark(bookmark) abort
call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'h', 'keepopen': 1} : {})
endfunction
" FUNCTION: s:previewVSplitBookmark(bookmark) {{{1
function! s:previewNodeVSplitBookmark(bookmark) abort
call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'v', 'keepopen': 1} : {})
endfunction
" FUNCTION: s:openExplorer(node) {{{1
function! s:openExplorer(node) abort
call a:node.openExplorer()
@ -566,11 +594,7 @@ endfunction
" FUNCTION: s:previewBookmark(bookmark) {{{1
function! s:previewBookmark(bookmark) abort
if a:bookmark.path.isDirectory
execute 'NERDTreeFind '.a:bookmark.path.str()
else
call a:bookmark.activate(b:NERDTree, {'stay': 1, 'where': 'p', 'keepopen': 1})
endif
call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'h', 'keepopen': 1} : {})
endfunction
"FUNCTION: s:previewNodeCurrent(node) {{{1

View File

@ -318,9 +318,8 @@ Applies to: files.
If a file node or a bookmark that links to a file is selected, it is opened in
the previous window, but the cursor does not move.
If a bookmark that links to a directory is selected, that directory is found
in the current NERDTree. If the directory couldn't be found, a new NERDTree is
created.
If a bookmark that links to a directory is selected then that directory
becomes the new root.
The default key combo for this mapping is "g" + NERDTreeMapActivateNode (see
|NERDTree-o|).
@ -350,7 +349,7 @@ The same as |NERDTree-t| except that the focus is kept in the current tab.
*NERDTree-i*
Default key: i
Map setting: *NERDTreeMapOpenSplit*
Applies to: files.
Applies to: files, and bookmarks pointing to files.
Opens the selected file in a new split window and puts the cursor in the new
window.
@ -359,7 +358,7 @@ window.
*NERDTree-gi*
Default key: gi
Map setting: *NERDTreeMapPreviewSplit*
Applies to: files.
Applies to: files, and bookmarks pointing to files.
The same as |NERDTree-i| except that the cursor is not moved.
@ -370,7 +369,7 @@ The default key combo for this mapping is "g" + NERDTreeMapOpenSplit (see
*NERDTree-s*
Default key: s
Map setting: *NERDTreeMapOpenVSplit*
Applies to: files.
Applies to: files, and bookmarks pointing to files.
Opens the selected file in a new vertically split window and puts the cursor
in the new window.
@ -379,7 +378,7 @@ in the new window.
*NERDTree-gs*
Default key: gs
Map setting: *NERDTreeMapPreviewVSplit*
Applies to: files.
Applies to: files, and bookmarks pointing to files.
The same as |NERDTree-s| except that the cursor is not moved.
@ -1223,13 +1222,19 @@ Values: Any single character.
Defaults: Windows: ~ and + Others: ▾ and ▸
These characters indicate whether a directory is collapsible or expandable.
They can be set to "\u00a0" to hide the arrows, but if you do this you may
need to change the node delimiter. See |NERDTreeNodeDelimiter|. You cannot use
the same character for both the arrows and the delimiter. Example: >
Example: >
let NERDTreeDirArrowExpandable=">"
let NERDTreeDirArrowCollapsible="v"
<
They can be set to "\u00a0" to replace the arrows with a non-breaking space.
If you do this you may need to change the node delimiter. See
|NERDTreeNodeDelimiter|. You cannot use the same character for both the arrows
and the delimiter.
Alternatively, they can be set to '' (an empty string). This removes the
arrows and the single space that follows them, shifting the entire tree two
character positions to the left.
------------------------------------------------------------------------------
*NERDTreeNodeDelimiter*
Values: Any single character.
@ -1347,12 +1352,12 @@ NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()*
Example: >
call NERDTreeAddKeyMap({
\ 'key': 'foo',
\ 'callback': 'NERDTreeCDHandler',
\ 'callback': 'NERDTreeEchoPathHandler',
\ 'quickhelpText': 'echo full path of current node',
\ 'scope': 'DirNode' })
function! NERDTreeCDHandler(dirnode)
call a:dirnode.changeToDir()
function! NERDTreeEchoPathHandler(dirnode)
echo a:dirnode.path.str()
endfunction
<
This code should sit in a file like ~/.vim/nerdtree_plugin/mymapping.vim.

View File

@ -28,7 +28,9 @@ endfunction
" FUNCTION: s:Creator._broadcastInitEvent() {{{1
function! s:Creator._broadcastInitEvent()
silent doautocmd User NERDTreeInit
if exists('#User#NERDTreeInit')
doautocmd User NERDTreeInit
endif
endfunction
" FUNCTION: s:Creator.BufNamePrefix() {{{1
@ -170,6 +172,7 @@ function! s:Creator.createMirror()
let t:NERDTreeBufName = bufferName
call self._createTreeWin()
exec 'buffer ' . bufferName
call b:NERDTree.ui.restoreScreenState()
if !&hidden
call b:NERDTree.render()
endif
@ -247,9 +250,13 @@ function! s:Creator._pathForString(str)
"hack to get an absolute path if a relative path is given
if dir =~# '^\.'
let dir = getcwd() . g:NERDTreePath.Slash() . dir
let dir = getcwd() . nerdtree#slash() . dir
endif
"hack to prevent removing slash if dir is the root of the file system.
if dir !=# '/'
let dir = g:NERDTreePath.Resolve(dir)
endif
let dir = g:NERDTreePath.Resolve(dir)
try
let path = g:NERDTreePath.New(dir)
@ -366,7 +373,7 @@ function! s:Creator.toggleTabTree(dir)
if g:NERDTree.ExistsForTab()
if !g:NERDTree.IsOpen()
call self._createTreeWin()
if !empty(a:dir)
if !empty(a:dir) && a:dir !=# b:NERDTree.root.path.str()
call self.createTabTree(a:dir)
elseif !&hidden
call b:NERDTree.render()

View File

@ -27,7 +27,9 @@ function! s:NERDTree.changeRoot(node)
call self.render()
call self.root.putCursorHere(0, 0)
silent doautocmd User NERDTreeNewRoot
if exists('#User#NERDTreeNewRoot')
doautocmd User NERDTreeNewRoot
endif
endfunction
"FUNCTION: s:NERDTree.Close() {{{1
@ -96,9 +98,9 @@ endfunction
"FUNCTION: s:NERDTree.CursorToTreeWin(){{{1
"Places the cursor in the nerd tree window
function! s:NERDTree.CursorToTreeWin()
function! s:NERDTree.CursorToTreeWin(...)
call g:NERDTree.MustBeOpen()
call nerdtree#exec(g:NERDTree.GetWinNum() . 'wincmd w', 1)
call nerdtree#exec(g:NERDTree.GetWinNum() . 'wincmd w', a:0 >0 ? a:1 : 1)
endfunction
" Function: s:NERDTree.ExistsForBuffer() {{{1

View File

@ -174,9 +174,8 @@ function! s:Opener._newSplit()
"resize the tree window if no other window was open before
if onlyOneWin
let size = exists('b:NERDTreeOldWindowSize') ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize
call nerdtree#exec('wincmd p', 1)
call nerdtree#exec('silent '. splitMode .' resize '. size, 1)
call nerdtree#exec('silent '. splitMode .' resize '. g:NERDTreeWinSize, 1)
call nerdtree#exec('wincmd p', 0)
endif
@ -195,7 +194,7 @@ function! s:Opener._newVSplit()
endif
call nerdtree#exec('wincmd p', 1)
call nerdtree#exec('vnew', 1)
call nerdtree#exec('vsplit', 1)
let l:currentWindowNumber = winnr()
@ -219,7 +218,7 @@ endfunction
" FUNCTION: Opener._openFile() {{{1
function! s:Opener._openFile()
if !self._stay && !and(g:NERDTreeQuitOnOpen,1) && exists('b:NERDTreeZoomed') && b:NERDTreeZoomed
if !self._stay && !nerdtree#and(g:NERDTreeQuitOnOpen,1) && exists('b:NERDTreeZoomed') && b:NERDTreeZoomed
call b:NERDTree.ui.toggleZoom()
endif

View File

@ -25,10 +25,10 @@ function! s:Path.AbsolutePathFor(pathStr)
if l:prependWorkingDir
let l:result = getcwd()
if l:result[-1:] ==# s:Path.Slash()
if l:result[-1:] == nerdtree#slash()
let l:result = l:result . a:pathStr
else
let l:result = l:result . s:Path.Slash() . a:pathStr
let l:result = l:result . nerdtree#slash() . a:pathStr
endif
endif
@ -99,50 +99,6 @@ function! s:Path.changeToDir()
endtry
endfunction
" FUNCTION: Path.compareTo() {{{1
"
" Compares this Path to the given path and returns 0 if they are equal, -1 if
" this Path is 'less than' the given path, or 1 if it is 'greater'.
"
" Args:
" path: the path object to compare this to
"
" Return:
" 1, -1 or 0
function! s:Path.compareTo(path)
let thisPath = self.getLastPathComponent(1)
let thatPath = a:path.getLastPathComponent(1)
"if the paths are the same then clearly we return 0
if thisPath ==# thatPath
return 0
endif
let thisSS = self.getSortOrderIndex()
let thatSS = a:path.getSortOrderIndex()
"compare the sort sequences, if they are different then the return
"value is easy
if thisSS < thatSS
return -1
elseif thisSS > thatSS
return 1
else
if !g:NERDTreeSortHiddenFirst
let thisPath = substitute(thisPath, '^[._]', '', '')
let thatPath = substitute(thatPath, '^[._]', '', '')
endif
"if the sort sequences are the same then compare the paths
"alphabetically
let pathCompare = g:NERDTreeCaseSensitiveSort ? thisPath <# thatPath : thisPath <? thatPath
if pathCompare
return -1
else
return 1
endif
endif
endfunction
" FUNCTION: Path.Create(fullpath) {{{1
"
" Factory method.
@ -199,7 +155,7 @@ function! s:Path.copy(dest)
let cmd_prefix = (self.isDirectory ? g:NERDTreeCopyDirCmd : g:NERDTreeCopyFileCmd)
endif
let cmd = cmd_prefix . ' ' . escape(self.str(), self._escChars()) . ' ' . escape(a:dest, self._escChars())
let cmd = cmd_prefix . ' ' . shellescape(self.str()) . ' ' . shellescape(a:dest)
let success = system(cmd)
if v:shell_error !=# 0
throw "NERDTree.CopyError: Could not copy '". self.str() ."' to: '" . a:dest . "'"
@ -295,7 +251,10 @@ endfunction
" FUNCTION: Path.edit() {{{1
function! s:Path.edit()
exec 'edit ' . self.str({'format': 'Edit'})
let l:bufname = self.str({'format': 'Edit'})
if bufname('%') !=# l:bufname
exec 'edit ' . l:bufname
endif
endfunction
" FUNCTION: Path.extractDriveLetter(fullpath) {{{1
@ -329,7 +288,7 @@ function! s:Path._escChars()
return " `\|\"#%&,?()\*^<>$"
endif
return " \\`\|\"#%&,?()\*^<>[]$"
return " \\`\|\"#%&,?()\*^<>[]{}$"
endfunction
" FUNCTION: Path.getDir() {{{1
@ -543,26 +502,36 @@ endfunction
" return 1 if this path is somewhere above the given path in the filesystem.
"
" a:path should be a dir
function! s:Path.isAncestor(path)
if !self.isDirectory
return 0
endif
let this = self.str()
let that = a:path.str()
return stridx(that, this) ==# 0
function! s:Path.isAncestor(child)
return a:child.isUnder(self)
endfunction
" FUNCTION: Path.isUnder(path) {{{1
" return 1 if this path is somewhere under the given path in the filesystem.
function! s:Path.isUnder(path)
if a:path.isDirectory ==# 0
function! s:Path.isUnder(parent)
if a:parent.isDirectory ==# 0
return 0
endif
let this = self.str()
let that = a:path.str()
return stridx(this, that . s:Path.Slash()) ==# 0
if nerdtree#runningWindows() && a:parent.drive !=# self.drive
return 0
endif
let l:this_count = len(self.pathSegments)
if l:this_count ==# 0
return 0
endif
let l:that_count = len(a:parent.pathSegments)
if l:that_count ==# 0
return 1
endif
if l:that_count >= l:this_count
return 0
endif
for i in range(0, l:that_count-1)
if self.pathSegments[i] !=# a:parent.pathSegments[i]
return 0
endif
endfor
return 1
endfunction
" FUNCTION: Path.JoinPathStrings(...) {{{1
@ -601,23 +570,6 @@ function! s:Path.New(pathStr)
return l:newPath
endfunction
" FUNCTION: Path.Slash() {{{1
" Return the path separator used by the underlying file system. Special
" consideration is taken for the use of the 'shellslash' option on Windows
" systems.
function! s:Path.Slash()
if nerdtree#runningWindows()
if exists('+shellslash') && &shellslash
return '/'
endif
return '\'
endif
return '/'
endfunction
" FUNCTION: Path.Resolve() {{{1
" Invoke the vim resolve() function and return the result
" This is necessary because in some versions of vim resolve() removes trailing
@ -802,7 +754,7 @@ function! s:Path._strForEdit()
" On Windows, the drive letter may be removed by "fnamemodify()". Add it
" back, if necessary.
if nerdtree#runningWindows() && l:result[0] ==# s:Path.Slash()
if nerdtree#runningWindows() && l:result[0] == nerdtree#slash()
let l:result = self.drive . l:result
endif
@ -817,14 +769,14 @@ endfunction
" FUNCTION: Path._strForGlob() {{{1
function! s:Path._strForGlob()
let lead = s:Path.Slash()
let lead = nerdtree#slash()
"if we are running windows then slap a drive letter on the front
if nerdtree#runningWindows()
let lead = self.drive . '\'
endif
let toReturn = lead . join(self.pathSegments, s:Path.Slash())
let toReturn = lead . join(self.pathSegments, nerdtree#slash())
if !nerdtree#runningWindows()
let toReturn = escape(toReturn, self._escChars())
@ -836,7 +788,7 @@ endfunction
" Return the absolute pathname associated with this Path object. The pathname
" returned is appropriate for the underlying file system.
function! s:Path._str()
let l:separator = s:Path.Slash()
let l:separator = nerdtree#slash()
let l:leader = l:separator
if nerdtree#runningWindows()

View File

@ -104,16 +104,11 @@ function! s:TreeDirNode.displayString()
endfor
" Select the appropriate open/closed status indicator symbol.
if l:cascade[-1].isOpen
let l:symbol = g:NERDTreeDirArrowCollapsible
else
let l:symbol = g:NERDTreeDirArrowExpandable
endif
let l:symbol = (l:cascade[-1].isOpen ? g:NERDTreeDirArrowCollapsible : g:NERDTreeDirArrowExpandable )
let l:symbol .= (g:NERDTreeDirArrowExpandable ==# '' ? '' : ' ')
let l:flags = l:cascade[-1].path.flagSet.renderToString()
let l:result = l:symbol . ' ' . l:flags . l:label
return l:result
return l:symbol . l:flags . l:label
endfunction
" FUNCTION: TreeDirNode.findNode(path) {{{1
@ -241,7 +236,7 @@ function! s:TreeDirNode.getChildIndex(path)
let z = self.getChildCount()
while a < z
let mid = (a+z)/2
let diff = a:path.compareTo(self.children[mid].path)
let diff = nerdtree#compareNodePaths(a:path, self.children[mid].path)
if diff ==# -1
let z = mid
@ -283,8 +278,8 @@ function! s:TreeDirNode._glob(pattern, all)
else
let l:pathSpec = escape(fnamemodify(self.path.str({'format': 'Glob'}), ':.'), ',')
" On Windows, the drive letter may be removed by fnamemodify().
if nerdtree#runningWindows() && l:pathSpec[0] ==# g:NERDTreePath.Slash()
" On Windows, the drive letter may be removed by "fnamemodify()".
if nerdtree#runningWindows() && l:pathSpec[0] == nerdtree#slash()
let l:pathSpec = self.path.drive . l:pathSpec
endif
endif
@ -382,11 +377,17 @@ endfunction
" 1. If cascaded, we don't know which dir is bookmarked or is a symlink.
" 2. If the parent is a symlink or is bookmarked, you end up with unparsable
" text, and NERDTree cannot get the path of any child node.
" Also, return false if this directory is the tree root, which should never be
" part of a cascade.
function! s:TreeDirNode.isCascadable()
if g:NERDTreeCascadeSingleChildDir ==# 0
return 0
endif
if self.isRoot()
return 0
endif
if self.path.isSymLink
return 0
endif
@ -430,6 +431,7 @@ function! s:TreeDirNode._initChildren(silent)
endtry
endfor
let g:NERDTreeOldSortOrder = g:NERDTreeSortOrder
call self.sortChildren()
call nerdtree#echo('')
@ -672,7 +674,7 @@ function! s:TreeDirNode.sortChildren()
if count(g:NERDTreeSortOrder, '*') < 1
call add(g:NERDTreeSortOrder, '*')
endif
let CompareFunc = function('nerdtree#compareNodesBySortKey')
let CompareFunc = function('nerdtree#compareNodes')
call sort(self.children, CompareFunc)
let g:NERDTreeOldSortOrder = g:NERDTreeSortOrder
endfunction

View File

@ -321,13 +321,9 @@ function! s:TreeFileNode._renderToString(depth, drawText)
if a:drawText ==# 1
let treeParts = repeat(' ', a:depth - 1)
if !self.path.isDirectory
let treeParts = treeParts . ' '
endif
let treeParts .= (self.path.isDirectory || g:NERDTreeDirArrowExpandable ==# '' ? '' : ' ')
let line = treeParts . self.displayString()
let output = output . line . "\n"
endif

View File

@ -99,6 +99,10 @@ function! s:UI._dumpHelp()
let help .= '" '. g:NERDTreeMapPreview .": find dir in tree\n"
let help .= '" '. g:NERDTreeMapOpenInTab.": open in new tab\n"
let help .= '" '. g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
let help .= '" '. g:NERDTreeMapOpenSplit .": open split\n"
let help .= '" '. g:NERDTreeMapPreviewSplit .": preview split\n"
let help .= '" '. g:NERDTreeMapOpenVSplit .": open vsplit\n"
let help .= '" '. g:NERDTreeMapPreviewVSplit .": preview vsplit\n"
let help .= '" '. g:NERDTreeMapCustomOpen .": custom open\n"
let help .= '" '. g:NERDTreeMapDeleteBookmark .": delete bookmark\n"
>>>>>>> 27ad0d07862847896f691309a544a206783c94d6
@ -317,7 +321,11 @@ endfunction
function! s:UI._indentLevelFor(line)
" Replace multi-character DirArrows with a single space so the
" indentation calculation doesn't get messed up.
let l:line = substitute(substitute(a:line, '\V'.g:NERDTreeDirArrowExpandable, ' ', ''), '\V'.g:NERDTreeDirArrowCollapsible, ' ', '')
if g:NERDTreeDirArrowExpandable ==# ''
let l:line = ' '.a:line
else
let l:line = substitute(substitute(a:line, '\V'.g:NERDTreeDirArrowExpandable, ' ', ''), '\V'.g:NERDTreeDirArrowCollapsible, ' ', '')
endif
let leadChars = match(l:line, '\M\[^ ]')
return leadChars / s:UI.IndentWid()
endfunction
@ -393,7 +401,7 @@ function! s:UI.saveScreenState()
call g:NERDTree.CursorToTreeWin()
let self._screenState['oldPos'] = getpos('.')
let self._screenState['oldTopLine'] = line('w0')
let self._screenState['oldWindowSize']= winwidth('')
let self._screenState['oldWindowSize'] = winnr('$')==1 ? g:NERDTreeWinSize : winwidth('')
call nerdtree#exec(win . 'wincmd w', 1)
catch
endtry
@ -541,8 +549,7 @@ endfunction
" zoom (maximize/minimize) the NERDTree window
function! s:UI.toggleZoom()
if exists('b:NERDTreeZoomed') && b:NERDTreeZoomed
let size = exists('b:NERDTreeOldWindowSize') ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize
call nerdtree#exec('silent vertical resize '. size, 1)
call nerdtree#exec('silent vertical resize '. g:NERDTreeWinSize, 1)
let b:NERDTreeZoomed = 0
else
call nerdtree#exec('vertical resize '. get(g:, 'NERDTreeWinSizeMax', ''), 1)

View File

@ -34,6 +34,10 @@ if executable('xdg-open')
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileLinux'})
endif
if nerdtree#runningWindows()
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileWindows'})
endif
if g:NERDTreePath.CopyingSupported()
call NERDTreeAddMenuItem({'text': '(c)opy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'})
endif
@ -165,7 +169,7 @@ endfunction
function! NERDTreeAddNode()
let curDirNode = g:NERDTreeDirNode.GetSelected()
let prompt = s:inputPrompt('add')
let newNodeName = input(prompt, curDirNode.path.str() . g:NERDTreePath.Slash(), 'file')
let newNodeName = input(prompt, curDirNode.path.str() . nerdtree#slash(), 'file')
if newNodeName ==# ''
call nerdtree#echo('Node Creation Aborted.')
@ -213,7 +217,8 @@ function! NERDTreeMoveNode()
try
if curNode.path.isDirectory
let l:openBuffers = filter(range(1,bufnr('$')),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") =~# curNode.path.str() . "/.*"')
let l:curPath = escape(curNode.path.str(),'\') . (nerdtree#runningWindows()?'\\':'/') . '.*'
let l:openBuffers = filter(range(1,bufnr('$')),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") =~# "'.escape(l:curPath,'\').'"')
else
let l:openBuffers = filter(range(1,bufnr('$')),'bufexists(v:val) && fnamemodify(bufname(v:val),":p") ==# curNode.path.str()')
endif
@ -251,8 +256,6 @@ endfunction
" FUNCTION: NERDTreeDeleteNode() {{{1
function! NERDTreeDeleteNode()
let l:shellslash = &shellslash
let &shellslash = 0
let currentNode = g:NERDTreeFileNode.GetSelected()
let confirmed = 0
@ -288,7 +291,6 @@ function! NERDTreeDeleteNode()
else
call nerdtree#echo('delete aborted')
endif
let &shellslash = l:shellslash
endfunction
" FUNCTION: NERDTreeListNode() {{{1
@ -333,8 +335,6 @@ endfunction
" FUNCTION: NERDTreeCopyNode() {{{1
function! NERDTreeCopyNode()
let l:shellslash = &shellslash
let &shellslash = 0
let currentNode = g:NERDTreeFileNode.GetSelected()
let prompt = s:inputPrompt('copy')
let newNodePath = input(prompt, currentNode.path.str(), 'file')
@ -370,7 +370,6 @@ function! NERDTreeCopyNode()
else
call nerdtree#echo('Copy aborted.')
endif
let &shellslash = l:shellslash
redraw!
endfunction
@ -399,44 +398,78 @@ endfunction
" FUNCTION: NERDTreeQuickLook() {{{1
function! NERDTreeQuickLook()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode !=# {}
call system("qlmanage -p 2>/dev/null '" . treenode.path.str() . "'")
let l:node = g:NERDTreeFileNode.GetSelected()
if empty(l:node)
return
endif
call system('qlmanage -p 2>/dev/null ' . shellescape(l:node.path.str()))
endfunction
" FUNCTION: NERDTreeRevealInFinder() {{{1
function! NERDTreeRevealInFinder()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode !=# {}
call system("open -R '" . treenode.path.str() . "'")
let l:node = g:NERDTreeFileNode.GetSelected()
if empty(l:node)
return
endif
call system('open -R ' . shellescape(l:node.path.str()))
endfunction
" FUNCTION: NERDTreeExecuteFile() {{{1
function! NERDTreeExecuteFile()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode !=# {}
call system("open '" . treenode.path.str() . "'")
let l:node = g:NERDTreeFileNode.GetSelected()
if empty(l:node)
return
endif
call system('open ' . shellescape(l:node.path.str()))
endfunction
" FUNCTION: NERDTreeRevealFileLinux() {{{1
function! NERDTreeRevealFileLinux()
let treenode = g:NERDTreeFileNode.GetSelected()
let parentnode = treenode.parent
if parentnode !=# {}
call system("xdg-open '" . parentnode.path.str() . "' &")
let l:node = g:NERDTreeFileNode.GetSelected()
if empty(l:node)
return
endif
" Handle the edge case of "/", which has no parent.
if l:node.path.str() ==# '/'
call system('xdg-open /')
return
endif
if empty(l:node.parent)
return
endif
call system('xdg-open ' . shellescape(l:node.parent.path.str()))
endfunction
" FUNCTION: NERDTreeExecuteFileLinux() {{{1
function! NERDTreeExecuteFileLinux()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode !=# {}
call system("xdg-open '" . treenode.path.str() . "' &")
let l:node = g:NERDTreeFileNode.GetSelected()
if empty(l:node)
return
endif
call system('xdg-open ' . shellescape(l:node.path.str()))
endfunction
" FUNCTION: NERDTreeExecuteFileWindows() {{{1
function! NERDTreeExecuteFileWindows()
let l:node = g:NERDTreeFileNode.GetSelected()
if empty(l:node)
return
endif
call system('cmd.exe /c start "" ' . shellescape(l:node.path.str()))
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -34,7 +34,7 @@ endfunction
function! s:FindParentVCSRoot(path)
let l:path = a:path
while !empty(l:path) &&
\ l:path._str() !~# '^\(\a:\\\|\/\)$' &&
\ l:path._str() !~# '^\(\a:[\\\/]\|\/\)$' &&
\ !isdirectory(l:path._str() . '/.git') &&
\ !isdirectory(l:path._str() . '/.svn') &&
\ !isdirectory(l:path._str() . '/.hg') &&
@ -42,6 +42,6 @@ function! s:FindParentVCSRoot(path)
\ !isdirectory(l:path._str() . '/_darcs')
let l:path = l:path.getParent()
endwhile
return (empty(l:path) || l:path._str() =~# '^\(\a:\\\|\/\)$') ? a:path : l:path
return (empty(l:path) || l:path._str() =~# '^\(\a:[\\\/]\|\/\)$') ? a:path : l:path
endfunction

View File

@ -26,105 +26,79 @@ let loaded_nerd_tree = 1
let s:old_cpo = &cpoptions
set cpoptions&vim
"Function: s:initVariable() function {{{2
"This function is used to initialise a given variable to a given value. The
"variable is only initialised if it does not exist prior
"
"Args:
"var: the name of the var to be initialised
"value: the value to initialise var to
"
"Returns:
"1 if the var is set, 0 otherwise
function! s:initVariable(var, value)
if !exists(a:var)
exec 'let ' . a:var . ' = ' . "'" . substitute(a:value, "'", "''", 'g') . "'"
return 1
endif
return 0
endfunction
"SECTION: Init variable calls and other random constants {{{2
call s:initVariable('g:NERDTreeAutoCenter', 1)
call s:initVariable('g:NERDTreeAutoCenterThreshold', 3)
call s:initVariable('g:NERDTreeCaseSensitiveSort', 0)
call s:initVariable('g:NERDTreeNaturalSort', 0)
call s:initVariable('g:NERDTreeSortHiddenFirst', 1)
call s:initVariable('g:NERDTreeUseTCD', 0)
call s:initVariable('g:NERDTreeChDirMode', 0)
call s:initVariable('g:NERDTreeCreatePrefix', 'silent')
call s:initVariable('g:NERDTreeMinimalUI', 0)
call s:initVariable('g:NERDTreeMinimalMenu', 0)
if !exists('g:NERDTreeIgnore')
let g:NERDTreeIgnore = ['\~$']
endif
call s:initVariable('g:NERDTreeBookmarksFile', expand('$HOME') . '/.NERDTreeBookmarks')
call s:initVariable('g:NERDTreeBookmarksSort', 1)
call s:initVariable('g:NERDTreeHighlightCursorline', 1)
call s:initVariable('g:NERDTreeHijackNetrw', 1)
call s:initVariable('g:NERDTreeMarkBookmarks', 1)
call s:initVariable('g:NERDTreeMouseMode', 1)
call s:initVariable('g:NERDTreeNotificationThreshold', 100)
call s:initVariable('g:NERDTreeQuitOnOpen', 0)
call s:initVariable('g:NERDTreeRespectWildIgnore', 0)
call s:initVariable('g:NERDTreeShowBookmarks', 0)
call s:initVariable('g:NERDTreeShowFiles', 1)
call s:initVariable('g:NERDTreeShowHidden', 0)
call s:initVariable('g:NERDTreeShowLineNumbers', 0)
call s:initVariable('g:NERDTreeSortDirs', 1)
"SECTION: Initialize variable calls and other random constants {{{2
let g:NERDTreeAutoCenter = get(g:, 'NERDTreeAutoCenter', 1)
let g:NERDTreeAutoCenterThreshold = get(g:, 'NERDTreeAutoCenterThreshold', 3)
let g:NERDTreeCaseSensitiveSort = get(g:, 'NERDTreeCaseSensitiveSort', 0)
let g:NERDTreeNaturalSort = get(g:, 'NERDTreeNaturalSort', 0)
let g:NERDTreeSortHiddenFirst = get(g:, 'NERDTreeSortHiddenFirst', 1)
let g:NERDTreeUseTCD = get(g:, 'NERDTreeUseTCD', 0)
let g:NERDTreeChDirMode = get(g:, 'NERDTreeChDirMode', 0)
let g:NERDTreeCreatePrefix = get(g:, 'NERDTreeCreatePrefix', 'silent')
let g:NERDTreeMinimalUI = get(g:, 'NERDTreeMinimalUI', 0)
let g:NERDTreeMinimalMenu = get(g:, 'NERDTreeMinimalMenu', 0)
let g:NERDTreeIgnore = get(g:, 'NERDTreeIgnore', ['\~$'])
let g:NERDTreeBookmarksFile = get(g:, 'NERDTreeBookmarksFile', expand('$HOME') . '/.NERDTreeBookmarks')
let g:NERDTreeBookmarksSort = get(g:, 'NERDTreeBookmarksSort', 1)
let g:NERDTreeHighlightCursorline = get(g:, 'NERDTreeHighlightCursorline', 1)
let g:NERDTreeHijackNetrw = get(g:, 'NERDTreeHijackNetrw', 1)
let g:NERDTreeMarkBookmarks = get(g:, 'NERDTreeMarkBookmarks', 1)
let g:NERDTreeMouseMode = get(g:, 'NERDTreeMouseMode', 1)
let g:NERDTreeNotificationThreshold = get(g:, 'NERDTreeNotificationThreshold', 100)
let g:NERDTreeQuitOnOpen = get(g:, 'NERDTreeQuitOnOpen', 0)
let g:NERDTreeRespectWildIgnore = get(g:, 'NERDTreeRespectWildIgnore', 0)
let g:NERDTreeShowBookmarks = get(g:, 'NERDTreeShowBookmarks', 0)
let g:NERDTreeShowFiles = get(g:, 'NERDTreeShowFiles', 1)
let g:NERDTreeShowHidden = get(g:, 'NERDTreeShowHidden', 0)
let g:NERDTreeShowLineNumbers = get(g:, 'NERDTreeShowLineNumbers', 0)
let g:NERDTreeSortDirs = get(g:, 'NERDTreeSortDirs', 1)
if !nerdtree#runningWindows() && !nerdtree#runningCygwin()
call s:initVariable('g:NERDTreeDirArrowExpandable', '▸')
call s:initVariable('g:NERDTreeDirArrowCollapsible', '▾')
let g:NERDTreeDirArrowExpandable = get(g:, 'NERDTreeDirArrowExpandable', '▸')
let g:NERDTreeDirArrowCollapsible = get(g:, 'NERDTreeDirArrowCollapsible', '▾')
else
call s:initVariable('g:NERDTreeDirArrowExpandable', '+')
call s:initVariable('g:NERDTreeDirArrowCollapsible', '~')
let g:NERDTreeDirArrowExpandable = get(g:, 'NERDTreeDirArrowExpandable', '+')
let g:NERDTreeDirArrowCollapsible = get(g:, 'NERDTreeDirArrowCollapsible', '~')
endif
call s:initVariable('g:NERDTreeCascadeOpenSingleChildDir', 1)
call s:initVariable('g:NERDTreeCascadeSingleChildDir', 1)
let g:NERDTreeCascadeOpenSingleChildDir = get(g:, 'NERDTreeCascadeOpenSingleChildDir', 1)
let g:NERDTreeCascadeSingleChildDir = get(g:, 'NERDTreeCascadeSingleChildDir', 1)
if !exists('g:NERDTreeSortOrder')
let g:NERDTreeSortOrder = ['\/$', '*', '\.swp$', '\.bak$', '\~$']
endif
let g:NERDTreeSortOrder = get(g:, 'NERDTreeSortOrder', ['\/$', '*', '\.swp$', '\.bak$', '\~$'])
let g:NERDTreeOldSortOrder = []
call s:initVariable('g:NERDTreeGlyphReadOnly', 'RO')
let g:NERDTreeGlyphReadOnly = get(g:, 'NERDTreeGlyphReadOnly', 'RO')
if has('conceal')
call s:initVariable('g:NERDTreeNodeDelimiter', "\x07")
let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\x07")
elseif (g:NERDTreeDirArrowExpandable ==# "\u00a0" || g:NERDTreeDirArrowCollapsible ==# "\u00a0")
call s:initVariable('g:NERDTreeNodeDelimiter', "\u00b7")
let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\u00b7")
else
call s:initVariable('g:NERDTreeNodeDelimiter', "\u00a0")
let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\u00a0")
endif
if !exists('g:NERDTreeStatusline')
"the exists() crap here is a hack to stop vim spazzing out when
"loading a session that was created with an open nerd tree. It spazzes
"because it doesnt store b:NERDTree(its a b: var, and its a hash)
let g:NERDTreeStatusline = get(g:, 'NERDTreeStatusline', "%{exists('b:NERDTree')?b:NERDTree.root.path.str():''}")
"the exists() crap here is a hack to stop vim spazzing out when
"loading a session that was created with an open nerd tree. It spazzes
"because it doesnt store b:NERDTree(its a b: var, and its a hash)
let g:NERDTreeStatusline = "%{exists('b:NERDTree')?b:NERDTree.root.path.str():''}"
endif
call s:initVariable('g:NERDTreeWinPos', 'left')
call s:initVariable('g:NERDTreeWinSize', 31)
let g:NERDTreeWinPos = get(g:, 'NERDTreeWinPos', 'left')
let g:NERDTreeWinSize = get(g:, 'NERDTreeWinSize', 31)
"init the shell commands that will be used to copy nodes, and remove dir trees
"
"Note: the space after the command is important
if nerdtree#runningWindows()
call s:initVariable('g:NERDTreeRemoveDirCmd', 'rmdir /s /q ')
call s:initVariable('g:NERDTreeCopyDirCmd', 'xcopy /s /e /i /y /q ')
call s:initVariable('g:NERDTreeCopyFileCmd', 'copy /y ')
let g:NERDTreeRemoveDirCmd = get(g:, 'NERDTreeRemoveDirCmd', 'rmdir /s /q ')
let g:NERDTreeCopyDirCmd = get(g:, 'NERDTreeCopyDirCmd', 'xcopy /s /e /i /y /q ')
let g:NERDTreeCopyFileCmd = get(g:, 'NERDTreeCopyFileCmd', 'copy /y ')
else
call s:initVariable('g:NERDTreeRemoveDirCmd', 'rm -rf ')
call s:initVariable('g:NERDTreeCopyCmd', 'cp -r ')
let g:NERDTreeRemoveDirCmd = get(g:, 'NERDTreeRemoveDirCmd', 'rm -rf ')
let g:NERDTreeCopyCmd = get(g:, 'NERDTreeCopyCmd', 'cp -r ')
endif
"SECTION: Init variable calls for key mappings {{{2
<<<<<<< HEAD
<<<<<<< HEAD
call s:initVariable("g:NERDTreeMapCustomOpen", "<CR>")
call s:initVariable("g:NERDTreeMapActivateNode", "o")
call s:initVariable("g:NERDTreeMapChangeRoot", "C")
@ -201,6 +175,45 @@ call s:initVariable('g:NERDTreeMapCWD', 'CD')
call s:initVariable('g:NERDTreeMenuDown', 'j')
call s:initVariable('g:NERDTreeMenuUp', 'k')
>>>>>>> 27ad0d07862847896f691309a544a206783c94d6
=======
let g:NERDTreeMapCustomOpen = get(g:, 'NERDTreeMapCustomOpen', '<CR>')
let g:NERDTreeMapActivateNode = get(g:, 'NERDTreeMapActivateNode', 'o')
let g:NERDTreeMapChangeRoot = get(g:, 'NERDTreeMapChangeRoot', 'C')
let g:NERDTreeMapChdir = get(g:, 'NERDTreeMapChdir', 'cd')
let g:NERDTreeMapCloseChildren = get(g:, 'NERDTreeMapCloseChildren', 'X')
let g:NERDTreeMapCloseDir = get(g:, 'NERDTreeMapCloseDir', 'x')
let g:NERDTreeMapDeleteBookmark = get(g:, 'NERDTreeMapDeleteBookmark', 'D')
let g:NERDTreeMapMenu = get(g:, 'NERDTreeMapMenu', 'm')
let g:NERDTreeMapHelp = get(g:, 'NERDTreeMapHelp', '?')
let g:NERDTreeMapJumpFirstChild = get(g:, 'NERDTreeMapJumpFirstChild', 'K')
let g:NERDTreeMapJumpLastChild = get(g:, 'NERDTreeMapJumpLastChild', 'J')
let g:NERDTreeMapJumpNextSibling = get(g:, 'NERDTreeMapJumpNextSibling', '<C-j>')
let g:NERDTreeMapJumpParent = get(g:, 'NERDTreeMapJumpParent', 'p')
let g:NERDTreeMapJumpPrevSibling = get(g:, 'NERDTreeMapJumpPrevSibling', '<C-k>')
let g:NERDTreeMapJumpRoot = get(g:, 'NERDTreeMapJumpRoot', 'P')
let g:NERDTreeMapOpenExpl = get(g:, 'NERDTreeMapOpenExpl', 'e')
let g:NERDTreeMapOpenInTab = get(g:, 'NERDTreeMapOpenInTab', 't')
let g:NERDTreeMapOpenInTabSilent = get(g:, 'NERDTreeMapOpenInTabSilent', 'T')
let g:NERDTreeMapOpenRecursively = get(g:, 'NERDTreeMapOpenRecursively', 'O')
let g:NERDTreeMapOpenSplit = get(g:, 'NERDTreeMapOpenSplit', 'i')
let g:NERDTreeMapOpenVSplit = get(g:, 'NERDTreeMapOpenVSplit', 's')
let g:NERDTreeMapPreview = get(g:, 'NERDTreeMapPreview', 'g'.NERDTreeMapActivateNode)
let g:NERDTreeMapPreviewSplit = get(g:, 'NERDTreeMapPreviewSplit', 'g'.NERDTreeMapOpenSplit)
let g:NERDTreeMapPreviewVSplit = get(g:, 'NERDTreeMapPreviewVSplit', 'g'.NERDTreeMapOpenVSplit)
let g:NERDTreeMapQuit = get(g:, 'NERDTreeMapQuit', 'q')
let g:NERDTreeMapRefresh = get(g:, 'NERDTreeMapRefresh', 'r')
let g:NERDTreeMapRefreshRoot = get(g:, 'NERDTreeMapRefreshRoot', 'R')
let g:NERDTreeMapToggleBookmarks = get(g:, 'NERDTreeMapToggleBookmarks', 'B')
let g:NERDTreeMapToggleFiles = get(g:, 'NERDTreeMapToggleFiles', 'F')
let g:NERDTreeMapToggleFilters = get(g:, 'NERDTreeMapToggleFilters', 'f')
let g:NERDTreeMapToggleHidden = get(g:, 'NERDTreeMapToggleHidden', 'I')
let g:NERDTreeMapToggleZoom = get(g:, 'NERDTreeMapToggleZoom', 'A')
let g:NERDTreeMapUpdir = get(g:, 'NERDTreeMapUpdir', 'u')
let g:NERDTreeMapUpdirKeepOpen = get(g:, 'NERDTreeMapUpdirKeepOpen', 'U')
let g:NERDTreeMapCWD = get(g:, 'NERDTreeMapCWD', 'CD')
let g:NERDTreeMenuDown = get(g:, 'NERDTreeMenuDown', 'j')
let g:NERDTreeMenuUp = get(g:, 'NERDTreeMenuUp', 'k')
>>>>>>> master
"SECTION: Load class files{{{2
call nerdtree#loadClassFiles()
@ -257,7 +270,7 @@ endfunction
function! NERDTreeFocus()
if g:NERDTree.IsOpen()
call g:NERDTree.CursorToTreeWin()
call g:NERDTree.CursorToTreeWin(0)
else
call g:NERDTreeCreator.ToggleTabTree('')
endif

View File

@ -19,32 +19,36 @@ syn match NERDTreeLinkTarget #->.*# containedin=NERDTreeDir,NERDTreeFile
syn match NERDTreeLinkFile #.* ->#me=e-3 containedin=NERDTreeFile
syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir
"highlighing for directory nodes and file nodes
syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
exec 'syn match NERDTreeClosable #' . escape(g:NERDTreeDirArrowCollapsible, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
syn match NERDTreeExecFile '^ .*\*\($\| \)' contains=NERDTreeRO,NERDTreeBookmark
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
"highlighting for readonly files
exec 'syn match NERDTreeRO # *\zs.*\ze \['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
syn match NERDTreeFlags #^ *\zs\[[^\]]*\]# containedin=NERDTreeFile,NERDTreeExecFile
syn match NERDTreeFlags #\[[^\]]*\]# containedin=NERDTreeDir
"highlighing to conceal the delimiter around the file/dir name
"highlighting to conceal the delimiter around the file/dir name
if has('conceal')
exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# conceal containedin=ALL'
setlocal conceallevel=3 concealcursor=nvic
setlocal conceallevel=2 concealcursor=nvic
else
exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# containedin=ALL'
hi! link NERDTreeNodeDelimiters Ignore
endif
"highlighing for directory nodes and file nodes
syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
if g:NERDTreeDirArrowExpandable !=# ''
exec 'syn match NERDTreeClosable #' . escape(g:NERDTreeDirArrowCollapsible, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
exec 'syn match NERDTreeExecFile #^.*'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark'
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
else
exec 'syn match NERDTreeDir #[^'.g:NERDTreeNodeDelimiter.']\{-}/\ze\($\|'.g:NERDTreeNodeDelimiter.'\)#'
exec 'syn match NERDTreeExecFile #[^'.g:NERDTreeNodeDelimiter.']\{-}'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark'
exec 'syn match NERDTreeFile #^.*'.g:NERDTreeNodeDelimiter.'.*[^\/]\($\|'.g:NERDTreeNodeDelimiter.'.*\)# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
endif
"highlighting for readonly files
exec 'syn match NERDTreeRO #.*'.g:NERDTreeNodeDelimiter.'\zs.*\ze'.g:NERDTreeNodeDelimiter.'.*\['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
exec 'syn match NERDTreeFlags #\[[^\]]*\]\ze'.g:NERDTreeNodeDelimiter.'# containedin=NERDTreeFile,NERDTreeExecFile,NERDTreeLinkFile,NERDTreeRO,NERDTreeDir'
syn match NERDTreeCWD #^[</].*$#
"highlighting for bookmarks
@ -89,3 +93,5 @@ hi def link NERDTreeBookmark Statement
hi def link NERDTreeFlags Number
hi def link NERDTreeCurrentNode Search
hi NERDTreeFile ctermbg=NONE guibg=NONE