微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

VIM在输入时为换行符添加了一个字符

我环顾四周,但没有找到答案.我有一台运行与我的CentOS 5.8服务器相同的. vimrc的CentOS 6.2服务器,但是当我在我的6.2服务器上输入VIM时,它会添加上一行的第一个字符,如果它是某个字符(%或#是我见过的那些).这就是VIM中发生的事情(点击输入后的秒线,但没有输入任何其他内容):
# <enter>
#

% <enter>
%

这是我的.vimrc:

set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set showmatch
set number

imap jj <Esc> " Professor VIM says '87% of users prefer jj over esc',jj abrams disagrees

" Indenting *******************************************************************
set ai " Automatically set the indent of a new line (local to buffer)
set si " smartindent (local to buffer)

" Cursor highlights ***********************************************************
"set cursorline
"set cursorcolumn

" Set an orange cursor in insert mode,and a red cursor otherwise.
" Works at least for xterm and rxvt terminals.
" Does not work for gnome terminal,konsole,xfce4-terminal.
"if &term =~ "xterm\\|rxvt"
"   :silent !echo -ne "\033]12;red\007"
"   let &t_SI = "\033]12;orange\007"
"   let &t_EI = "\033]12;red\007"
"   autocmd VimLeave * :!echo -ne "\033]12;red\007"
"endif

" Searching *******************************************************************
set hlsearch  " highlight search
set incsearch  " Incremental search,search as you type
set ignorecase " Ignore case when searching
set smartcase " Ignore case when searching lowercase

" Colors **********************************************************************
"set t_Co=256 " 256 colors
set background=dark
Syntax on " Syntax highlighting
"colorscheme darkzen

对它和我5.8服务器上的那个(我没有这个问题)的差异并没有任何区别.知道为什么会这样吗?

它看起来像 automatic comment insertion.

看看:help formatoptions和:set formatoptions.这些可能是由文件类型设置的.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐