Automatically closing processes when quitting tmux
Asked Answered
B

2

7

I'm using tmux with tmuxinator to configure it. I always have different panes open, with two or more editor sessions open and other stuff. Every time I have to close the whole tmux session, because I'm turning off the computer, it takes time, because there are processes active in various tmux panes. So I have to manually quit every Vim instance, because if I just kill the pane containing it, then I will end up having vim swap files.

So, is there a way to quit the whole tmux session (not just detaching it) and automatically closing all the processes running in it?

Burmese answered 11/9, 2014 at 9:38 Comment(2)
This is a good question. I find set synchronize-panes useful to close several windows on a given pane. But it would be useful to have a "shutdown" command (possibly with customizable options according to the process name/tmux-window name).Ferrer
It seems someone else already thought of it: tmuxinator ticket on githubFerrer
S
4

Executing tmux kill-server kills all the sessions, windows, panes and also all processes running in them. This is the way to completely quit everything related to currently running tmux.

The above will unfortunately not solve the issue with vim swap files - you will still get them. I solve the swap-file issue by having the following line in .vimrc:

set noswapfile

As you might guess, it disables swap files in vim. If you save files in vim regularly and you have a reliable computer, setting the above option might be perfectly acceptable.

Swaine answered 13/9, 2014 at 21:7 Comment(0)
M
2

Tmux Resurrect uses obsession.vim and it gives you the ability to save & restore Vim sessions on system reboot.

Michal answered 12/9, 2014 at 17:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.