Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shortcut to jump out of a c block

Tags:

emacs

I am looking for an emacs shortcut/command to jump out of an c/c++ block. E.g.

int func(int a, int b)
{
    if (a == b) {
        cout << "Equal" << endl; // <-- I am here
    }
    // <-- I want to get here        
}

I want to use this keyboard shortcut in combination with yasnippet in order to jump out of the block after the if-statement. Ideally the move command would jump over pairs of braces and would ignore braces in comments.

I found C-M e which jumps out of the function, but I would only like to jump out of the block.

like image 601
pyfex Avatar asked Jan 24 '26 10:01

pyfex


1 Answers

Have you tried M-x up-list, it also has an analog, M-x backward-up-list. I don't believe either have default bindings.

like image 119
Trey Jackson Avatar answered Jan 25 '26 23:01

Trey Jackson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!