Search code examples
vimviauto-indent

Maintain indentation from previous row in vim


What is the name of the option which keeps the indentation when moving to a new row.

Example

Subject
    This is indented and now i press enter
    I would like indentation to happen automatically

Subject
    This is indented and now i press enter
I currently start here here and indent manually

Solution

  • From the manual (:help indent.txt):

    autoindent uses the indent from the previous line

    ...so:

    :set autoindent
    

    If this does not work for you try starting Vim without plugins and skipping .vimrc initializations:

    vim -u NONE -N