我的vim设置
今天晚上写python脚本时需要再配置一下vim,既然配置好了,就分享一下吧,也算是在这里做个备份。
过去好像也有写关于vim配置的文章,不过那个不是自己用的,这个才是。
"description: 自己的vim配置文件 "last change: 2013-01-13 "author : tiandsp "E-mail : dsptian@gmail.com "version : 1.2 set nocompatible "关闭vi的兼容模式 syntax on "自动语法高亮 set nobackup set noswapfile "禁止生成临时文件 filetype plugin indent on set completeopt=longest,menu let g:winManagerWindowLayout='FileExplorer|TagList' nmap wm :WMToggle<cr> colorscheme molokai set t_Co=256 if &cp | set nocp | endif let s:cpo_save=&cpo set cpo&vim map! <S-Insert> <MiddleMouse> nmap gx <Plug>NetrwBrowseX nnoremap <silent> <Plug>NetrwBrowseX :call netrw#NetrwBrowseX(expand("<cWORD>"),0) map <S-Insert> <MiddleMouse> let &cpo=s:cpo_save unlet s:cpo_save set autoindent set backspace=indent,eol,start set cindent set fileencodings=ucs-bom,utf-8,default,latin2 set helplang=cn set history=500 set nomodeline set mouse=a set printoptions=paper:letter set ruler let $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/after set showmatch set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc set tabstop=4 set 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`\"" | \ endif endif " 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