15525Re: when is filetype set?
- Jan 3, 2001* Michael P. Soulier (msoulier@...) wrote thusly :
> Hey people. I'm trying to put some logic in my .vimrc file so thatI dont think so. You will need to execute this each time you load a
> different options are set when the filetype or syntax is set to
> "mail". However, filetype and syntax don't seem to be set at that
> point, even though it appears that they should be if I read the output
> from verbose.
> I'd like to do something like this:
> " Turn on syntax shading, depending on a few things.
> " I don't want it for mail, too hard to read.
> if &filetype == "mail"
> " Also, set it to wrap lines if we're editing mail.
> set textwidth=78
> " And lose the auto-indent.
> set noautoindent
> " Turn off syntax shading.
> syntax off
> " Have it on by default.
> syntax on
> Will this not work at all in the .vimrc file?
Also syn off turns syntax highlighting off on all buffers.
syn clear will clear it for the current buffer alone.
I suggest using autocommands to achieve what you want.
" Set up your defaults for all files
au FileType * se cindent nu
" Specific to files of filetype mail
au FileType mail syn clear
au FileType mail se tw=78 noai
- << Previous post in topic Next post in topic >>