Install endwise.vim to help with ending certain structures automatically.