I am writing source code and a lot of times I need to press Enter and have the newline indented with 4 spaces more than the previous. As I don't want to do it always, I would like to be able to use C-RET
to achieve this.
While searching I found C-j
(newline-and-indent) but it always indents with the same amount of spaces and not relatively to the current line.
How can I achieve that?
To make myself clear, what I want is:
First line
/* Not indented. */
Second line
/* Second line indented with 4 spaces. */
Third line
/* Third line indented with 4 spaces
but relative to the second so now it
has 8 spaces. */
newline-and-indent
gives you? – Dan Nov 22 '14 at 21:29C-RET
(having 8 spaces) thenewline-and-indent
gives me only an indent of 2 spaces not 8 as I want. :) – Adam Nov 22 '14 at 21:32C-u C-return
to get what you're after. Please edit your question to reflect this part of the question. – Dan Nov 22 '14 at 21:39C-u C-RET
is defined so to bind it to Enter. :) – Adam Nov 22 '14 at 22:02