mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
371feb7e54 | ||
|
|
4245517689 | ||
|
|
926ff0ec03 | ||
|
|
53eef21ad6 | ||
|
|
4fe24d3156 | ||
|
|
2d639b70e7 | ||
|
|
6318406f66 | ||
|
|
496b61ead1 | ||
|
|
5af6859846 | ||
|
|
bd744eab8d |
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -5,9 +5,12 @@ Closes # <!-- Issue number this PR addresses. If none, remove this line. -->
|
|||||||
---
|
---
|
||||||
### New Version Info
|
### New Version Info
|
||||||
|
|
||||||
- [ ] Derive a new version number. Increment the:
|
#### Author's Instructions
|
||||||
- [ ] `MAJOR` version when you make incompatible API changes
|
- [ ] Derive a new `MAJOR.MINOR.PATCH` version number. Increment the:
|
||||||
- [ ] `MINOR` version when you add functionality in a backwards-compatible manner
|
- `MAJOR` version when you make incompatible API changes
|
||||||
- [ ] `PATCH` version when you make backwards-compatible bug fixes
|
- `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 the established pattern.
|
- [ ] 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`
|
#### Collaborator's Instructions
|
||||||
|
- [ ] Review [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md), suggesting a different version number if necessary.
|
||||||
|
- [ ] After merge, tag the merge commit, e.g. `git tag -a 3.1.4 -m "v3.1.4" && git push origin --tags`
|
||||||
|
|||||||
41
CHANGELOG.md
41
CHANGELOG.md
@@ -1,22 +1,41 @@
|
|||||||
# Change Log
|
# NERDTree Change Log
|
||||||
|
|
||||||
#### 5.3...
|
<!--
|
||||||
- **.3**: Fix (p)ath not displaying in the minimal menu [#1038](https://github.com/scrooloose/nerdtree/pull/1038)
|
Introduce a new MAJOR.MINOR version with a 4-hash header.
|
||||||
- **.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)
|
PATCH versions are listed from newest to oldest under their respective MAJOR.MINOR version
|
||||||
- **.0**: Add file extension and size to sorting capabilities [#1029](https://github.com/scrooloose/nerdtree/pull/1029)
|
in an unordered list. The format is:
|
||||||
#### 5.2...
|
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
||||||
- **.9**: Suppress events for intermediate window/tab/buffer changes [#1026](https://github.com/scrooloose/nerdtree/pull/1026)
|
-->
|
||||||
|
|
||||||
|
#### 6.2
|
||||||
|
- **.0**: Support tab-specific CWDs (PhilRunninger) [#1032](https://github.com/scrooloose/nerdtree/pull/1032)
|
||||||
|
#### 6.1
|
||||||
|
- **.4**: Add VIM built-in package management to read me file. (pesarkhobeee) [#1049](https://github.com/scrooloose/nerdtree/pull/1049)
|
||||||
|
- **.3**: Save/Set screen state also on WinLeave and WinEnter. (PhilRunninger) [#1048](https://github.com/scrooloose/nerdtree/pull/1048)
|
||||||
|
- **.2**: Wrap saveScreenState's statements in a try-catch block. (PhilRunninger) [#1047](https://github.com/scrooloose/nerdtree/pull/1047)
|
||||||
|
- **.1**: Catch errors when trying to read CHANGELOG.md. (PhilRunninger) [#1045](https://github.com/scrooloose/nerdtree/pull/1045)
|
||||||
|
- **.0**: If file path doesn't exist, :NERDTreeFind its parent directory instead. (PhilRunninger) [#1043](https://github.com/scrooloose/nerdtree/pull/1043)
|
||||||
|
#### 6.0
|
||||||
|
- **.1**: Reintroduce necessary variable mistakenly removed. (PhilRunninger) [#1040](https://github.com/scrooloose/nerdtree/pull/1040)
|
||||||
|
- **.0**: Make the behavior of window splits consistent (dragonxlwang, PhilRunninger) [#1035](https://github.com/scrooloose/nerdtree/pull/1035)
|
||||||
|
#### 5.3
|
||||||
|
- **.3**: Fix (p)ath not displaying in the minimal menu (tuzz) [#1038](https://github.com/scrooloose/nerdtree/pull/1038)
|
||||||
|
- **.2**: Enable events when closing NerdTree window. (PhilRunninger) [#1037](https://github.com/scrooloose/nerdtree/pull/1037)
|
||||||
|
- **.1**: Fix the `e` key mapping to use netrw if desired (PhilRunninger) [#1031](https://github.com/scrooloose/nerdtree/pull/1031)
|
||||||
|
- **.0**: Add file extension and size to sorting capabilities (PhilRunninger) [#1029](https://github.com/scrooloose/nerdtree/pull/1029)
|
||||||
|
#### 5.2
|
||||||
|
- **.9**: Suppress events for intermediate window/tab/buffer changes (PhilRunninger) [#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)
|
- **.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)
|
||||||
- **.7**: Use :mode only in neovim. MacVim still needs to use :redraw! [#1019](https://github.com/scrooloose/nerdtree/pull/1019)
|
- **.7**: Use :mode only in neovim. MacVim still needs to use :redraw! (PhilRunninger) [#1019](https://github.com/scrooloose/nerdtree/pull/1019)
|
||||||
- **.6**: In CHANGELOG.md and PR template, make reference to PR a true HTML link. [#1017](https://github.com/scrooloose/nerdtree/pull/1017)
|
- **.6**: In CHANGELOG.md and PR template, make reference to PR a true HTML link. (PhilRunninger) [#1017](https://github.com/scrooloose/nerdtree/pull/1017)
|
||||||
- **.5**: Use `:mode` instead of `:redraw!` when updating menu. (PhilRunninger) [#1016](https://github.com/scrooloose/nerdtree/pull/1016)
|
- **.5**: Use `:mode` instead of `:redraw!` when updating menu. (PhilRunninger) [#1016](https://github.com/scrooloose/nerdtree/pull/1016)
|
||||||
- **.4**: When searching for root line num, stop at end of file. (PhilRunninger) [#1015](https://github.com/scrooloose/nerdtree/pull/1015)
|
- **.4**: When searching for root line num, stop at end of file. (PhilRunninger) [#1015](https://github.com/scrooloose/nerdtree/pull/1015)
|
||||||
- **.3**: Fix `<CR>` key map on the bookmark (lkebin) [#1014](https://github.com/scrooloose/nerdtree/pull/1014)
|
- **.3**: Fix `<CR>` key map on the bookmark (lkebin) [#1014](https://github.com/scrooloose/nerdtree/pull/1014)
|
||||||
- **.2**: Make Enter work on the `.. ( up a dir )` line (PhilRunninger) [#1013](https://github.com/scrooloose/nerdtree/pull/1013)
|
- **.2**: Make Enter work on the `.. ( up a dir )` line (PhilRunninger) [#1013](https://github.com/scrooloose/nerdtree/pull/1013)
|
||||||
- **.1**: Fix nerdtree#version() on Windows. (PhilRunninger)
|
- **.1**: Fix nerdtree#version() on Windows. (PhilRunninger)
|
||||||
- **.0**: Expand functionality of `<CR>` mapping. (PhilRunninger) [#1011](https://github.com/scrooloose/nerdtree/pull/1011)
|
- **.0**: Expand functionality of `<CR>` mapping. (PhilRunninger) [#1011](https://github.com/scrooloose/nerdtree/pull/1011)
|
||||||
#### 5.1...
|
#### 5.1
|
||||||
- **.3**: Remove @mentions from PR template and change log. They weren't working. (PhilRunninger) [#1009](https://github.com/scrooloose/nerdtree/pull/1009)
|
- **.3**: Remove @mentions from PR template and change log. They weren't working. (PhilRunninger) [#1009](https://github.com/scrooloose/nerdtree/pull/1009)
|
||||||
- **.2**: Fix NERDTree opening with the wrong size. (PhilRunninger) [#1008](https://github.com/scrooloose/nerdtree/pull/1008)
|
- **.2**: Fix NERDTree opening with the wrong size. (PhilRunninger) [#1008](https://github.com/scrooloose/nerdtree/pull/1008)
|
||||||
- **.1**: Update Changelog and create PR Template (PhilRunninger) [#1007](https://github.com/scrooloose/nerdtree/pull/1007)
|
- **.1**: Update Changelog and create PR Template (PhilRunninger) [#1007](https://github.com/scrooloose/nerdtree/pull/1007)
|
||||||
|
|||||||
@@ -17,6 +17,13 @@ included documentation.
|
|||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
If you are using VIM version 8 or higher you can use its built-in package management; see `:help packages` for more information. Just run these commands in your terminal:
|
||||||
|
|
||||||
|
git clone https://github.com/scrooloose/nerdtree.git ~/.vim/pack/vendor/start/nerdtree
|
||||||
|
vim -u NONE -c "helptags ~/.vim/pack/vendor/start/nerdtree/doc" -c q
|
||||||
|
|
||||||
|
Otherwise, these are some of the other options:
|
||||||
|
|
||||||
#### [pathogen.vim](https://github.com/tpope/vim-pathogen)
|
#### [pathogen.vim](https://github.com/tpope/vim-pathogen)
|
||||||
|
|
||||||
git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree
|
git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree
|
||||||
|
|||||||
@@ -4,24 +4,33 @@ endif
|
|||||||
let g:loaded_nerdtree_autoload = 1
|
let g:loaded_nerdtree_autoload = 1
|
||||||
|
|
||||||
let s:rootNERDTreePath = resolve(expand("<sfile>:p:h:h"))
|
let s:rootNERDTreePath = resolve(expand("<sfile>:p:h:h"))
|
||||||
|
|
||||||
|
"FUNCTION: nerdtree#version(...) {{{1
|
||||||
|
" If any value is given as an argument, the entire line of text from the
|
||||||
|
" change log is shown for the current version; otherwise, only the version
|
||||||
|
" number is shown.
|
||||||
function! nerdtree#version(...)
|
function! nerdtree#version(...)
|
||||||
let l:changelog = readfile(join([s:rootNERDTreePath, "CHANGELOG.md"], nerdtree#slash()))
|
|
||||||
let l:text = 'Unknown'
|
let l:text = 'Unknown'
|
||||||
let l:line = 0
|
try
|
||||||
while l:line <= len(l:changelog)
|
let l:changelog = readfile(join([s:rootNERDTreePath, "CHANGELOG.md"], nerdtree#slash()))
|
||||||
if l:changelog[l:line] =~ '\d\+\.\d\+'
|
let l:line = 0
|
||||||
let l:text = substitute(l:changelog[l:line], '.*\(\d\+.\d\+\).*', '\1', '')
|
while l:line <= len(l:changelog)
|
||||||
let l:text .= substitute(l:changelog[l:line+1], '^.\{-}\(\.\d\+\).\{-}:\(.*\)', a:0>0 ? '\1:\2' : '\1', '')
|
if l:changelog[l:line] =~ '\d\+\.\d\+'
|
||||||
break
|
let l:text = substitute(l:changelog[l:line], '.*\(\d\+.\d\+\).*', '\1', '')
|
||||||
endif
|
let l:text .= substitute(l:changelog[l:line+1], '^.\{-}\(\.\d\+\).\{-}:\(.*\)', a:0>0 ? '\1:\2' : '\1', '')
|
||||||
let l:line += 1
|
break
|
||||||
endwhile
|
endif
|
||||||
|
let l:line += 1
|
||||||
|
endwhile
|
||||||
|
catch
|
||||||
|
endtry
|
||||||
return l:text
|
return l:text
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" SECTION: General Functions {{{1
|
" SECTION: General Functions {{{1
|
||||||
"============================================================
|
"============================================================
|
||||||
|
|
||||||
|
"FUNCTION: nerdtree#slash() {{{2
|
||||||
function! nerdtree#slash()
|
function! nerdtree#slash()
|
||||||
|
|
||||||
if nerdtree#runningWindows()
|
if nerdtree#runningWindows()
|
||||||
@@ -49,7 +58,6 @@ function! nerdtree#and(x,y)
|
|||||||
if (l:x % 2) && (l:y % 2)
|
if (l:x % 2) && (l:y % 2)
|
||||||
let l:result += float2nr(pow(2, l:n))
|
let l:result += float2nr(pow(2, l:n))
|
||||||
endif
|
endif
|
||||||
echomsg l:x . ", " . l:y . " => " l:result
|
|
||||||
let l:x = float2nr(l:x / 2)
|
let l:x = float2nr(l:x / 2)
|
||||||
let l:y = float2nr(l:y / 2)
|
let l:y = float2nr(l:y / 2)
|
||||||
let l:n += 1
|
let l:n += 1
|
||||||
|
|||||||
@@ -284,6 +284,9 @@ endfunction
|
|||||||
" FUNCTION: s:findAndRevealPath(pathStr) {{{1
|
" FUNCTION: s:findAndRevealPath(pathStr) {{{1
|
||||||
function! s:findAndRevealPath(pathStr)
|
function! s:findAndRevealPath(pathStr)
|
||||||
let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p')
|
let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p')
|
||||||
|
if !filereadable(l:pathStr)
|
||||||
|
let l:pathStr = fnamemodify(l:pathStr, ':h')
|
||||||
|
endif
|
||||||
|
|
||||||
if empty(l:pathStr)
|
if empty(l:pathStr)
|
||||||
call nerdtree#echoWarning('no file for the current buffer')
|
call nerdtree#echoWarning('no file for the current buffer')
|
||||||
|
|||||||
@@ -849,9 +849,17 @@ above nodes would then be sorted like this: >
|
|||||||
z110.txt
|
z110.txt
|
||||||
<
|
<
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTreeChDirMode*
|
*NERDTreeUseTCD*
|
||||||
|
Values: 0 or 1.
|
||||||
|
Default: 0.
|
||||||
|
|
||||||
Values: 0, 1 or 2.
|
By default, NERDTree will use the `:cd` command to change the current working
|
||||||
|
directory. If this setting is turned on, and the `:tcd` command is available, it
|
||||||
|
will be used instead.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*NERDTreeChDirMode*
|
||||||
|
Values: 0, 1, 2, or 3.
|
||||||
Default: 0.
|
Default: 0.
|
||||||
|
|
||||||
Use this setting to tell the script when (if at all) to change the current
|
Use this setting to tell the script when (if at all) to change the current
|
||||||
@@ -871,6 +879,9 @@ the CWD is changed whenever the tree root is changed. For example, if the CWD
|
|||||||
is /home/marty/foobar and you make the node for /home/marty/foobar/baz the new
|
is /home/marty/foobar and you make the node for /home/marty/foobar/baz the new
|
||||||
root then the CWD will become /home/marty/foobar/baz.
|
root then the CWD will become /home/marty/foobar/baz.
|
||||||
|
|
||||||
|
If the set to 3, then it behaves the same as if set to 2, and the CWD is
|
||||||
|
changed whenever changing tabs to whatever the tree root is on that tab.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTreeHighlightCursorline*
|
*NERDTreeHighlightCursorline*
|
||||||
Values: 0 or 1.
|
Values: 0 or 1.
|
||||||
@@ -980,7 +991,6 @@ then (to single click activate it) you must click somewhere in
|
|||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTreeQuitOnOpen*
|
*NERDTreeQuitOnOpen*
|
||||||
|
|
||||||
Values: 0,1,2 or 3.
|
Values: 0,1,2 or 3.
|
||||||
Default: 0
|
Default: 0
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ function! s:NERDTree.changeRoot(node)
|
|||||||
call self.root.open()
|
call self.root.open()
|
||||||
|
|
||||||
"change dir to the dir of the new root if instructed to
|
"change dir to the dir of the new root if instructed to
|
||||||
if g:NERDTreeChDirMode ==# 2
|
if g:NERDTreeChDirMode >= 2
|
||||||
call self.root.path.changeToDir()
|
call self.root.path.changeToDir()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -148,12 +148,19 @@ function! s:NERDTree.GetWinNum()
|
|||||||
return bufwinnr(t:NERDTreeBufName)
|
return bufwinnr(t:NERDTreeBufName)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" If WindowTree, there is no t:NERDTreeBufName variable. Search all windows.
|
||||||
|
for w in range(1,winnr('$'))
|
||||||
|
if bufname(winbufnr(w)) =~# '^' . g:NERDTreeCreator.BufNamePrefix() . '\d\+$'
|
||||||
|
return w
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
return -1
|
return -1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:NERDTree.IsOpen() {{{1
|
"FUNCTION: s:NERDTree.IsOpen() {{{1
|
||||||
function! s:NERDTree.IsOpen()
|
function! s:NERDTree.IsOpen()
|
||||||
return s:NERDTree.GetWinNum() != -1 || bufname('%') =~# '^' . g:NERDTreeCreator.BufNamePrefix() . '\d\+$'
|
return s:NERDTree.GetWinNum() != -1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:NERDTree.isTabTree() {{{1
|
"FUNCTION: s:NERDTree.isTabTree() {{{1
|
||||||
|
|||||||
@@ -71,9 +71,9 @@ endfunction
|
|||||||
function! s:Opener._gotoTargetWin()
|
function! s:Opener._gotoTargetWin()
|
||||||
if b:NERDTree.isWinTree()
|
if b:NERDTree.isWinTree()
|
||||||
if self._where == 'v'
|
if self._where == 'v'
|
||||||
vsplit
|
call self._newVSplit()
|
||||||
elseif self._where == 'h'
|
elseif self._where == 'h'
|
||||||
split
|
call self._newSplit()
|
||||||
elseif self._where == 't'
|
elseif self._where == 't'
|
||||||
tabnew
|
tabnew
|
||||||
endif
|
endif
|
||||||
@@ -153,44 +153,18 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: Opener._newSplit() {{{1
|
" FUNCTION: Opener._newSplit() {{{1
|
||||||
function! s:Opener._newSplit()
|
function! s:Opener._newSplit()
|
||||||
" Save the user's settings for splitbelow and splitright
|
|
||||||
let savesplitbelow=&splitbelow
|
|
||||||
let savesplitright=&splitright
|
|
||||||
|
|
||||||
" 'there' will be set to a command to move from the split window
|
|
||||||
" back to the explorer window
|
|
||||||
"
|
|
||||||
" 'back' will be set to a command to move from the explorer window
|
|
||||||
" back to the newly split window
|
|
||||||
"
|
|
||||||
" 'right' and 'below' will be set to the settings needed for
|
|
||||||
" splitbelow and splitright IF the explorer is the only window.
|
|
||||||
"
|
|
||||||
let there= g:NERDTreeWinPos ==# "left" ? "wincmd h" : "wincmd l"
|
|
||||||
let back = g:NERDTreeWinPos ==# "left" ? "wincmd l" : "wincmd h"
|
|
||||||
let right= g:NERDTreeWinPos ==# "left"
|
|
||||||
let below=0
|
|
||||||
|
|
||||||
" Attempt to go to adjacent window
|
|
||||||
call nerdtree#exec(back, 1)
|
|
||||||
|
|
||||||
let onlyOneWin = (winnr("$") ==# 1)
|
let onlyOneWin = (winnr("$") ==# 1)
|
||||||
|
let savesplitright = &splitright
|
||||||
" If no adjacent window, set splitright and splitbelow appropriately
|
|
||||||
if onlyOneWin
|
if onlyOneWin
|
||||||
let &splitright=right
|
let &splitright = (g:NERDTreeWinPos ==# "left")
|
||||||
let &splitbelow=below
|
|
||||||
else
|
|
||||||
" found adjacent window - invert split direction
|
|
||||||
let &splitright=!right
|
|
||||||
let &splitbelow=!below
|
|
||||||
endif
|
endif
|
||||||
|
" If only one window (ie. NERDTree), split vertically instead.
|
||||||
let splitMode = onlyOneWin ? "vertical" : ""
|
let splitMode = onlyOneWin ? "vertical" : ""
|
||||||
|
|
||||||
" Open the new window
|
" Open the new window
|
||||||
try
|
try
|
||||||
exec(splitMode." sp ")
|
call nerdtree#exec('wincmd p', 1)
|
||||||
|
call nerdtree#exec(splitMode . " split",1)
|
||||||
catch /^Vim\%((\a\+)\)\=:E37/
|
catch /^Vim\%((\a\+)\)\=:E37/
|
||||||
call g:NERDTree.CursorToTreeWin()
|
call g:NERDTree.CursorToTreeWin()
|
||||||
throw "NERDTree.FileAlreadyOpenAndModifiedError: ". self._path.str() ." is already open and modified."
|
throw "NERDTree.FileAlreadyOpenAndModifiedError: ". self._path.str() ." is already open and modified."
|
||||||
@@ -200,14 +174,12 @@ function! s:Opener._newSplit()
|
|||||||
|
|
||||||
"resize the tree window if no other window was open before
|
"resize the tree window if no other window was open before
|
||||||
if onlyOneWin
|
if onlyOneWin
|
||||||
let size = exists("b:NERDTreeOldWindowSize") ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize
|
let size = exists('b:NERDTreeOldWindowSize') ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize
|
||||||
call nerdtree#exec(there, 1)
|
call nerdtree#exec('wincmd p', 1)
|
||||||
exec("silent ". splitMode ." resize ". size)
|
call nerdtree#exec('silent '. splitMode .' resize '. size, 1)
|
||||||
call nerdtree#exec('wincmd p', 0)
|
call nerdtree#exec('wincmd p', 0)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Restore splitmode settings
|
|
||||||
let &splitbelow=savesplitbelow
|
|
||||||
let &splitright=savesplitright
|
let &splitright=savesplitright
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -215,7 +187,10 @@ endfunction
|
|||||||
function! s:Opener._newVSplit()
|
function! s:Opener._newVSplit()
|
||||||
let l:winwidth = winwidth('.')
|
let l:winwidth = winwidth('.')
|
||||||
|
|
||||||
if winnr('$') == 1
|
let onlyOneWin = (winnr("$") ==# 1)
|
||||||
|
let savesplitright = &splitright
|
||||||
|
if onlyOneWin
|
||||||
|
let &splitright = (g:NERDTreeWinPos ==# "left")
|
||||||
let l:winwidth = g:NERDTreeWinSize
|
let l:winwidth = g:NERDTreeWinSize
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -229,6 +204,7 @@ function! s:Opener._newVSplit()
|
|||||||
execute 'silent vertical resize ' . l:winwidth
|
execute 'silent vertical resize ' . l:winwidth
|
||||||
|
|
||||||
call nerdtree#exec(l:currentWindowNumber . 'wincmd w', 0)
|
call nerdtree#exec(l:currentWindowNumber . 'wincmd w', 0)
|
||||||
|
let &splitright=savesplitright
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Opener.open(target) {{{1
|
" FUNCTION: Opener.open(target) {{{1
|
||||||
|
|||||||
@@ -87,8 +87,13 @@ function! s:Path.changeToDir()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
try
|
try
|
||||||
execute "cd " . dir
|
if g:NERDTreeUseTCD && exists(":tcd") == 2
|
||||||
call nerdtree#echo("CWD is now: " . getcwd())
|
execute "tcd " . dir
|
||||||
|
call nerdtree#echo("Tab's CWD is now: " . getcwd())
|
||||||
|
else
|
||||||
|
execute "cd " . dir
|
||||||
|
call nerdtree#echo("CWD is now: " . getcwd())
|
||||||
|
endif
|
||||||
catch
|
catch
|
||||||
throw "NERDTree.PathChangeError: cannot change CWD to " . dir
|
throw "NERDTree.PathChangeError: cannot change CWD to " . dir
|
||||||
endtry
|
endtry
|
||||||
|
|||||||
@@ -355,12 +355,15 @@ endfunction
|
|||||||
" scroll position
|
" scroll position
|
||||||
function! s:UI.saveScreenState()
|
function! s:UI.saveScreenState()
|
||||||
let win = winnr()
|
let win = winnr()
|
||||||
call g:NERDTree.CursorToTreeWin()
|
|
||||||
let self._screenState = {}
|
let self._screenState = {}
|
||||||
let self._screenState['oldPos'] = getpos(".")
|
try
|
||||||
let self._screenState['oldTopLine'] = line("w0")
|
call g:NERDTree.CursorToTreeWin()
|
||||||
let self._screenState['oldWindowSize']= winwidth("")
|
let self._screenState['oldPos'] = getpos(".")
|
||||||
call nerdtree#exec(win . "wincmd w", 1)
|
let self._screenState['oldTopLine'] = line("w0")
|
||||||
|
let self._screenState['oldWindowSize']= winwidth("")
|
||||||
|
call nerdtree#exec(win . "wincmd w", 1)
|
||||||
|
catch
|
||||||
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:UI.setShowHidden(val) {{{1
|
" FUNCTION: s:UI.setShowHidden(val) {{{1
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ call s:initVariable("g:NERDTreeAutoCenterThreshold", 3)
|
|||||||
call s:initVariable("g:NERDTreeCaseSensitiveSort", 0)
|
call s:initVariable("g:NERDTreeCaseSensitiveSort", 0)
|
||||||
call s:initVariable("g:NERDTreeNaturalSort", 0)
|
call s:initVariable("g:NERDTreeNaturalSort", 0)
|
||||||
call s:initVariable("g:NERDTreeSortHiddenFirst", 1)
|
call s:initVariable("g:NERDTreeSortHiddenFirst", 1)
|
||||||
|
call s:initVariable("g:NERDTreeUseTCD", 0)
|
||||||
call s:initVariable("g:NERDTreeChDirMode", 0)
|
call s:initVariable("g:NERDTreeChDirMode", 0)
|
||||||
call s:initVariable("g:NERDTreeCreatePrefix", "silent")
|
call s:initVariable("g:NERDTreeCreatePrefix", "silent")
|
||||||
call s:initVariable("g:NERDTreeMinimalUI", 0)
|
call s:initVariable("g:NERDTreeMinimalUI", 0)
|
||||||
@@ -170,10 +171,10 @@ call nerdtree#ui_glue#setupCommands()
|
|||||||
"============================================================
|
"============================================================
|
||||||
augroup NERDTree
|
augroup NERDTree
|
||||||
"Save the cursor position whenever we close the nerd tree
|
"Save the cursor position whenever we close the nerd tree
|
||||||
exec "autocmd BufLeave ". g:NERDTreeCreator.BufNamePrefix() ."* if g:NERDTree.IsOpen() | call b:NERDTree.ui.saveScreenState() | endif"
|
exec "autocmd BufLeave,WinLeave ". g:NERDTreeCreator.BufNamePrefix() ."* if g:NERDTree.IsOpen() | call b:NERDTree.ui.saveScreenState() | endif"
|
||||||
|
|
||||||
"disallow insert mode in the NERDTree
|
"disallow insert mode in the NERDTree
|
||||||
exec "autocmd BufEnter ". g:NERDTreeCreator.BufNamePrefix() ."* stopinsert"
|
exec "autocmd BufEnter,WinEnter ". g:NERDTreeCreator.BufNamePrefix() ."* stopinsert"
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
if g:NERDTreeHijackNetrw
|
if g:NERDTreeHijackNetrw
|
||||||
@@ -183,6 +184,12 @@ if g:NERDTreeHijackNetrw
|
|||||||
augroup END
|
augroup END
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if g:NERDTreeChDirMode == 3
|
||||||
|
augroup NERDTreeChDirOnTabSwitch
|
||||||
|
autocmd TabEnter * if g:NERDTree.ExistsForTab()|call g:NERDTree.ForCurrentTab().getRoot().path.changeToDir()|endif
|
||||||
|
augroup END
|
||||||
|
endif
|
||||||
|
|
||||||
" SECTION: Public API {{{1
|
" SECTION: Public API {{{1
|
||||||
"============================================================
|
"============================================================
|
||||||
function! NERDTreeAddMenuItem(options)
|
function! NERDTreeAddMenuItem(options)
|
||||||
|
|||||||
Reference in New Issue
Block a user