mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
Add a NERDTreeToggleVCS command to the vcs plugin (#1060)
* NERDTreeToggleVCS * nerdtree toggle vcs documentation * fix function documentation * changelog * Update CHANGELOG.md * Update CHANGELOG.md * simplify toggletreevcs * Update CHANGELOG.md
This commit is contained in:
committed by
Phil Runninger
parent
8d9b8dae67
commit
82b1649f2e
@@ -7,7 +7,8 @@
|
|||||||
in an unordered list. The format is:
|
in an unordered list. The format is:
|
||||||
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
||||||
-->
|
-->
|
||||||
|
#### 6.3
|
||||||
|
- **.0**: Add new command that behaves like NERDTreeToggle but defaults to the root of a VCS repository. (willfindlay) [#1060](https://github.com/scrooloose/nerdtree/pull/1060)
|
||||||
#### 6.2
|
#### 6.2
|
||||||
- **.1**: Menu option, 'copy path to clipboard' is aware of VIM clipboard option (jhzn) [#1056](https://github.com/scrooloose/nerdtree/pull/1056)
|
- **.1**: Menu option, 'copy path to clipboard' is aware of VIM clipboard option (jhzn) [#1056](https://github.com/scrooloose/nerdtree/pull/1056)
|
||||||
- **.0**: Support tab-specific CWDs (PhilRunninger) [#1032](https://github.com/scrooloose/nerdtree/pull/1032)
|
- **.0**: Support tab-specific CWDs (PhilRunninger) [#1032](https://github.com/scrooloose/nerdtree/pull/1032)
|
||||||
|
|||||||
@@ -125,6 +125,14 @@ The following features and functionality are provided by the NERDTree:
|
|||||||
again. If no NERDTree exists for this tab then this command acts the
|
again. If no NERDTree exists for this tab then this command acts the
|
||||||
same as the |:NERDTree| command.
|
same as the |:NERDTree| command.
|
||||||
|
|
||||||
|
:NERDTreeToggleVCS [<start-directory> | <bookmark>] *:NERDTreeToggleVCS*
|
||||||
|
Like |:NERDTreeToggle|, but searches up the directory tree to find the top of
|
||||||
|
the version control system repository, and roots the NERDTree there. It
|
||||||
|
works with Git, Subversion, Mercurial, Bazaar, and Darcs repositories. A
|
||||||
|
couple of examples: >
|
||||||
|
:NERDTreeToggleVCS /home/marty/nerdtree/doc (opens /home/marty/nerdtree)
|
||||||
|
:NERDTreeToggleVCS (opens root of repository containing CWD)
|
||||||
|
|
||||||
:NERDTreeFocus *:NERDTreeFocus*
|
:NERDTreeFocus *:NERDTreeFocus*
|
||||||
Opens (or reopens) the NERDTree if it is not currently visible;
|
Opens (or reopens) the NERDTree if it is not currently visible;
|
||||||
otherwise, the cursor is moved to the already-open NERDTree.
|
otherwise, the cursor is moved to the already-open NERDTree.
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
"
|
"
|
||||||
" ============================================================================
|
" ============================================================================
|
||||||
command! -n=? -complete=dir -bar NERDTreeVCS :call <SID>CreateTabTreeVCS('<args>')
|
command! -n=? -complete=dir -bar NERDTreeVCS :call <SID>CreateTabTreeVCS('<args>')
|
||||||
|
command! -n=? -complete=dir -bar NERDTreeToggleVCS :call <SID>ToggleTabTreeVCS('<args>')
|
||||||
|
|
||||||
" FUNCTION: s:CreateTabTreeVCS(a:name) {{{1
|
" FUNCTION: s:CreateTabTreeVCS(a:name) {{{1
|
||||||
function! s:CreateTabTreeVCS(name)
|
function! s:CreateTabTreeVCS(name)
|
||||||
@@ -19,6 +20,14 @@ function! s:CreateTabTreeVCS(name)
|
|||||||
call g:NERDTreeCreator.createTabTree(empty(l:path) ? "" : l:path._str())
|
call g:NERDTreeCreator.createTabTree(empty(l:path) ? "" : l:path._str())
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: s:ToggleTabTreeVCS(a:name) {{{1
|
||||||
|
" Behaves the same as ToggleTabTree except roots directory at VCS root
|
||||||
|
function! s:ToggleTabTreeVCS(name)
|
||||||
|
let l:path = g:NERDTreeCreator._pathForString(a:name)
|
||||||
|
let l:path = s:FindParentVCSRoot(l:path)
|
||||||
|
call g:NERDTreeCreator.toggleTabTree(empty(l:path) ? "" : l:path._str())
|
||||||
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:FindParentVCSRoot(a:path) {{{1
|
" FUNCTION: s:FindParentVCSRoot(a:path) {{{1
|
||||||
" Finds the root version control system folder of the given path. If a:path is
|
" Finds the root version control system folder of the given path. If a:path is
|
||||||
" not part of a repository, return the original path.
|
" not part of a repository, return the original path.
|
||||||
|
|||||||
Reference in New Issue
Block a user