I'd like to maximize NERDTree when I enter the NERDTree buffer. The command I have so far is:
autocmd BufEnter NERD_tree_* <A>
...but the <A>
part is wrong. I get the error:
E21: Cannot make changes, 'modifiable' is off: <A>
The maximize command is shift-A
, and there's not any type of :NERDTreeMaximize
command - I can't figure out what to put as the final step of that BufEnter
command.
Any help is greatly appreciated, thanks!
Edit: I used a combination of the answers below to come up with this snippet, that maximizes on enter, and sets back to regular size when you leave the nerdtree buffer:
function NERDTreeMaximize()
if !exists("b:NERDTreeZoomed") || !b:NERDTreeZoomed
call NERDTreeMaximizeToggle()
endif
endfunction
function NERDTreeMinimize()
if exists("b:NERDTreeZoomed") && b:NERDTreeZoomed
call NERDTreeMaximizeToggle()
endif
endfunction
function NERDTreeMaximizeToggle()
call b:NERDTree.ui.toggleZoom()
endfunction
augroup vimrc_nerdtree
autocmd BufEnter NERD_tree_* :call NERDTreeMaximize()
autocmd BufLeave NERD_tree_* :call NERDTreeMinimize()
augroup END
I'm not sure of the etiquette here, but I'll upvote all answers, and choose one as the correct one - I want everyone to get as many internet points as possible. Thanks to all!