Search code examples
vimcolor-scheme

Why does VIM highlight some words?


I noticed that with different colorschemes VIM is underlining/highlighting some words. Why is this and how to turn it off ?

Color scheme 1

with another colorscheme

Color scheme 2

I'm using spf13-vim configuration and connecting remotely with Putty.

VIM is correctly assuming this file to be a python file (:set filetype returns "python")


Solution

  • It seems like your Vim is doing spell-checking for you. You can turn this off by adding

    set nospell
    

    in your .vimrc file. To turn it back on in a file, you can do:

    :setlocal spell spelllang=en_us
    

    for spell-checking with American English. :setlocal changes settings for current buffer, while :set makes the changes for all currently open buffers. You can read more about how spell-checking with Vim works here.

    It may be useful for you to automatically enable spell checking for certain files. For example, to enable spell checking in .tex files, you can add the following to your .vimrc:

    " Enable spell checking when opening .tex files
    autocmd!
    au BufNewFile,BufRead *.tex setlocal spell spelllang=en_us
    " Or if you have filetype detection enabled:
    " au FileType tex setlocal spell spelllang=en_us
    

    Note that autocmd! clears the previously defined au commands and is needed only once.