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

90854Re: syntax auto detect

Expand Messages
  • Gary Johnson
    May 23 3:11 PM
    • 0 Attachment
      On 2008-05-23, zhengquan <zhang.zhengquan@...> wrote:

      > On May 1, 1:45 am, Gary Johnson <garyj...@...> wrote:
      > > On 2008-04-25,zhengquan<zhang.zhengq...@...> wrote:
      > >
      > > > Hello,
      > > > I wonder if vim can auto detect filetypes.
      > > > I want to edit some .cmd files which are actually scheme scripts.
      > >
      > > > I can not add mode lines to the files because they will cause trouble
      > > > when read by other programs. I also do not want to use autocmd to
      > > > autodetect .cmd extensions. I would like to know if there are some
      > > > smarter mechanisms for auto detecting filetypes.
      > >
      > > :help new-filetype-scripts
      > >
      > > You might also open $VIMRUNTIME/filetype.vim and search for "\.cmd"
      > > to see how vim distinguishes rexx files from dosbatch files that
      > > share the .cmd suffix. You could create your own
      > > ~/.vim/filetype.vim and add similar logic to detect scheme files.
      > > See
      > >
      > > :help new-filetype

      > Hello,
      > I saw the detection method in filetype.vim
      > It peeks the first line to see what it is, I wonder if there are
      > smarter and more automatic ways to detect the syntax and tell what the
      > filetype is.

      How much more automatic can you get? As for smarter, the only
      information there is is the file's name and its contents. Vim will
      sometimes examine more than the first line of a file to try to
      determine its contents, especially if the file name has no suffix at
      all. See $VIMRUNTIME/scripts.vim.

      Regards,
      Gary


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Show all 15 messages in this topic