I would like to know if there is a way to get the editors Vim or Emacs (I use both as I haven't decided which I prefer yet) to change the indentation automatically when you wrap existing code into a new statement.
For example:
/* original code */
inst 1;
inst 2;
inst 3;
/* wrapping the code into a while loop */
while (cond) {
inst 1;
inst 2;
inst 3;
}
/* desired result */
while (cond) {
inst1;
inst2;
inst3;
}
Is there anyway to get the editor to change the indentation of the three instructions? Although I use the autoindent, it doesn't acknowledge subsequent changes. So far I've been making the changes manually, but I presume there must be a better way. Any clue ?
Thanks.