Why does VIM highlight some words?

后端 未结 3 1375
小蘑菇
小蘑菇 2021-02-07 10:12

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

相关标签:
3条回答
  • 2021-02-07 10:16

    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.

    0 讨论(0)
  • 2021-02-07 10:20

    Most filetypes (like python) in Vim come with a syntax that defines highlight groups (see them via :highlight). A colorscheme then provides combinations of foreground / background color and/or formatting like bold and italic, for terminals, color terminals, and/or GVIM.

    Choose a colorscheme that you find visually appealing; some come with Vim, many more can be found on the Internet, most at http://www.vim.org/.

    If you're just annoyed by one or two minor things in a particular colorscheme, you can modify the items via the :highlight command. To disable a highlighting, use, e.g.

    :highlight clear Statement
    

    or (when the group is linked to another group, effectively inheriting its appearance)

    :highlight link Statement NONE
    

    (These must be issued after the :colorscheme command that sets your preference.)

    0 讨论(0)
  • 2021-02-07 10:33

    I have came across two kinds of highlight that I don't like.

    1.indent highlight and tab arrow reminder, you can solve it by adding

    let g:indent_guides_enable_on_vim_startup = 0
    set nolist
    

    to ~/.vimrc.local

    2.highlight the usual words, like Chinese words and wrong spell words, you can solve it by adding

    set nospell
    

    to ~/.vimrc.local

    0 讨论(0)
提交回复
热议问题