I'm using tmux and Vim as my development IDE. I have 3 panes open in tmux: one for editing source code, one for debugging and one as a display console.
From Vim I would like to run the make
command and send all the build information emitted by it to the display console pane. How would I do that?
Best Answer
You can run any shell command from one pane and display its output in another pane with the
run-shell
command. For example:...and "hello" will be printed to pane number 2. You can see pane numbers with
prefix + q
.From
vim
you should be able to do:Add
-b
to run the command in the background.Update: Addressing a couple things that @SLN brought up in this comment...
tmux
puts the output pane into copy-mode, the same mode it is in when you do scrolling, so break out of it however you normally do (Ctrl+C is one way). Note: you'll know you're in this mode if you see something like[12/34]
(i.e. page-num/total-pages) in the upper-right corner of the pane.make
or other command completes, this is just how Vim works with external commands (:!cmd
). I'm not aware of any way to avoid this but I believe you can hit Enter before the command finishes and it will return as soon as it's done. (This might be system dependent.)Update 2: I do know a workaround for the second item. If you use a mapping to run the external command you can embed an exit key. Here's an example where I'm just doing
ls
as my shell command:From Normal mode I hit
\ls
and the ls command will run but then the console output will close and return me tovim
right away. Perhaps you can adapt to this whatever your command is.