在 emacs 中编辑 C 或 C++ 文件时,我希望能够转到包含代码块的开头。我期待找到一个 c-beginning-of-block 函数,但唉,不存在这样的函数(据我所知)。例如,我可能正在编辑以下丑陋的 C 代码:
void myFunction()
{
if (something) { //<--- I want to jump to this brace!
// do lots of stuff
if (stuff) {
// stuff
}
// more stuff
// ...
// I want to put my cursor somewhere on this line <---
// (anywhere just outside the following if) and call c-beginning-of-block
// and jump to the brace marked above (skipping "sibling" statements)
if (pizza_is_good) {
// do something
// wait, where am I?
}
// way more stuff
// ...
if (i_love_pizza) {
// eat pizza
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果这还不是 emacs 的一部分,我会感到非常惊讶,我只是在任何地方都找不到它......
fortran 模式有 fortran-beginning-of-block
promela-mode 有 promela-find-start-of-containing-block
小智 15
尝试backward-up-list
,默认绑定到C-M-u.
归档时间: |
|
查看次数: |
4975 次 |
最近记录: |