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 c3a2f88b63
commit 95acf7dd25
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| B.......Toggle whether the bookmark table is displayed...........|NERDTree-B|
q.......Close the NERDTree window................................|NERDTree-q| q.......Close the NERDTree window................................|NERDTree-q|
A.......Zoom (maximize/minimize) the NERDTree window.............|NERDTree-A|
?.......Toggle the display of the quick help.....................|NERDTree-?| ?.......Toggle the display of the quick help.....................|NERDTree-?|
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
@ -546,6 +547,14 @@ Applies to: no restrictions.
Closes the NERDtree window. Closes the NERDtree window.
------------------------------------------------------------------------------
*NERDTree-A*
Default key: A
Map option: NERDTreeMapToggleZoom
Applies to: no restrictions.
Maximize (zoom) and minimize the NERDtree window.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDTree-?* *NERDTree-?*
Default key: ? Default key: ?
@ -1002,6 +1011,8 @@ Next release:
NERDTreeQuitOnOpen didnt play nicely, thanks to Curtis Harvey. NERDTreeQuitOnOpen didnt play nicely, thanks to Curtis Harvey.
- fix a bug where the script ignored directories whose name ended in a dot, - fix a bug where the script ignored directories whose name ended in a dot,
thanks to Aggelos Orfanakos for the patch. 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 3.1.1
- fix a bug where a non-listed no-name buffer was getting created every - fix a bug where a non-listed no-name buffer was getting created every
@ -1094,6 +1105,7 @@ just downloaded pr0n instead.
Alf Mikula Alf Mikula
Lucas S. Buchala Lucas S. Buchala
Curtis Harvey Curtis Harvey
Guillaume Duranceau
============================================================================== ==============================================================================
8. License *NERDTreeLicense* 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:NERDTreeMapToggleFiles", "F")
call s:initVariable("g:NERDTreeMapToggleFilters", "f") call s:initVariable("g:NERDTreeMapToggleFilters", "f")
call s:initVariable("g:NERDTreeMapToggleHidden", "I") call s:initVariable("g:NERDTreeMapToggleHidden", "I")
call s:initVariable("g:NERDTreeMapToggleZoom", "A")
call s:initVariable("g:NERDTreeMapUpdir", "u") call s:initVariable("g:NERDTreeMapUpdir", "u")
call s:initVariable("g:NERDTreeMapUpdirKeepOpen", "U") call s:initVariable("g:NERDTreeMapUpdirKeepOpen", "U")
@ -2499,6 +2500,8 @@ function! s:dumpHelp()
let @h=@h."\"\n\" ----------------------------\n" let @h=@h."\"\n\" ----------------------------\n"
let @h=@h."\" Other mappings~\n" let @h=@h."\" Other mappings~\n"
let @h=@h."\" ". g:NERDTreeMapQuit .": Close the NERDTree window\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."\" ". g:NERDTreeMapHelp .": toggle help\n"
let @h=@h."\"\n\" ----------------------------\n" let @h=@h."\"\n\" ----------------------------\n"
let @h=@h."\" Bookmark commands~\n" let @h=@h."\" Bookmark commands~\n"
@ -3095,6 +3098,7 @@ function! s:bindMappings()
exec "nnoremap <silent> <buffer> ". g:NERDTreeMapRefresh ." :call <SID>refreshCurrent()<cr>" 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: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:NERDTreeMapToggleHidden ." :call <SID>toggleShowHidden()<cr>"
exec "nnoremap <silent> <buffer> ". g:NERDTreeMapToggleFilters ." :call <SID>toggleIgnoreFilter()<cr>" exec "nnoremap <silent> <buffer> ". g:NERDTreeMapToggleFilters ." :call <SID>toggleIgnoreFilter()<cr>"
exec "nnoremap <silent> <buffer> ". g:NERDTreeMapToggleFiles ." :call <SID>toggleShowFiles()<cr>" exec "nnoremap <silent> <buffer> ". g:NERDTreeMapToggleFiles ." :call <SID>toggleShowFiles()<cr>"
@ -3767,6 +3771,19 @@ function! s:toggleShowHidden()
call s:centerView() call s:centerView()
endfunction 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 "FUNCTION: s:upDir(keepState) {{{2
"moves the tree up a level "moves the tree up a level
" "