On Monday, December 31, 2012 3:59:03 PM UTC-6, HarleyPig wrote:
> I have a map I use that inserts a timestamp in the form of
>
> __TS:1356990559|Dec 31, 2012 14:49__
>
> The dual nature allows me to visually parse the date, and process my entries easily with a program that parses the file.
>
> I'm trying to conceal the TS:...| part to make it visually more pleasing. Basically, eye-candy. But I am not succeeding at all.
>
> This is what I have (if you want the context, see it here: http://goo.gl/EDZ3q )
>
> if has( 'conceal' )
>
> " How can I use variables for the patterns?
> "syntax region myTimeStamp start="__TS:" end="\|" oneline conceal cchar=_
> syntax region myTimeStamp start="__TS:" end="\|"
> "highlight link myTimeStamp Conceal
> highlight myTimeStamp ctermfg=red ctermbg=blue
> set conceallevel=2
>
> endif
>
> Obviously, I'm misunderstanding syntax highlighting in general, because the region isn't being highlighted, let aloned concealed (when uncommented).
>
> What am I doing wrong?
When Vim does filetype detection, it clears any existing syntax and sources the proper syntax file for the newly detected filetype, if any.
Your syntax rules (defined globally, outside of any filetype) are probably being discarded.
Try creating the file in .vim/syntax and detecting the filetype. Or source the syntax file manually for a quick check.
You should look at the syntax files in $VIMRUNTIME/syntax for an example, there are other things to do to set up for a new syntax, unless you're adding to an existing syntax, in which case your current method still won't work for the reason given above.
I think there's a help section for new syntax files as well but I don't have Vim installed on the system I'm on at the moment so I can't easily look it up.
--
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
Tuesday, January 1, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment