我正在使用 ctags 在 vim 中浏览我的 cpp 代码。在某些时候,我想转到右大括号的起点,即我想看看这个大括号从哪里开始。所以我按 %(通过 shift + 5)
。大多数时候这是可行的,但有时当我的代码有包含大括号的注释时,它会转到这些位置。
例如:
for(int i = 0;i<100;++i)
{ //point 1
// this is a comment { // point2
<some 1000 lines code>
} <== press % here and it goes to point 2
我怎样才能纠正这个问题,使其到达正确的位置,即第 1 点。
最佳答案
使用 matchit.vim 宏(从 v6 开始在宏中提供):
set nocompatible
filetype plugin on
runtime macros/matchit.vim
应该做的伎俩...
关于c++ - vim 大括号匹配带有大括号的注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37611116/