Loading ...
Sorry, an error occurred while loading the content.

enable spell for a particular set of files

Expand Messages
  • Xian Chen
    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. Thanks,
    Message 1 of 4 , Jul 1 10:35 AM
    • 0 Attachment
      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.

      Thanks,

      --
      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
    • Andrei Popescu
      ... 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 ...
      Message 2 of 4 , Jul 1 10:57 AM
      • 0 Attachment
        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.

        Regards,
        Andrei
        --
        If you can't explain it simply, you don't understand it well enough.
        (Albert Einstein)
      • Gary Johnson
        ... 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
        Message 3 of 4 , Jul 1 11:54 AM
        • 0 Attachment
          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
        • Andrei Popescu
          ... Thanks, just did a s/set/setlocal/ for all my FileType autocmds ;) Regards, Andrei -- If you can t explain it simply, you don t understand it well enough.
          Message 4 of 4 , Jul 1 12:37 PM
          • 0 Attachment
            On Jo, 01 iul 10, 11:54:10, Gary Johnson wrote:

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

            Thanks, just did a s/set/setlocal/ for all my FileType autocmds ;)

            Regards,
            Andrei
            --
            If you can't explain it simply, you don't understand it well enough.
            (Albert Einstein)
          Your message has been successfully submitted and would be delivered to recipients shortly.