You have both :set autoindent
, and later :set cindent
. The latter overrides the former, and is responsible for the behavior you're complaining about, because it mistakenly interprets the text:
as a label.
If you only want to enable an option for certain filetypes, use :setlocal cindent
instead, and put the corresponding :setlocal
commands into ~/.vim/after/ftplugin/<filetype>.vim
, where <filetype>
is the actual filetype (e.g. c
). (This requires that you have :filetype plugin on
; use of the after directory allows you to override any default filetype settings done by $VIMRUNTIME/ftplugin/<filetype>.vim
.)
Alternatively, you could define an :autocmd FileType <filetype> setlocal cindent
directly in your ~/.vimrc
, but this tends to become unwieldy once you have many customizations.