开发者

vim fails to match symbols in php properly

开发者 https://www.devze.com 2023-04-11 14:19 出处:网络
<?php $foo->bar(); ?> If you press % while the cursor is on the first \'<\' the cursor moves to the next \'>\' instead of t开发者_运维百科he one in the last line.
<?php
    $foo->bar();
?>

If you press % while the cursor is on the first '<' the cursor moves to the next '>' instead of t开发者_运维百科he one in the last line.

Any chance to fix this?

edit:

my vim version:

$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Mar 24 2011 07:09:45)

i also have matchit.vim installed for the case that it matters.


You want to use the matchit plugin. That allows smarter matching of tokens based on the given filetype being edited. :help matchit-install will tell you how you can setup matchit to be sourced on startup so it's available when you're editing.

Once it's setup, when you edit a PHP file, a map will be created for % that runs matchit's functionality. It also defines various buffer-local variables (such as b:match_words) which can be tailored to determine how % behaves -- recognized tokens, how they're related to each other, etc.

0

精彩评论

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

关注公众号