Monday, February 24, 2014

Re: Syntax Highlighting Question

J S wrote:
> Hi,
>
> I am wondering why my syntax highlighting is not working on a particular machine.
>
> I am executing the following:
>
> 1. vim (enter into vim with certain scripts and plugins)
> 2. :syntax clear (remove all the existing syntax info)
> 3. :syntax case ignore (treat [a-z] as [a-zA-Z])
> 3. :syntax match option "^[a-z][a-z ]*[a-z]$"
> (match each line which starts with a lower (or upper)-case letter, ends with a lower (or upper)-case letter, and contains, in between, (0 or more characters picked from the set: {lower (or upper)-case letters, space}).)
> 4. :highlight link option statement (colorize text which matches option with statement-color-scheme).
> 5. I am typing in insert-mode in the current buffer - foobaz (this matches)
> 6. I hit the enter key to go to the next line.
> 7. I am typing in the current buffer - FOOBAZ (this erroneously does not match).
>
> I am wondering why my step 7 is not producing the expected syntax highlighting result.
>
> This code idea comes from the man ftplugin. Something in it wasn't working on a particular machine which led me to where I am now.
>
I don't have a problem with this using vim 7.4.160; ie. both foobaz and
FOOBAZ are highlighted using "option" highlighting. FWIW, I sourced the
following:

syntax clear
syntax case ignore " (treat [a-z] as [a-zA-Z])
syntax match option "^[a-z][a-z ]*[a-z]$"
highlight link option Statement
" I am typing in insert-mode in the current buffer - foobaz (this
matches)
" I hit the enter key to go to the next line.
" I am typing in the current buffer - FOOBAZ (this erroneously does
not match).

Also, you could use \a to stand for [a-zA-Z]; ie.

syntax match option "^\a[a-z ]*\a$"

Regards,
C Campbell




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

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

No comments:

Post a Comment