为什么 VIM 突出显示某些单词? [英] Why does VIM highlight some words?

查看:34
本文介绍了为什么 VIM 突出显示某些单词?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到使用不同的颜色方案 VIM 正在下划线/突出显示一些单词.这是为什么以及如何关闭它?

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

另一种配色

我正在使用 spf13-vim 配置并使用 Putty 远程连接.

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

VIM 正确地假设这个文件是一个 python 文件(:set filetype 返回 "python")

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

推荐答案

您的 Vim 似乎正在为您进行拼写检查.您可以通过添加将其关闭

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

set nospell

在你的 .vimrc 文件中.要在文件中重新打开它,您可以执行以下操作:

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

:setlocal spell spelllang=en_us

用美式英语进行拼写检查.:setlocal 更改当前缓冲区的设置,而 :set 更改所有当前打开的缓冲区.您可以在此处阅读更多有关 Vim 拼写检查工作原理的信息.

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.

自动启用某些文件的拼写检查可能对您很有用.例如,要在 .tex 文件中启用拼写检查,您可以在 .vimrc 中添加以下内容:

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

请注意,autocmd! 会清除之前定义的 au 命令,并且只需要一次.

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

这篇关于为什么 VIM 突出显示某些单词?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆