map <F5> :call CompileRunCL()<cr> 使用F5 鍵編譯並運行
map <F7> :call CompileCL()<cr> 使用F7鍵進行編譯
func! CompileRunCL()
" save files
exec "w"
" compile file using /GX
exec "!cl % -o %< -nologo /GX"
" run the result
exec "! %<.exe"
exec "i"
endfunc
func! CompileCL()
exec "w"
exec "!cl % -o %< -nologo /GX"
exec "i"
endfunc
map <F7> :call CompileCL()<cr> 使用F7鍵進行編譯
func! CompileRunCL()
" save files
exec "w"
" compile file using /GX
exec "!cl % -o %< -nologo /GX"
" run the result
exec "! %<.exe"
exec "i"
endfunc
func! CompileCL()
exec "w"
exec "!cl % -o %< -nologo /GX"
exec "i"
endfunc

本文介绍了一种在Vim编辑器中设置快捷键进行C语言源文件的保存、编译及运行的方法。通过定义F5和F7键的功能,实现了快速编译与运行的工作流程。
&spm=1001.2101.3001.5002&articleId=767426&d=1&t=3&u=5502241ffeeb47bf8e70d5b01a28641f)
1704

被折叠的 条评论
为什么被折叠?



