0

I have initiated online spell checking in .vimrc with

autocmd FileType docbk set spell spelllang=en
autocmd FileType docbk highlight SpellBad cterm=underline ctermfg=red ctermbg=none

in my plugin's after/syntax/ directory, i created docbk.vim file with the following content:

    syntax spell toplevel

to prevent spellchecking XML markup (although i dont know what it's actually doing...).

The problem is that while everything is working fine, text inside <title>text</title> is not spellchecked at all.

1 Answer 1

1

I assume that spell check also doesn't work in <emphasis>, <remark>, <comment> and <citation>.

The syntax file for DocBook is rather old (2012) and I don't know if it is still maintained. Anyway you should try to contact the maintainer. See top of file $VIMRUNTIME/syntax/dockbk.vim.

What you can do now:

Copy the file $VIMRUNTIME/syntax/docbk.vim to your ~/.vim/syntax (on Windows: ~/vimfile/syntax) directory. Execute :echo $VIMRUNTIME in Vim display the value of $VIMRUNTIME.

Open the file and locate the lines:

" Add special emphasis on some regions. Thanks to Rory Hunter <[email protected]> for these ideas.
syn region docbkRegion start="<emphasis>"lc=10 end="</emphasis>"me=e-11 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
syn region docbkTitle  start="<title>"lc=7     end="</title>"me=e-8 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
syn region docbkRemark start="<remark>"lc=8    end="</remark>"me=e-9    contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
syn region docbkRemark start="<comment>"lc=9  end="</comment>"me=e-10   contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend
syn region docbkCite   start="<citation>"lc=10 end="</citation>"me=e-11 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity keepend

Than add ,@spell behind sgmlEntity. So this lines look like this:

" Add special emphasis on some regions. Thanks to Rory Hunter <[email protected]> for these ideas.
syn region docbkRegion start="<emphasis>"lc=10 end="</emphasis>"me=e-11 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity,@spell keepend
syn region docbkTitle  start="<title>"lc=7     end="</title>"me=e-8 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity,@spell keepend
syn region docbkRemark start="<remark>"lc=8    end="</remark>"me=e-9    contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity,@spell keepend
syn region docbkRemark start="<comment>"lc=9  end="</comment>"me=e-10   contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity,@spell keepend
syn region docbkCite   start="<citation>"lc=10 end="</citation>"me=e-11 contains=xmlRegion,xmlEntity,sgmlRegion,sgmlEntity,@spell keepend

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.