I'm using Emacs. I want that when I write this (| is the point):
for (int i=0; i<n; i++) {|
And I press Enter (or a different key, whatever), I get this:
for (int i=0; i<n; i++) {
|
}
So I can start typing right away the content of the block, and the block is automatically closed.
How can I do this?
Here's my C/C++ setup that solves your problem:
And here's the yasnippet for
for:Note that the snippet doesn't do curly braces, so I can decide if I want them or just a single statement.
And just to show you the sequence of keys that leads me from zero to the code in your question:
forC-o C-o C-o {.