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
@@ -11,6 +11,7 @@
|
||||
"
|
||||
" ============================================================================
|
||||
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(name)
|
||||
@@ -19,6 +20,14 @@ function! s:CreateTabTreeVCS(name)
|
||||
call g:NERDTreeCreator.createTabTree(empty(l:path) ? "" : l:path._str())
|
||||
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
|
||||
" Finds the root version control system folder of the given path. If a:path is
|
||||
" not part of a repository, return the original path.
|
||||
|
||||
Reference in New Issue
Block a user