add A mapping to maximize/restore tree window size

this commit is a modified patch from Guillaume Duranceau
This commit is contained in:
marty 2009-08-09 21:29:28 +12:00
parent 02b3cec827
commit a796715ac1
2 changed files with 29 additions and 0 deletions

View File

@ -239,6 +239,7 @@ F.......Toggle whether files are displayed.......................|NERDTree-F|
B.......Toggle whether the bookmark table is displayed...........|NERDTree-B|
q.......Close the NERDTree window................................|NERDTree-q|
A.......Zoom (maximize/minimize) the NERDTree window.............|NERDTree-A|
?.......Toggle the display of the quick help.....................|NERDTree-?|
------------------------------------------------------------------------------
@ -546,6 +547,14 @@ Applies to: no restrictions.
Closes the NERDtree window.
------------------------------------------------------------------------------
*NERDTree-A*
Default key: A
Map option: NERDTreeMapToggleZoom
Applies to: no restrictions.
Maximize (zoom) and minimize the NERDtree window.
------------------------------------------------------------------------------
*NERDTree-?*
Default key: ?
@ -1002,6 +1011,8 @@ Next release:
NERDTreeQuitOnOpen didnt play nicely, thanks to Curtis Harvey.
- fix a bug where the script ignored directories whose name ended in a dot,
thanks to Aggelos Orfanakos for the patch.
- added a mapping to maximize/restore the size of nerd tree window, thanks
to Guillaume Duranceau for the patch. See :help NERDTree-z for details.
3.1.1
- fix a bug where a non-listed no-name buffer was getting created every
@ -1094,6 +1105,7 @@ just downloaded pr0n instead.
Alf Mikula
Lucas S. Buchala
Curtis Harvey
Guillaume Duranceau
==============================================================================
8. License *NERDTreeLicense*

View File

@ -128,6 +128,7 @@ call s:initVariable("g:NERDTreeMapToggleBookmarks", "B")
call s:initVariable("g:NERDTreeMapToggleFiles", "F")
call s:initVariable("g:NERDTreeMapToggleFilters", "f")
call s:initVariable("g:NERDTreeMapToggleHidden", "I")
call s:initVariable("g:NERDTreeMapToggleZoom", "A")
call s:initVariable("g:NERDTreeMapUpdir", "u")
call s:initVariable("g:NERDTreeMapUpdirKeepOpen", "U")
@ -2605,6 +2606,8 @@ function! s:dumpHelp()
let @h=@h."\"\n\" ----------------------------\n"
let @h=@h."\" Other mappings~\n"
let @h=@h."\" ". g:NERDTreeMapQuit .": Close the NERDTree window\n"
let @h=@h."\" ". g:NERDTreeMapToggleZoom .": Zoom (maximize-minimize)\n"
let @h=@h."\" the NERDTree window\n"
let @h=@h."\" ". g:NERDTreeMapHelp .": toggle help\n"
let @h=@h."\"\n\" ----------------------------\n"
let @h=@h."\" Bookmark commands~\n"
@ -3201,6 +3204,7 @@ function! s:bindMappings()
exec "nnoremap <silent> <buffer> ". g:NERDTreeMapRefresh ." :call <SID>refreshCurrent()<cr>"
exec "nnoremap <silent> <buffer> ". g:NERDTreeMapHelp ." :call <SID>displayHelp()<cr>"
exec "nnoremap <silent> <buffer> ". g:NERDTreeMapToggleZoom ." :call <SID>toggleZoom()<cr>"
exec "nnoremap <silent> <buffer> ". g:NERDTreeMapToggleHidden ." :call <SID>toggleShowHidden()<cr>"
exec "nnoremap <silent> <buffer> ". g:NERDTreeMapToggleFilters ." :call <SID>toggleIgnoreFilter()<cr>"
exec "nnoremap <silent> <buffer> ". g:NERDTreeMapToggleFiles ." :call <SID>toggleShowFiles()<cr>"
@ -3678,6 +3682,19 @@ function! s:toggleShowHidden()
call s:centerView()
endfunction
" FUNCTION: s:toggleZoom() {{2
" zoom (maximize/minimize) the NERDTree window
function! s:toggleZoom()
if exists("b:NERDTreeZoomed") && b:NERDTreeZoomed
let size = exists("b:NERDTreeOldWindowSize") ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize
exec "silent vertical resize ". size
let b:NERDTreeZoomed = 0
else
exec "vertical resize"
let b:NERDTreeZoomed = 1
endif
endfunction
"FUNCTION: s:upDir(keepState) {{{2
"moves the tree up a level
"