"--------------------------------------------------------------------------- " Description: Programming Automation " Help: F2 key or "mm" to compile and debug " Author: ywgx , vimperator@163.com " Version: 1.6 " License: GPL v2.0 "--------------------------------------------------------------------------- syntax on syntax enable set enc=utf-8 filetype plugin indent on set autoindent smartindent nocp set exrc ts=4 sw=4 backspace=2 softtabstop=4 set nu cin magic showmode hlsearch incsearch wildmenu set fileencodings=utf-8,gbk,ucs-bom,cp936,gb2312,gb18030 im ,, im ;; map gk map gj no! no! no! no! nm ;; :q! nm ,, :wqa au FileType python,ruby :call Py() au FileType cpp,c,cc,h :call Cc() func Py() nm mm :call CR1() im mm im if exists("$DISPLAY") nm :call CR() else nm :call CR1() en endf func Cc() ino , , ino ; ; ino <= <= ino *= *= ino /= /= ino >> >> ino << << ino >= >= ino == == ino += += ino && && ino != != nm i l im mm A; im nn A;o nm # :ii# if exists("$DISPLAY") nm :call CR() im :call CR() nm mm :call CR1() else nm :call CR1() im :call CR1() nm mm :call CR1() en nm ca I/*A nm cd :s/\/\*//g:s/\*\///g endf func CR() exe "w" if &filetype == 'c' exe "!gcc -Wall % -o %<" exe "!clear;./%< 2>/dev/null && rm -f %<" elsei &filetype == 'cpp' exe "!g++ -Wall % -o %<" exe "!clear;./%< 2>/dev/null && rm -f %<" elsei &filetype == 'python' exe "!clear;python %" elsei &filetype == 'ruby' exe "!clear;ruby -d %" elsei &filetype == 'sh' exe "!clear;bash %" elsei &filetype == 'pl' exe "!clear;perl %" endif endf func CR1() exe "w" if &filetype == 'c' exe "!gcc -Wall % -o %<" exe "!./%< 2>/dev/null && rm -f %<" elsei &filetype == 'cpp' exe "!g++ -Wall % -o %<" exe "!./%< 2>/dev/null && rm -f %<" elsei &filetype == 'python' exe "!python %" elsei &filetype == 'ruby' exe "!ruby %" elsei &filetype == 'sh' exe "!bash %" elsei &filetype == 'pl' exe "!perl %" endif endf