問題描述:安裝完系統之後,剛要打算開始寫程序,發現,vim尚未裝,用su -切換到root後php
直接運行apt-get install vim,提示插入disc源,而後回車,陷入沒法解決的狀態。html
上網經過搜索,找到一下解決方法:java
如下內容均在root的家目錄下完成,python
cd ~shell
先要更新系統的軟件源:vim
sudo cp /etc/apt/sources.list /etc/apt/sources.list_bak #備份一下軟件源 sudo vi /etc/apt/sources.list 加入以下內容便可 # 網易163更新服務器: deb http://mirrors.163.com/debian/ squeeze main non-free contrib deb http://mirrors.163.com/debian/ squeeze-proposed-updates main non-free contrib deb-src http://mirrors.163.com/debian/ squeeze main non-free contrib deb-src http://mirrors.163.com/debian/ squeeze-proposed-updates main non-free contrib # sohu 更新服務器: deb http://mirrors.sohu.com/debian/ lenny main non-free contrib deb http://mirrors.sohu.com/debian/ lenny-proposed-updates main non-free contrib deb-src http://mirrors.sohu.com/debian/ lenny main non-free contrib deb-src http://mirrors.sohu.com/debian/ lenny-proposed-updates main non-free contrib
而後能夠整好更新下系統的源(如下命令是爲了更新系統軟件源,單獨對於安裝vim來講,不執行如下命令沒有任何影響。)
apt-get update
apt-get upgrade
而後開始安裝vim
apt-get install vim
發現,仍然須要插入磁盤
再次去網上檢索,發現,須要把原來的CD-ROM源註釋掉
又從新執行上面的
vi /etc/apt/sources.list
在有cdrom那一行行首添加一個#號
而後再次執行
apt-get install vim
提示舊版本的vim-common已安裝,但新版本的vim-commonn沒法安裝
繼續去網上找,最終經過,手動刪除原來的舊庫,就能夠了
apt-get remove vim-common
最後執行apt-get install vim
大功告成。
在當前帳戶的/home/your_user_name目錄下,編輯(若是沒有,則新建)隱藏文件.vimrc,插入以下配置信息:
syntax on set tabstop=4 set softtabstop=4 set shiftwidth=4 set autoindent set cindent set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s set nu if &term=="xterm" set t_Co=8 set t_Sb=^[[4%dm set t_Sf=^[[3%dm endif set cursorline highlight CursoLine guibg=lightblue ctermbg=lightgray set cursorcolumn set fenc=utf-8 set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936 set nocompatible set history=100 set confirm set clipboard+=unnamed filetype on filetype plugin on filetype indent on set viminfo+=! set iskeyword+=_,$,@,%,#,- syntax on :highlight OverLength ctermbg=red ctermfg=white guibg=red guifg=white :match OverLength '\%101v.*' highlight StatusLine guifg=SlateBlue guibg=Yellow highlight StatusLineNC guifg=Gray guibg=White set nobackup setlocal noswapfile set bufhidden=hide set linespace=0 set wildmenu set ruler set rulerformat=%20(%2*%<%f%=\ %m%r\ %3l\ %c\ %p%%%) set cmdheight=2 set backspace=2 set whichwrap+=<,>,h,l set mouse=a set selection=exclusive set selectmode=mouse,key set report=0 set fillchars=vert:\ ,stl:\ ,stlnc:\ set showmatch set matchtime=5 set ignorecase set nohlsearch set incsearch set listchars=tab:\|\ ,trail:.,extends:>,precedes:<,eol:$ set scrolloff=3 set novisualbell set statusline=%F%m%r%h%w\[POS=%l,%v][%p%%]\%{strftime(\"%d/%m/%y\ -\ %H:%M\")} set laststatus=2 set formatoptions=tcrqn set autoindent set smartindent set cindent set tabstop=4 set softtabstop=4 set shiftwidth=4 set expandtab set nowrap let Tlist_Sort_Type = "name" let Tlist_Use_Right_Window = 1 let Tlist_Compart_Format = 1 let Tlist_Exist_OnlyWindow = 1 let Tlist_Enable_Fold_Column = 0 if has("autocmd") autocmd FileType xml,html,c,cs,java,perl,shell,bash,cpp,python,vim,php,ruby set number autocmd FileType xml,html,vmap <C-o> <ESC>'<i<!--<ESC>o<ESC>'>o--> autocmd FileType java,c,cpp,cs vmap <C-o> <ESC>'<o autocmd FileType html,text,php,vim,c,java,xml,bash,shell,perl,python setlocal textwidth=100 autocmd FileType html,xml,xsl,source $VIMRUNTIME/plugin/closetag.vim autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe " normal g`\"" | \ endif endif "has("autocmd") map <F5> : call CompileRunGcc()<CR> func! CompileRunGcc() exec "w" exec "!gcc % -o %<" exec "! ./%<" endfunc map <F6> : call CompileRunGpp()<CR> func! CompileRunGpp() exec "w" exec "!g++ % -o %<" exec "! ./%<" endfunc set encoding=utf-8 function! SetFileEncodings(encodings) let b:myfileencodingsbak=&fileencodings let &fileencodings=a:encodings endfunction function! RestoreFileEncodings() let &fileencodings=b:myfileencodingsbak unlet b:myfileencodingsbak endfunction au BufReadPre *.nfo call SetFileEncodings('cp437")|set ambiwidth=single au BufReadPost *.nfo callRestorFileEncodings() au BufRead,BufNewFile * setfiletype txt set foldenable set foldmethod=manual nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc':'zo')<CR> let g:miniBufExplMapWindowNavVim = 1 let g:miniBufExplMapWindowNavArrows = 1 let g:miniBufExplMapCTablSwitchBufs = 1 let g:miniBufExplModSelTarget = 1
參考連接:http://www.cnblogs.com/xshwy/archive/2012/07/15/2592381.htmlhttp://m.wenda.so.com/q/1378290958068376http://blog.csdn.net/daofengdeba/article/details/7597619