On Thursday, November 1, 2012 9:22:23 PM UTC-5, Ian Donegan wrote:
> On Thursday, November 1, 2012 10:34:23 AM UTC-4, Ben Fritz wrote:
> > 
> > Well, spelling integrates with syntax highlight. You could define a simple 
> > syntax to recognize the URLs and disallow spelling in that syntax region.
> 
> Great. Thanks for the response. I am relativity new to Vim though, so I have 
> no idea how I would go about setting up syntax hilighting rules. The closest 
> thing that I could find in the help file was something about 
> "contains=@NoSpell" but I do not really understand it. How would I go about 
> setting it up, or at least, where could I read more about it?

:help syntax
:help :syn-match

If you are just editing a plaintext file with no existing syntax highlighting, 
it is very easy. Assuming you have "syntax on" in your .vimrc somewhere, just 
do something like this:

  :syntax match NoSpellURL 'http://\S*' contains=@NoSpell

You can type this directly, put it in a mapping or command, or put this in a 
file with pretty much any name you want, in ~/.vim/syntax, and set the syntax 
to the chosen name to activate it. E.g. if you name the file 
~/.vim/txtspell.vim you can do :set syntax=txtspell to apply the rule.

It gets somewhat more complicated if you have an existing syntax you want to 
enhance with this rule but is still quite possible. The "after directory" is 
useful for this, i.e. ~/.vim/after/syntax.

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