Loading ...
Sorry, an error occurred while loading the content.

15536Re: when is filetype set?

Expand Messages
  • Michael P. Soulier
    Jan 3, 2001
      On Wed, Jan 03, 2001 at 01:53:55PM -0500, Benji Fisher wrote:

      > > > " Set up your defaults for all files
      > > > syn on
      > > > au FileType * se cindent nu
      > > > " Specific to files of filetype mail
      > > > au FileType mail syn clear
      > > > au FileType mail se tw=78 noai
      > Does this work? I do not think it should. IIRC, the standard Syntax
      > autocommands are defined after the vimrc file is sourced. Since
      > autocommands are executed in the order they are defined, I do not think
      > yours will have any effect. Maybe if you put it in the gvimrc instead of
      > the vimrc...

      In my case, I actually have it this way, partly taken from Sven's .vimrc:

      " Only do this part when compiled with support for autocommands.
      if has("autocmd")

      augroup cprog
      " Remove all cprog autocommands

      " When starting to edit a file:
      " For C and C++ files set formatting of comments and set C-indenting
      " For other files switch it off.
      " Don't change the order, it's important that the line with * comes
      if version >= 5.4
      autocmd FileType * set formatoptions=tcql
      nocindent comm
      autocmd FileType c,cpp,h set formatoptions=croql
      augroup END
      " Source our .tex definitions if it's a .tex file.
      au FileType tex so ~/.vimtexrc
      " Set up settings for mail.
      au FileType mail syn clear
      au FileType mail se tw=78 noai

      This seems to work just fine.

      > There is a way to customize syntax highlighting. It will be
      > different (and easier) in vim 6.0. If you are planning to RTFM, I suggest
      > the following topics:
      > :help startup
      > :help mysyntaxfile

      I'll do that. ;-)


      Michael P. Soulier <msoulier@...>
      "...the word HACK is used as a verb to indicate a massive amount
      of nerd-like effort." -Harley Hahn, A Student's Guide to UNIX
      PGP Public Key: http://www.storm.ca/~msoulier/email.phtml
    • Show all 5 messages in this topic