I mainly use vim as an editor for C/C++ programming. Unfortunately, I'm not quite satisfied with the way my build process works. I know that it's possible to type in (or map to a key) :make
to run the make process. I dislike the way this command works, though, as it runs the build process in the same terminal window without proper highlighting. I therefore usually run the make command in another window on my second monitor so that I have both proper highlighting and can look at the build errors the compiler shows me in one window while scrolling through the source code in my main vim window. This is also quite tedious because it requires me to change focus to another window, then type in the make command.
Now, my question is as follows: Is it possible to make vim run the make command in this other window without having to change focus? This way, I could just map the "build in other window" command to some key in vim and could achieve all of this with a single key press.
My system is Manjaro Linux with i3 as DWM.
(I was unsure wether to post this on stackoverflow or here, please forgive me if this is the wrong forum.)
With named pipes:
make
output and create a new pipe with mkfifo mypipe
.watch --color -n 0.3 'cat mypipe'
to always be reading the named pipe.:!script -q -c "make" mypipe > /dev/null
in Vim after saving changes to your source code.We have to use script
to trick the program to keeping the colored output. Make sure your version of watch
supports color.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments