Linux vi:
1 " F5编译和运行C程序,C++程序,Python程序,shell程序,F9 gdb调试 2 " 请注意,下述代码在windows下使用会报错,需要去掉./这两个字符 3 4 " <F5> 编译和运行C 5 map <F5> :call CompileRunGcc()<CR> 6 func! CompileRunGcc() 7 exec " w " 8 exec " !gcc % -o %< " 9 exec " ! ./%< " 10 endfunc 11 12 " < F5> 编译和运行C++ 13 map <F5> :call CompileRunGpp()<CR> 14 func! CompileRunGpp() 15 exec " w " 16 exec " !g++ % -o %< " 17 exec " ! ./%< " 18 endfunc 19 20 " <F5> 运行python程序 21 map <F5> : w <cr>:!python %<cr> 22 23 " <F5> 运行shell程序 24 map <F5> :call CompileRunSH()<CR> 25 func! CompileRunSH() 26 exec " w " 27 exec " !chmod a+x % " 28 exec " !./% " 29 endfunc 30 31 " <F9> gdb调试 32 map <F9> :call Debug()<CR> 33 func! Debug() 34 exec " w " 35 exec " !gcc % -o %< -gstabs+ " 36 exec " !gdb %< " 37 endfunc
my vimrc file :
1 set nu 2 syntax on 3 set cindent 4 set autoindent 5 set smartindent 6 set softtabstop= 4 7 8 map <F5> :call CompileRunGcc()<CR> 9 func! CompileRunGcc() 10 exec " w " 11 exec " !c++ % -o %< " 12 exec " ! ./%< " 13 endfunc 14 15 " <F5> 运行python程序 16 map <F4> : w <cr>:!python %<cr>
my profile file :
1 alias ls= 'ls -G' 2 set convert-meta off 3 set meta-flag on 4 set output-meta on 5 alias cp= 'cp -i' 6 alias l.='ls -d . * -G' 7 alias ll= 'ls -l' 8 alias mv= 'mv -i' 9 alias rm= 'rm -i' 10 alias l='ll -a'