Open SyedFasiuddin opened 2 months ago
:make
:grep
and others block, it would be nice if these commands ran asynchronously and allowed us to use the editor. (similar to how emacs does it)
You can do that already, with https://github.com/tpope/vim-dispatch . If we formalized this in Nvim core, we would probably want to borrow heavily from vim-dispatch.
Meanwhile, I'd really like the ability to "background" any Ex command prefixing it with :&
, e.g. :& make foo
. This would imply spawning a nvim
subprocess and collecting its results.
Related:
On that note, something that would be a great improvement and would give async "for free" would be the ability to run the commands underpinning :make
, :grep
, etc. in a terminal buffer.
For example, the Rust language plugin shipped with Neovim provides :make
support to run cargo build
, but also has a :Cbuild
custom command which runs the same thing in a terminal buffer, which allows showing colors and running it async.
In theory it would even be possible for it to still work with quickfix/errorformat
/grepformat
/etc.
This would conceptually be similar to user-defined "tasks" in VS Code, which can run in a terminal and also capture output.
the ability to run the commands underpinning
:make
,:grep
, etc. in a terminal buffer.
Great idea. Leveraging :terminal
in a more generic way, allowing users to send commands to terminals, like a REPL, is generally a great idea and something we want. Basically a more robust and rich version of the :shell
concept from Vim.
But as you mentioned, the tricky part is integrating it with quickfix.
While we're blue-skying: https://zed.dev/blog/zed-decoded-tasks
(In general, it's hard to draw the line here between what should be in core and/or default and what should be a plugin.)
Problem
Current
:make
:grep
and others block, it would be nice if these commands ran asynchronously and allowed us to use the editor. (similar to how emacs does it)Expected behavior
Use
:make
to start an async compilation and while the compilation is happening we could have a special buffercompile://
which will be collecting the output and once the compilation has finished this output could be sent to the quickfix list.One particular thing we should take care of is jumping to the first error message, we do not want this to happen in async mode as the user might be doing something while the compilation has finished and suddenly be jumped to somewhere else, it would be annoying.