You are not logged in.

#1 2008-11-21 06:25:13

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

[SOLVED] Using vim -- only want spellcheck on for certain filetypes

I've searched around and I'm having a hard time figuring out how to do this. I can globally enable the spellchecking in .vimrc, and I think I saw that I can set a Fn Key to toggle spellcheck, but is there a way to automatically enable it for certain filetypes: e.g. txt, t2t (text2tags), mutt email compose (not sure what filetype that uses), etc?

Thanks!
Scott

Last edited by firecat53 (2008-11-21 19:51:18)

Offline

#2 2008-11-21 06:31:08

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: [SOLVED] Using vim -- only want spellcheck on for certain filetypes

Something like this in your .vimrc should do the trick...tweak it for whatever filetypes you need:

if has("autocmd")
    autocmd BufRead *.txt set spell
    autocmd BufRead /tmp/mutt-* set tw=72 ft=mail nocindent spell  " width, mail syntax hilight, spellcheck
endif

Last edited by thayer (2008-11-21 06:33:13)


thayer williams ~ cinderwick.ca

Offline

#3 2008-11-21 06:33:34

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: [SOLVED] Using vim -- only want spellcheck on for certain filetypes

:h autocmd

3 different ways below:

au BufNewFile,BufRead *.txt setlocal spell
au Syntax text2tags setlocal spell
au FileType mail setlocal spell

They should all do the same thing, it depends on how you want to specify it. Personally, I would use FileType for everything.

Edit: Damn you thayer! tongue

Offline

#4 2008-11-21 19:51:03

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: [SOLVED] Using vim -- only want spellcheck on for certain filetypes

Awesome, thanks guys. I figured it would be easy!

Scott

Offline

Board footer

Powered by FluxBB