问题描述:安装完系统以后,刚要打算开始写程序,发现,vim还没有装,用su -切换到root后
直接运行apt-get install vim,提示插入disc源,然后回车,陷入无法解决的状态。
上网通过搜索,找到一下解决方法:
以下内容均在root的家目录下完成,
cd ~
先要更新系统的软件源:
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.html
http://m.wenda.so.com/q/1378290958068376
http://blog.csdn.net/daofengdeba/article/details/7597619