The filetype indentation rules (filetype plugin indent on
) should take precedence over whatever set smartindent
defines.
Is your filetype getting recognized? What does set filetype?
return?
I see in $VIMRUNTIME/filetype.vim
that .sgm and .sgml files are either recognized as sgml, sgmllnx, or docbk filetypes. It depends on the text on the first line.
" SGML
au BufNewFile,BufRead *.sgm,*.sgml
\ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'linuxdoc' |
\ setf sgmllnx |
\ elseif getline(1) =~ '<!DOCTYPE.*DocBook' || getline(2) =~ '<!DOCTYPE.*DocBook' |
\ let b:docbk_type = "sgml" |
\ let b:docbk_ver = 4 |
\ setf docbk |
\ else |
\ setf sgml |
\ endif
There is a $VIMRUNTIME/indent/docbk.vim
file (which follows xml rules) but there's not a $VIMRUNTIME/indent/sgml.vim
or $VIMRUNTIME/indent/sgmllnx.vim
file.
If the filetype is getting set by Vim to sgml or sgmllnx, then the smartindent indentation rules will apply. If the filetype is getting set by Vim to docbk, then the rules in $VIMRUNTIME/indent/docbk.vim
should apply. The docbk.vim indentation rules follow xml rules, so it's very smart about indenting by tags.