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

前端之家收集整理的这篇文章主要介绍了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.这些可能是由文件类型设置的.

猜你在找的Bash相关文章