2012-06-22 8 views
7

Mi sono guardato intorno ma non ho trovato una risposta a questo. Ho un server CentOS 6.2 in esecuzione con lo stesso .vimrc del mio server CentOS 5.8, tuttavia quando premo invio in VIM sul mio server 6.2, aggiunge il primo carattere della riga precedente se si tratta di un determinato carattere (% o # sono i quelli che ho visto). Questo è ciò che accade a VIM (Le linee secondi sono di destra dopo aver colpito entrare, ma senza scrivere altro):VIM aggiunge un carattere a una nuova riga al momento di premere invio

# <enter> 
# 

% <enter> 
% 

Ecco la mia 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 

Ran un diff contro di esso e quello sul mio server 5.8 (dove non ho questo problema) e non c'era alcuna differenza. Qualche idea sul perché questo possa accadere?

+6

+1 per: 'Il professor VIM dice che '87% degli utenti preferisce jj su esc ', jj abrams non è d'accordo' –

+0

Dipende dai plugin di tipo file. –

risposta

2

Sembra automatic comment insertion.

Dai un'occhiata a: helpoptionsoptions e: set formatoptions. Questi sono probabilmente impostati per tipo di file.

2

Corsa verbose set formatoptions. Dovresti recuperare una stringa che contiene 'r', che è Automatically inserts the current comment leader after hitting <Enter> in Insert mode. Il bit verbose dovrebbe puntare al file (probabilmente un plugin di tipo file) che è il colpevole.

Impedisco a vim di dirottare le mie opzioni di formattazione tramite l'autocommand au FileType * set formatoptions=lq nel mio vimrc. La maggior parte delle opzioni mi fa impazzire, anche se r e o sono di gran lunga il peggiore.

+0

Amo entrambe le tue risposte ed è stato davvero r e o scherzi con me. Grazie mille, stava diventando piuttosto fastidioso. –

Problemi correlati