Hi!
On Wed, Dec 08, 2010 at 12:44:37PM -0500, Chris Jones wrote:
> The problem with this is that in Vim, non-asciidoc text (especially
> where indentation is used to structure the document) often end up
> syntax-highlighted in all kinds of weird colors.
[cut]
> Has anybody come up with a convenient implementation?
File type auto-detection configured in
http://code.google.com/p/asciidoc/source/browse/vim/ftdetect/asciidoc_filetype.vim
which is probably installed on your system in
/usr/share/vim/vimfiles/ftdetect/asciidoc_filetype.vim
As you can see, there both unconditional and conditional implementations
available, but unconditional is default one.
So, as first option, you can switch from unconditional to conditional by
commenting first and uncommenting second line.
For me, conditional implementation doesn't work good enough, and at a
glance it can be replaced by much simpler implementation (keeping in mind
main document header is required for all document types, if I remember
correctly):
autocmd BufRead *.txt,README,TODO,CHANGELOG,NOTES if getline(1) =~ '^= '
| setlocal filetype=asciidoc | endif
autocmd BufRead *.txt,README,TODO,CHANGELOG,NOTES if getline(2) =~
'^====' | setlocal filetype=asciidoc | endif
autocmd BufNewFile *.txt,README,TODO,CHANGELOG,NOTES setlocal
filetype=asciidoc
--
WBR, Alex.
--
You received this message because you are subscribed to the Google Groups
"asciidoc" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/asciidoc?hl=en.