快捷键及环境变量

_vimrc中加入

"F5 for comment
vmap <F5> :s=^\(//\)*=//=g<cr>:noh<cr>
nmap <F5> :s=^\(//\)*=//=g<cr>:noh<cr>
imap <F5> <ESC>:s=^\(//\)*=//=g<cr>:noh<cr>
"F6 for uncomment
vmap <F6> :s=^\(//\)*==g<cr>:noh<cr>
nmap <F6> :s=^\(//\)*==g<cr>:noh<cr>
imap <F6> <ESC>:s=^\(//\)*==g<cr>:noh<cr>

则加入注释F5,取消注释F6

 

MINGW编译器必须加入环境变量:

用户变量path中加入:D:\Program Files\MinGW\bin\;则gcc相关命令可用

用户变量加入C_INCLUDEDE_PATH  D:\Program Files\MinGW\include\//加入include

LIBRARY_PATH D:\Program Files\MinGW\lib\//加入lib

 

 

" C的编译和运行
imap <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
exec "!gcc % -o %<"
exec "! %<"
endfunc

" C++的编译和运行
imap <F6> :call CompileRunGpp()<CR>
func! CompileRunGpp()
exec "w"
exec "!g++ % -o %<"
exec "! %<"
endfunc


 

posted @ 2012-03-20 10:47  广拓小程序  阅读(683)  评论(0编辑  收藏  举报