Emacs cheat sheet

Some handy emacs command you may want to know for improving your speed of coding.

backward-kill-sexp, this command Kill the balanced expression preceding point.  It is bound to ESC <C-backspace>. For example,

if (n > 0) {
   transfer(n - 1, pegs, use, to, from);
}

To remove the whole block of the code in the if condition, place your cursor at the end of the closing bracket and run the command backward-kill-sexp, The whole block of code will be deleted.

if (n > 0) 

backward-up-list, this command ‘Move backward out of one level of parentheses.’

Set mark and pop mark. This combination of commands allows you to navigate code easily by setting a mark. <C-SPC> which sets the mark and then  <C-u C-SPC> which jumps to the last one.

Leave a Reply

Your email address will not be published. Required fields are marked *