Friday, November 2, 2012

Re: Wildcards in Spell-check?

On Friday, November 2, 2012 11:00:28 AM UTC-4, Ben Fritz wrote:
> 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.

Well, I thank you, Ben Fritz. I stuck that line in my .vimrc file and it fixed my problem for the most part. I still do not understand all of the syntax behind it yet but I should be able to figure the rest out with the help of the manual. It has been a pleasure learning from you.

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

No comments:

Post a Comment