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:
%HOME%\vimfiles\syntax\filetype.vim
== ~/vimfiles/syntax/filetype.vim

If you want it to be in addition to normal highlighting:
%HOME%\vimfiles\after\syntax\filetype.vim
== ~/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 like:
%HOME%\vimfiles\plugins\my-highlight.vim
== ~/vimfiles/plugins/my-highlight.vim

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

--
Best,
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

Reply via email to