Run the command in a different shell from Vim

I use two monitors in my development workflow, one is a full-screen vim session for editing, and the other is a full-screen terminal on which I run make && ./test to display the results. Quite often, I find that I open a bunch of other windows in the background (browers, more shells, etc.). I do not like this for several reasons:

  • I don't like to remember how many times I need to hit a tab before I get my make window.
  • Ubuntu has no strong visual feedback for which the window is currently in focus. Maybe I could do something, but this is a separate problem.
  • Honestly, I'm lazy, and :w alt-tab up-arrow enter alt-tab - too many keystrokes.

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

+4
source share
1 answer

Thanks to Jim's comment to get me started. Here is what I am doing now:

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

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

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

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

And I think that probably one day delay is enough ...

+2
source

Source: https://habr.com/ru/post/1444014/


All Articles