I am trying to function to toggle the size of my nerdtree split view. However I am getting "E488 trailing characters: end if".
function! ToggleNTWidth()
if exists("b:NERDTree")
if g:NERDTreeWinSize == 31
let g:NERDTreeWinSize = 50
else
let g:NERDTreeWinSize = 31
end if
end if
endfunction
I have tried putting in exe
in front of statements involving computation and converting segments into string `= 50'. This did not help.
In Vimscript, the closing keyword is a single word (:endif
, also :endfunction
, :endwhile
, etc.)
Learn how to look up commands and navigate the built-in :help
; it is comprehensive and offers many tips. You won't learn Vim as fast as other editors, but if you commit to continuous learning, it'll prove a very powerful and efficient editor. Vim would have answered this one simply by typing :help :end
and then doing tab completion by pressing Tab, or pressing <C-D>
to show all candidates (:help c_CTRL-D
).