Hi Peter,

On Sat, Jan 25, 2014 at 5:13 AM, Peter Nguyen <peter.nguyen1...@gmail.com>wrote:

> Hi,
>
> I have a twig (PHP HTML template) file with several non ascii characters
> at different places. I can do a search with:
>
> /[\x7f-\xff]/
>
> and it will match them. But when I try to add these commands to my .vimrc
> file for highlighting them, it does not work:
>
> " Find non ASCII chars and highlight them
> syn match nonascii "[\x7f-\xff]"
> hi nonascii guibg=Red ctermbg=2
>
> Anyone who knows what I'm doing wrong?
>

Declaring syntax rules in the .vimrc will not work, since the syntax will
be cleared during vim startup (or something to that effect).

For your case, you can either add something like this to your .vimrc:

    match ErrorMsg "[\x7f-\xff]"

Or add your original commands to a file called ~/.vim/after/syntax/php.vim
in your home directory (create it and any needed parent directories if they
don't already exist). The "after" folder is a nice way to customize things
locally according to your needs. That file specifically will extend the php
syntax for you.

See also e.g. <http://vim.wikia.com/wiki/Highlight_unwanted_spaces>.

H.T.H.

Cheers,
Niklas


>
> --
> --
> You received this message from the "vim_mac" 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
>
> ---
> You received this message because you are subscribed to the Google Groups
> "vim_mac" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vim_mac+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
You received this message from the "vim_mac" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_mac+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to