如何添加自定义单词对来标记 gvim 中 block 的开头和结尾,以便我可以使用 %
跳转(就像 {
和 }
)
我想从 functionstart
跳转到 functionend
,反之亦然。
functionstart
<code here>
functionend
最佳答案
就像其他人所描述的那样,这是你应该做的:
放置matchit.vim
在 matchit.zip /plugin/matchit.vim
在你的~/.vim/plugin
目录( mkdir ~/.vim/plugin if it doesn't exist
)并将此行添加到您的 ~/.vimrc
中。这将允许使用 % 跨越关键字对。
let b:match_words = '\<functionstart\>:\<functionend\>' "Keyword pairs
如果你想让相同的关键字适用于所有 vim 缓冲区,请将这两行改为
let g:match_words = '\<functionstart\>:\<functionend\>' "Keyword pairs
autocmd BufReadPre * let b:match_words = g:match_words "Buffer specific variable
关于navigation - vim 中的自定义 block 限制器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17707602/