如何使用Vim从do跳到Ruby块的末尾?
我正在使用vim进行ruby,php和perl开发。 有一个快捷方式%从块的开头(子程序/函数/方法/ if)跳到结尾,反之亦然。 对我来说,ruby中的do / end标签上的%不起作用。
我怎么能用vim做到这一点?
matchit插件不仅可以匹配括号和注释。 这里可以找到ruby版本。
使用matchit插件和〜/ .vim / ftplugin / ruby.vim中的代码,它现在可以工作了:)
" Matchit support: if exists("loaded_matchit") if !exists("b:match_words") let b:match_ignorecase = 0 let b:match_words = \ '\%(\%(\%(^\|[;=]\)\s*\)\@<=\%(class\|module\|while\|begin\|until\|for\|if\|unless\|def\|case\)\|\:' . \ '\<\%(else\|elsif\|ensure\|rescue\|when\)\>:\%(^\|[^.]\)\@<=\' endif endif