Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I enable vim7 spellchecking inside the POD sections when editing perl files?

I'm a long time vim user, but only recently learned that vim7 has some awesome spelling features baked in now. I've been using all sorts of external spelling tools and plugins so far, and am very excited about ditching all of them for the builtin spelling.

So here's the problem. I did review :help spell and the spelling looks great for most of the filetypes I've tried, except perl (.pl|.pm). The problem seems syntax related because when I :set spell and set syntax=off the spelling works fine, but then stops working when I set syntax=perl.

What would be really cool, is if I could enable the spelling for only for the POD blocks. Any ideas?

:set spell
:set spelllang=en_us
:set syntax=perl
like image 531
Ajith Antony Avatar asked May 11 '09 20:05

Ajith Antony


1 Answers

grepping for “spell” in /usr/share/vim/vim72/syntax/perl.vim, I find some syntax definitions for POD that already include spelling, but are wrapped in an include guard for perl_include_pod. At the top of perl.vim, the default variables are given, and perl_include_pod is unlet by default.

So adding

let perl_include_pod = 1

to ~/.vimrc turns on syntax highlighting, with spell-check, inside POD portions of perl files.

like image 123
andrewdotn Avatar answered Oct 20 '22 22:10

andrewdotn