Tmux vs. iTerm2 split panes

VimTmuxIterm

Vim Problem Overview


Why should I use tmux when iterm2 has split panes?

I have never used tmux, and want to know if there are advantages to using that in my workflow instead of the split pane features iterm2 has.

I really like the dimming of inactive windows that iTerm2 split panes offers. Does tmux do something similar?

What are the advantages/disadvantages of each?

Vim Solutions


Solution 1 - Vim

There is another advantage of tmux: what happens if you accidentally close iterm2? If you do it really by accident, you want to reopen everything again. With tmux it is normally as simple as reattaching session without losing anything. Most terminal emulators send SIGHUP to all children which terminates them by default and thus you lose unsaved data (at least, shell and vim command history and other data stored in viminfo) and running processes and thus reopening means rerunning everything.

Solution 2 - Vim

iTerm2 can use tmux for it's split panes. Personally, I'm used to tmux by itself at this point, so I've not leveraged this ability extensively - but if you are used to iTerm2 split panes, you can get the benefits of tmux (mostly screen-like session saving) with the iTerm aesthetics.

https://gitlab.com/gnachman/iterm2/wikis/TmuxIntegration

Solution 3 - Vim

My approach (not based on any particular insight) is to use iTerm tabs and panes to separate servers, and screen / tmux on the server to persist sessions.

I don't often have anything of importance running locally, but often do remotely.

Solution 4 - Vim

Never used iterm2, however I have played with tmux a little and there are several articles about using tmux and vim together. These articles show how you can control a tmux session via the tslime plugin, and others, from Vim. What's nice about it is that you can run a command in Vim to compile your files, run unit tests, etc. without every leaving Vim, but you see the command run in the other tmux pane.

Apologies for not being a complete answer, but hopefully it helps point you in the right direction.

LINK: https://joshuadavey.com/2012/01/10/faster-tdd-feedback-with-tmux-tslime-vim-and-turbux/

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionthatmiddlewayView Question on Stackoverflow
Solution 1 - VimZyXView Answer on Stackoverflow
Solution 2 - VimpraterView Answer on Stackoverflow
Solution 3 - VimkermattView Answer on Stackoverflow
Solution 4 - VimblockcipherView Answer on Stackoverflow