Thursday, July 1, 2010

Re: enable spell for a particular set of files

On 2010-07-01, Andrei Popescu wrote:
> On Jo, 01 iul 10, 13:35:58, Xian Chen wrote:
> > I want to enable spell for .txt and .tex files. Is there any way to do so?
> >
> > I enable spell in .vimrc but it enables for every file, including .c .cpp.
>
> You can do just any setting per filetype with an 'autocmd'. Something
> like this in .vimrc should work
>
> autocmd FileType txt set spell spelllang=en
>
> Use
> :help autocmd
> to get more info.

Since you want to enable spell checking for only certain file types,
change that "set" to "setlocal", e.g.,

autocmd FileType tex setlocal spell

Also, Vim does not have a file type for .txt files. You can either
create your own txt file type, or you can use an autocommand like
this:

autocmd BufNewFile,BufRead *.txt setlocal spell

Regards,
Gary

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