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

119343Re: Problem with new line anchor in new syntax file

Expand Messages
  • Benjamin R. Haskell
    Dec 1, 2010
    • 0 Attachment
      On Tue, 30 Nov 2010, Kamil Libich wrote:

      > Hi,
      > I'm using Vim 7.2 under XP x32
      > I don't know why, the new line anchor seems not working in my syntax
      > file which I'd like to prepare for myself.
      > I want to highlight the 'Test' word which is at the beginning of the
      > line. To do that I use:
      > syn match tsTestName /^Test/
      > highlight link tsTestName Special
      > and it didn't highlight.
      > Any suggestions?

      Maybe case-sensitive? See :help :syn-case

      Otherwise, an identical setup works here when specified manually with an
      open file.

      Where are you putting those commands? If you're expecting highlighting
      and you use syntax highlighting otherwise, you should put them in a
      filetype-specific file:

      If you want it to be the only highlighting:
      == ~/vimfiles/syntax/filetype.vim

      If you want it to be in addition to normal highlighting:
      == ~/vimfiles/after/syntax/filetype.vim

      Using 'test' in place of 'filetype' in those names, putting your
      commands in there and calling :set ft=test from another file worked.

      If you want the highlighting regardless of filetype, you can use the
      'matchadd()' function, and add the following to your vimrc or something
      == ~/vimfiles/plugins/my-highlight.vim

      aug HighlightSetup
      au BufNewFile,BufReadPost,FileType,Syntax * call matchadd('Special','^Test')
      aug END

      Ben H

      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 4 messages in this topic