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

Re: when is filetype set?

Expand Messages
  • Michael P. Soulier
    ... 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
    Message 1 of 5 , Jan 3, 2001
    • 0 Attachment
      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
      au!

      " When starting to edit a file:
      " For C and C++ files set formatting of comments and set C-indenting
      on.
      " For other files switch it off.
      " Don't change the order, it's important that the line with * comes
      first.
      if version >= 5.4
      autocmd FileType * set formatoptions=tcql
      nocindent comm
      ents&
      autocmd FileType c,cpp,h set formatoptions=croql
      cindent
      "comments=sr:/*,mb:*,el:*/,://
      endif
      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
      endif

      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. ;-)

      Mike

      --
      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
    Your message has been successfully submitted and would be delivered to recipients shortly.