Is there a way to have vim not flag HTTP URLs and email addresses as spelling errors? Or, more generally, a way to list regexes of valid spellings?
Ignore URLs and email addresses in spell file
regular expression;spell checking
You can add custom syntax rules, and give them the@nospell keyword,this will tell Vim not to apply spell checking to this syntax match. For example::syn match UrlNoSpell \w\+:\/\/[^[:space:]]\+ contains=@NoSpellThe above will work for text files, and some filetypes (such asmarkdown), but not for all filetypes.Note that I used a fairly simple regex here; see How do I parse URL's from the text for some alternatives.For other filetypes, you need to do a bit more work. For example, for python files, comments are contained in a pythonCommentgroup, from /usr/share/vim/vim74/syntax/python.vim:syn match   pythonComment   #.*$ contains=pythonTodo,@SpellTo override this, we need to do::syn match UrlNoSpellComment \w\+:\/\/[^[:space:]]\+ contains=@NoSpell containedin=pythonComment:highlight def link UrlNoSpellComment CommentThe trick is to add a list of previously matched syntax matches in which ourcustom syntax match may be contained with containedin= This tells Vim to look for theUrlNoSpell regex within the pythonComment matches.We also need to use highlight to set the correct colours, since these aren'tinherited.You need to do this in a number of places, for example for Python strings::syn match UrlNoSpellString \w\+:\/\/[^[:space:]]\+ contains=@NoSpell containedin=pythonString:highlight def link UrlNoSpellString StringWe need 2 different syntax match groups so we can apply the correct syntax highlighting.Of course, for other filestypes you need to use other containedin= syntaxmatches... There is, AFAIK, no universal solution, but looking up the correctones in /usr/share/vim/vim74/syntax/*.vim should not be too difficult.Note that all of the above commands must be executed after the syntax files;there are 2 ways to do this:From a command or key mapping, this must be invoked manually every time. e.g.fun! NoUrlSpell()    if &filetype == 'python'        :syn match UrlNoSpellComment \w\+:\/\/[^[:space:]]\+ contains=@NoSpell containedin=pythonComment        :highlight def link UrlNoSpellComment Comment        :syn match UrlNoSpellString \w\+:\/\/[^[:space:]]\+ contains=@NoSpell containedin=pythonString        :highlight def link UrlNoSpellString String    elseif &filetype == 'ruby'         ...    else        syn match   pythonComment   #.*$ contains=pythonTodo,@Spell    endifendfuncommand NoUrlSpell :call NoUrlSpell()Put the commands in in the ~/.vim/after/syntax/[filetype].vim. Vim will pick upthese files and execute them after the default syntax files (see::help after-directory).