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

66323Re: Any way to get vim recognize emacs modeline?

Expand Messages
  • Charles E. Campbell, Jr.
    Mar 2, 2006
      panshizhu@... wrote:

      >such as the following:
      >// -*- C++ -*-
      >I don't use emacs, but many source files have this, since the standard C++
      >header does not had any "extension" in the filename, it is impossible for
      >Vim getting it's filetype right.
      >Can Vim recognize the standard C++ header files "by default"?

      You can always write your own modeline handler. General procedure:

      a) au BufRead,BufNewFile * call MyOwnModelineHandler()
      goes into your <.vimrc>

      b) write MyOwnModelineHandler(). Do something like

      fun! MyOwnModelineHandler()
      let mp1= &modelines + 1
      let modeline= search('^\%<'.mpl.'l//-\*- ','W')
      if !modeline
      let mpend= line("$") - &modelines - 1
      let modeline= search('^\%>'.mpend.'l//-\*-','W')
      if modeline
      ---interpret and do whatever---

      Place the function in your .vimrc or in your .vim/plugin directory.

      Chip Campbell
    • Show all 7 messages in this topic