I've started learning Rust, and have been setting up my Vim workflow to use it. I'm still relatively new to Vim, and mostly what I've written in it is PHP for a website. Now that I'm working with a language where the code is compiled and run, I'm keen to try using the Vim command output, especially while I'm learning and just writing simple programs.
I've added a keybinding so that <C-Enter>
runs the command w | !cargo run
, saving my current file, then building and running the project with cargo
. The command works just fine, but the output isn't quite as easy to read as using a terminal, because I lose the colours that denote errors, warnings, help, etc.
Is there a way to get these colours to show up in the (g)vim command output, to make it as nice to read as from the terminal?
For illustration, here's an example of what it looks like in my terminal:
:make
command for your builds. Besides the convenience the output goes to the "quickfix" window which is explicitly designed for edit-compile-edit workflow and easy navigation of source files listed in compiler output.:make
tip, I've used some of @D. Ben Knoble's answer to configure:make
in a cargo project to runcargo run
.