Automatically closing processes when exiting tmux

I am using tmux with tmuxinator to configure it. Different panels always open for me, two or more editor sessions and other things open. Every time I have to close the entire tmux session because I turn off the computer, it takes time because there are processes in different tmux panels that are active. Therefore, I have to manually close each instance of Vim, because if I just kill the panel containing it, then I will have vim exchange files.

So, is there a way to exit the entire tmux session (and not just disconnect it) and automatically close all processes running in it?

+5
source share
2 answers

Tmux Resurrect uses obsession.vim , and this gives you the ability to save and restore Vim sessions upon system reboot.

+2
source

Running tmux kill-server kills all sessions, windows, panels, and all processes running on them. This is a way to completely close everything related to the current start of tmux.

The above, unfortunately, will not solve the problem with vim swap files - you will receive them anyway. I solve the swap problem by having the following line in .vimrc :

 set noswapfile 

As you might have guessed, it disables swap files in vim. If you regularly save files to vim and you have a reliable computer, setting the above parameter may be quite acceptable.

+2
source

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


All Articles