" endwise.vim - EndWise " Author: Tim Pope " Version: 1.0 " Distributable under the same terms as Vim itself (see :help license) " Exit quickly when: " - this plugin was already loaded (or disabled) " - when 'compatible' is set if (exists("g:loaded_endwise") && g:loaded_endwise) || &cp finish endif let g:loaded_endwise = 1 let s:cpo_save = &cpo set cpo&vim augroup endwise " {{{1 au! autocmd FileType ruby \ let b:endwise_addition = '\=submatch(0)=="{" ? "}" : "end"' | \ let b:endwise_words = 'module,class,def,if,unless,case,while,until,begin,do' | \ let b:endwise_pattern = '^\s*\zs\%(module\|class\|def\|if\|unless\|case\|while\|until\|for\|\|begin\)\>\%(.*[^.:@$]\\)\@!\|\DiscretionaryEnd") == "" inoremap DiscretionaryEnd =crend(0) inoremap AlwaysEnd =crend(1) imap