vim autoindent FAQ: How do I configure the vim editor to automatically indent newlines? That is, if my current line is indented three spaces, and I hit [Enter], I want the next line to automatically be indented three spaces as well.
To configure vim autoindent, just use this command in vim’s last-line mode:
This tells vim to automatically indent the next line. You can either type this vim autoindent command while you’re in vim, or if you want this to be the default behavior, you can add this line to your .vimrc configuration file:
(For more information on vimrc configuration files, see my example vim vimrc configuration file tutorial.)
vim autoindent: How to un-indent a line in vim
On a related note, if the vim autoindent feature has indented a line, but you really want to move the cursor back to the first column, you don’t have to press the backspace key several times to move back. Just use this keystroke to move back to the first column:
This [control][d] keystroke moves the vim cursor back to the first column, and then you can keep typing from there.
help support my writing
& keep this website running