2011-09-14 48 views
0

當我打開vim文件時,按下箭頭鍵時出現垃圾字符。vim在打開文件後在按下箭頭鍵時顯示垃圾字符

我還定義下面我~/.vimrc

set nocompatible 

我使用的膩子進行登錄。這是一個膩子問題嗎?

請幫

編輯:如果我刪除我的〜/ .vimrc,那麼問題也將被刪除。

+0

它是一個二進制文件? –

+0

不,它是一個簡單的文本文件。 – shampa

+0

當你做'貓your_file'時你看到了什麼? –

回答

0

我已經使用下面的代碼作爲.vimrc文件,它已經解決了我所有的問題。

" When started as "evim", evim.vim will already have done these settings. 
if v:progname =~? "evim" 
    finish 
endif 

" Use Vim settings, rather than Vi settings (much better!). 
" This must be first, because it changes other options as a side effect. 
set nocompatible 

" allow backspacing over everything in insert mode 
set backspace=indent,eol,start 

if has("vms") 
    set nobackup  " do not keep a backup file, use versions instead 
else 
    set backup  " keep a backup file 
endif 
set history=50  " keep 50 lines of command line history 
set ruler  " show the cursor position all the time 
set showcmd  " display incomplete commands 
set incsearch  " do incremental searching 

" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries 
" let &guioptions = substitute(&guioptions, "t", "", "g") 

" Don't use Ex mode, use Q for formatting 
map Q gq 

" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, 
" so that you can undo CTRL-U after inserting a line break. 
inoremap <C-U> <C-G>u<C-U> 

" In many terminal emulators the mouse works just fine, thus enable it. 
if has('mouse') 
    set mouse=a 
endif 

" Switch syntax highlighting on, when the terminal has colors 
" Also switch on highlighting the last used search pattern. 
if &t_Co > 2 || has("gui_running") 
    syntax on 
    set hlsearch 
endif 

" Only do this part when compiled with support for autocommands. 
if has("autocmd") 

    " Enable file type detection. 
    " Use the default filetype settings, so that mail gets 'tw' set to 72, 
    " 'cindent' is on in C files, etc. 
    " Also load indent files, to automatically do language-dependent indenting. 
    filetype plugin indent on 

    " Put these in an autocmd group, so that we can delete them easily. 
    augroup vimrcEx 
    au! 

    " For all text files set 'textwidth' to 78 characters. 
    autocmd FileType text setlocal textwidth=78 

    " When editing a file, always jump to the last known cursor position. 
    " Don't do it when the position is invalid or when inside an event handler 
    " (happens when dropping a file on gvim). 
    " Also don't do it when the mark is in the first line, that is the default 
    " position when opening a file. 
    autocmd BufReadPost * 
    \ if line("'\"") > 1 && line("'\"") <= line("$") | 
    \ exe "normal! g`\"" | 
    \ endif 

    augroup END 

else 

    set autoindent  " always set autoindenting on 

endif " has("autocmd") 

" Convenient command to see the difference between the current buffer and the 
" file it was loaded from, thus the changes you made. 
" Only define it when not defined already. 
if !exists(":DiffOrig") 
    command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis 
      \ | wincmd p | diffthis 
endif 

只需保存了上述案文

的.vimrc

+1

如果你可以確定解決問題的路線。這個文件的大部分內容與手頭的問題無關。 –