[英]Why are some settings in my .vimrc not working?
这是我的.vimrc(我在Windows XP上使用gVimPortable):
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
syntax enable
set background=light
colorscheme solarized
set formatoptions+=t
set tw=10
nmap <leader>s dwwP
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
出于某种原因, colorscheme
可以工作,但是诸如set formatoptions+=t
和set tw=10
则不能
文本完全不被换行(长度超过10个字符)。
可能是什么问题呢?
诸如'formatoptions'
类'formatoptions'
设置通常由文件类型插件修改(您可以通过vimrc_example.vim
启用它们)。
您可以通过以下方式找到该选项的最后修改位置
:verbose setlocal formatoptions?
如果那样给您ftplugin/foo.vim
,则必须通过~/.vim/after/ftplugin/foo.vim
的:setlocal
命令覆盖它(或完全禁用文件类型插件)。
tw
上的:help
表示设置了compatible
时将其设置为0(禁用)。 是compatible
在一个地方,我们看不到它(后也许集nocompatible
在源文件中的一个起点)?
您应该选择想要的:
.vimrc
set textwidth=30
)来实现。 然后,可以通过标记文本(可视模式)并键入gq
来重新格式化文本。 set wrap
:将set wrap
添加到.vimrc
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.