You can run any shell command from one pane and display its output in another pane with the run-shell
command. For example:
tmux run-shell -t 2 "echo hello"
...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:
:!tmux run-shell -t 2 "make ..."
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.
- As for Vim requiring you to hit Enter (or Ctrl+L) after
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:
nnoremap <leader>ls :!ls<CR><C-L>
From Normal mode I hit \ls
and the ls command will run but then the console output will close and return me to vim
right away. Perhaps you can adapt to this whatever your command is.