开发者

How can I make the cursor go back and forth around the block keywords?

I am at present writing a syntax file in VIM for the script language I use, which isn开发者_JAVA技巧't a generic language like c.

One of the block syntaxes is the do..loop structure as below:

DO
    blah blah blah
LOOP times, label

I wonder that if there is a way for me to make the cursor go back and forth around DO and LOOP like in c I press % then the cursor moves during "{" and "}".

Thanks a lot.


You can use the matchit plugin to define additional pairs of block start and end keywords to jump to with %. For your case something like

:let b:match_words = '\<DO\>:\<LOOP\>'

should work. To keep your setup tidy you should define this in an new filetype plugin. The matchit documentation has an extra chapter |matchit-newlang| devoted to this topic.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜