vim: autoindent not working

Viewed 26414

my autoindent is not working, any diagnostic tests to figure it out?

my ":set" is:

:set --- Options --- cindent laststatus=2 scroll=17
tabstop=4 window=36
filetype=cpp number
smartindent ttyfast
helplang=en paste
syntax=cpp ttymouse=xterm2
backspace=indent,eol,start
fileencoding=utf-8
fileencodings=ucs-bom,utf-8,default,latin1 printoptions=paper:letter
runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/af ter,/var/lib/vim/addons/after,~/.vim/after suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc

9 Answers

try:

:set ai

or:

:set autoindent

find more about auto-indent:

:h ai

Otherwise, it's might be something with file type detection.

"The 'autoindent' option is reset when the 'paste' option is set". So try to remove 'paste' from your settings (vim-options).

:set smartindent? showd: nosmartindent

Then activating it with :set smartindent solved problem for me.

Related