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

Re: overriding vim filetype

Expand Messages
  • Bram Moolenaar
    ... There is a mistake in the example, it should read: au BufRead,BufNewFile * if &ft == pascal | set ft=mypascal ... There is an extra & in front of ft .
    Message 1 of 3 , Dec 27, 2003
    • 0 Attachment
      Ricky Buchanan wrote:

      > I wanted to override the filetypes 'conf' and 'config' and some others
      > with my own filetype, named 'other'.
      >
      > Following the instructions in filetype.txt.gz on line 170-180-ish it says:
      >
      > > also use that in your command. For example, to use the file type
      > > "mypascal" when "pascal" has been detected: >
      > > au BufRead,BufNewFile * if ft == 'pascal' | set ft=mypascal
      > > | endif
      >
      >
      > But when I put this:
      >
      > === begin ~/.vim/ftdetect/other.vim ===
      >
      > au BufRead,BufNewFile notes,panic set filetype=other
      >
      > au BufRead,BufNewFile * if ft == 'config' | set ft=other | endif
      > au BufRead,BufNewFile * if ft == 'conf' | set ft=other | endif
      >
      > === end ~/.vim/ftdetect/other.vim ===
      >
      > The second two lines FUBAR everything up, it errors with:
      >
      > Error detected while processing BufRead Auto commands for "*":
      > E121: Undefined variable: ft
      > E15: Invalid expression: ft == 'config' | set ft=other | endif
      > Hit ENTER or type command to continue

      There is a mistake in the example, it should read:

      au BufRead,BufNewFile * if &ft == 'pascal' | set ft=mypascal
      | endif

      There is an extra & in front of "ft".

      --
      From "know your smileys":
      *<|:-) Santa Claus (Ho Ho Ho)

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
    Your message has been successfully submitted and would be delivered to recipients shortly.