特定文件中的Vim 80字符行

时间:2015-03-27 18:56:26

标签: vim character-limit

我最近开始使用Vim。我在.vimrc中设置了80个字符行,使用以下命令:

set colorcolumn=80

但此行不会显示在所有文件中。请看下面的截图:

enter image description here enter image description here

我的.vimrc是here。有谁知道,问题是什么?

1 个答案:

答案 0 :(得分:2)

你的vimrc中散布着以下几行:

" higlight column right after max textwidth
set colorcolumn=+1

" Disable vertical line at max string length in NERDTree
autocmd FileType * setlocal colorcolumn=+1
autocmd FileType nerdtree setlocal colorcolumn=""

set colorcolumn=80

同样相关的是,您显然没有将'textwidth'设置为任何内容,因此它的默认值应为零,并且来自'colorcolumn'上的vim帮助:

  

当' textwidth'为零,然后是' - '和' +'不使用。

因此,我怀疑发生的情况是,作为通配符*的自动命令正在运行并设置colorcolumn=+1,这基本上禁用它,因为'textwidth'为零。

因此,您可以通过确保设置'textwidth'或删除自动命令来解决问题。而且,更一般地说,您应该清理vimrc中'colorcolumn'的各种设置,以免互相否定/干扰。