今天晚上寫python指令碼時需要再配置一下vim,既然配置好了,就分享一下吧,也算是在這裡做個備份。
過去好像也有寫關於vim配置的文章,不過那個不是自己用的,這個才是。
"description: 自己的vim設定檔"last change: 2013-01-13"author : tiandsp "E-mail : dsptian@gmail.com"version : 1.2set nocompatible "關閉vi的相容模式syntax on "自動文法高亮set nobackup set noswapfile "禁止產生臨時檔案filetype plugin indent onset completeopt=longest,menulet g:winManagerWindowLayout='FileExplorer|TagList'nmap wm :WMToggle<cr>colorscheme molokaiset t_Co=256if &cp | set nocp | endiflet s:cpo_save=&cposet cpo&vimmap! <S-Insert> <MiddleMouse>nmap gx <Plug>NetrwBrowseXnnoremap <silent> <Plug>NetrwBrowseX :call netrw#NetrwBrowseX(expand("<cWORD>"),0)map <S-Insert> <MiddleMouse>let &cpo=s:cpo_saveunlet s:cpo_saveset autoindentset backspace=indent,eol,startset cindentset fileencodings=ucs-bom,utf-8,default,latin2set helplang=cnset history=500set nomodelineset mouse=aset printoptions=paper:letterset rulerlet $VIMRUNTIME="/usr/share/vim/vim73" set runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/afterset showmatchset suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.tocset tabstop=4set termencoding=utf-8" vim: set ft=vim :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/*<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`\"" | \ endifendif " has("autocmd") " F5編譯和運行C程式,F6編譯和運行C++程式" F7運行bash指令碼程式,F8運行python指令碼" 請注意,下述代碼在windows下使用會報錯" 需要去掉./這兩個字元" C的編譯和運行map <F5> :call CompileRunGcc()<CR>func! CompileRunGcc()exec "w"exec "!gcc % -g -o %<"exec "! ./%<"endfunc" C++的編譯和運行map <F6> :call CompileRunGpp()<CR>func! CompileRunGpp()exec "w"exec "!g++ % -g -o %<"exec "! ./%<"endfunc" bash指令碼運行map <F7> :call RunBash()<CR>func! RunBash()exec "w"exec "! ./%"endfunc" Python指令碼運行"map <F8> :call RunPython()<CR>func! RunPython()exec "w"exec "!python %"endfunc