Alex
Alex

Reputation: 295

Perform a command in another shell from Vim

I use two monitors in my development workflow, one is a fullscreen vim session for editing and the other is a fullscreen terminal where I run make && ./test to show results. Fairly often I find myself opening a bunch of other windows in the background (browers, more shells etc). I don't like this for a few reasons:

I think a good solution might be to have a vim command that runs make && ./test in the other window, but I can't think of how to do this. I could write a server/client script that waits from some notification from vim then runs the command but it really seems like there should be a simpler solution. Any thoughts?

Upvotes: 4

Views: 163

Answers (1)

Alex
Alex

Reputation: 295

Thanks to Jim's comment for getting me started. This is what I'm doing now:

On the first monitor: tmux new-session -s dev (creates a new tmux session named dev)

On the second monitor: tmux new -t dev (connects to that new session)

On the second monitor: Ctrl-b + c (creates a new window)

I forked vimux and wrote functions to send commands to another window. So now in vim I can use :call VimuxRunCommandWin("make && ./test").

And I think that's probably enough procrastination for one day...

Upvotes: 2

Related Questions