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

Re: .vimrc syntax commands

Expand Messages
  • Charles E. Campbell, Jr.
    ... Most syntax highlighting files begin with syn clear and so your highlighting commands are lost. So, clear ly :) that s not the ideal place to put them.
    Message 1 of 3 , Nov 29, 2005
    • 0 Attachment
      jbw wrote:

      > I just getting started with syntax highlighting. I have several
      >syntax commands in my _vimrc file.
      >
      > syntax on
      > syntax case match
      > syntax match xTodo /Action.*/
      > syntax match xComment /\:.*/
      > highlight link xTodo Todo
      > highlight link xComment Comment
      >
      >
      > When I open a file it doesn't seem to recognize the syntax commands
      >in the _vimrc file. I have to manually type the syntax match commands
      >for the syntax to work. However the highlight commands appear to load
      >fine. When I do :highlight they show up in the list.
      >
      >
      Most syntax highlighting files begin with

      syn clear

      and so your highlighting commands are lost. So, "clear"ly :) that's
      not the ideal place to put
      them. So, it depends on what you're trying to accomplish.

      In your $HOME/.vim directory (assuming Unix) should be:

      syntax/ -- this directory should hold new syntax files
      after/syntax/ -- this directory should hold syntax commands which
      modify/extend already extant syntax
      filetype.vim -- this file holds commands such as

      au BufNewFile,BufReadPost *.b setf basis

      which tells vim that a $HOME/vim/syntax/basis.vim file holding
      syntax highlighting commands
      for basis should be loaded for any file with a ".b" as a suffix.

      scripts.vim -- this file holds commands (see
      /usr/local/share/vim/vim../scripts.vim for an example)
      which tells vim how to recognize files for which a suffix rule is
      insufficient.

      So, I'm suggesting that you put the syntax above in .vim/syntax if its
      new syntax or into
      after/syntax if its an extension to already existing syntax.

      Regards,
      Chip Campbell
    Your message has been successfully submitted and would be delivered to recipients shortly.