vim异步运行插件文档

翻译mdpdf:

:AsyncRun pandoc --output $(VIM_FILENOEXT).pdf %:p
:AsyncRun chrome %
"打开当前pdf,将chrome加至目录
:AsyncRun ctags -R --fields=+S .
:AsyncRun ctags -R -f %:p:h/ctags.out --fields=+iaS %:p:h
:AsyncRun ctags -R -f $(VIM_FILEDIR)/ctags.out --fields=+iaS %:p:h
"后台更新tag,后二的扩展命令是一样的.

更好为c++服务

let g:asyncrun_open = 6
"修复高
let g:asyncrun_bell = 1
"完成后响铃
"用f10映射
nnoremap <F10> :call asyncrun#quickfix_toggle(6)<cr>
nnoremap <silent> <F5> :AsyncRun -raw -cwd=$(VIM_FILEDIR) "$(VIM_FILEDIR)/$(VIM_FILENOEXT)" <cr>
"$()宏用来扩展

对有空格的加上".在-cwd=$(VIM_FILEDIR)目录运行.linux需要绝对路径,-raw表示格式不匹配vim的.

找根标记

let g:asyncrun_rootmarks = ['.svn', '.git', '.root', '_darcs', 'build.xml']

如父目录无,则用当前目录.用<root>$(VIM_ROOT)来表示根路径.

nnoremap <silent> <F7> :AsyncRun -cwd=<root> make <cr>
nnoremap <silent> <F8> :AsyncRun -cwd=<root> -raw make run <cr>
nnoremap <silent> <F6> :AsyncRun -cwd=<root> -raw make test <cr>
nnoremap <silent> <F4> :AsyncRun -cwd=<root> cmake . <cr>
"窗口下面,为子进程打开新窗口
nnoremap <silent> <F5> :AsyncRun -cwd=$(VIM_FILEDIR) -mode=4 "$(VIM_FILEDIR)/$(VIM_FILENOEXT)" <cr>
nnoremap <silent> <F8> :AsyncRun -cwd=<root> -mode=4 make run <cr>
按键功能
f4更新构建文件(cmake).
f5跑单文件
f6测试.
f7构建项目.
f8运行.
f9编译单文件
f10切换快速窗口.

std::endl来强制刷新c++更新.
完成时回调:

let g:asyncrun_exit = "silent doautocmd QuickFixCmdPost make"
augroup MyGroup
    autocmd User AsyncRunStart call asyncrun#quickfix_toggle(8, 1)
augroup END
"自动打开快速修复.

模式:!

:AsyncRun -mode=bang -cwd=<root> gcc -c "$(VIM_FILENAME)"
augroup vimrc
    autocmd QuickFixCmdPost * call asyncrun#quickfix_toggle(8, 1)
augroup END
"加文本时,自动打开修复窗
augroup vimrc
    autocmd User AsyncRunStart call asyncrun#quickfix_toggle(8, 1)
augroup END
"启动异步时

主要是安装了些环境变量.你可以修改cwd.
在窗口中,用-mode=os打开新窗口.

posted @   zjh6  阅读(22)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示