vim/neovim callback on terminal command completion

落花浮王杯 提交于 2021-02-11 13:10:53

问题


So now both vim and neovim support terminal emulators inside them (with the terminal command). (I use neovim.)

I often open a terminal inside vim and run some long running build/test command in it, I then close its window in order to save space for coding. I then have to check back on that terminal periodically to see if the command it ran has completed.

Is there a way vim can listen to terminal command completion (through interprocess communication or some other way) ?

That way I can automatically bring the terminal buffer to the foreground as soon as its command completes.

I know there are a bunch of async job plugins (for vim and neovim) that support such callback feature, eg: https://github.com/skywind3000/asyncrun.vim and others. But based on my research they all have all/some of the following limitations:

  1. They don't support multiple simultaneous background jobs.
  2. They use quickfix command to show the result. Since there's only 1 quickfix window, the output often gets messed up (If I use some other plugin in the meantime that writes to quickfix window.). (Using location list won't really help as well as it's still one per window and its local to window). Plus it would need plugin code modification.
  3. Being able to use native terminal emulator instead of these plugins would create better experience (eg: some commands produce colored output).

来源:https://stackoverflow.com/questions/64057107/vim-neovim-callback-on-terminal-command-completion

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!