开发者

How to find if else blocks fast in Emacs

If I have code that has a lot of if/then/else conditions like so:

if () {
if () {

} else {

}
} else {
if () {

} else {

}
}

and there开发者_如何学编程 might also be a lot of text inside those conditions. How can I quickly find the outermost if as well as the corresponding else.


I'd use backward-up-list (bound to C-M-up) to work my way up the nested blocks to the if I'm interested in, then use forward-sexp (bound to C-M-right) when on the left bracket to jump over the block to the else.


Try moving by parentheses: M-C-b (back), M-C-f (forward), M-C-n (next), M-C-p. Don't be afraid to just move the point to the top of the buffer and isearch forward. You can also move by defuns and other constructs.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜