1. 程式人生 > >Debian下安裝vim

Debian下安裝vim

win sed 新版 debian named lec 復制 hide sel

先要更新系統的軟件源:

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
技術分享圖片

Debian下安裝vim