tmux-resurrect/README.md

120 lines
3.5 KiB
Markdown
Raw Normal View History

# Tmux Resurrect
2014-08-25 19:52:07 +00:00
Restore `tmux` environment after a system restart.
2014-08-26 14:07:04 +00:00
2014-08-28 23:04:03 +00:00
Tmux is great, except when you have to restart the computer. You loose all the
2014-08-27 19:31:10 +00:00
running programs, working directories, pane layouts etc.
There are helpful management tools out there, but they require initial
configuration and continuous updates as your workflow evolves or you start new
projects.
`tmux-resurrect` saves all the little details from tmux environment so it
can be completely restored after a system restart. No configuration is required.
You should feel like you never quit tmux.
2014-08-27 19:31:10 +00:00
2014-08-28 23:04:03 +00:00
It even (optionally) [restores vim sessions](#restoring-vim-sessions)!
2014-08-27 23:09:55 +00:00
### Key bindings
- `prefix + Alt-s` - save
- `prefix + Alt-r` - restore
2014-08-27 19:31:10 +00:00
### About
This plugin goes to great lengths to save and restore all the details from your
`tmux` environment. Here's what's been taken care of:
- all sessions, windows, panes and their order
- current working directory for each pane
2014-08-27 23:09:55 +00:00
- **exact pane layouts** within windows
2014-08-27 19:31:10 +00:00
- active and alternative session
- active and alternative window for each session
2014-08-29 15:04:00 +00:00
- windows with focus
2014-08-27 19:31:10 +00:00
- active pane for each window
2014-08-28 23:04:03 +00:00
- programs running within a pane! More details in the
[configuration section](#configuration).
2014-08-27 23:09:55 +00:00
- restoring vim sessions (optional). More details in
[restoring vim sessions](#restoring-vim-sessions).
2014-08-27 19:31:10 +00:00
Requirements / dependencies: `tmux 1.9` or higher, `pgrep`
2014-08-26 22:11:13 +00:00
2014-08-26 14:07:04 +00:00
### Installation with [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm) (recommended)
Add plugin to the list of TPM plugins in `.tmux.conf`:
set -g @tpm_plugins " \
tmux-plugins/tpm \
tmux-plugins/tmux-resurrect \
2014-08-26 14:07:04 +00:00
"
Hit `prefix + I` to fetch the plugin and source it. You should now be able to
use the plugin.
### Manual Installation
Clone the repo:
$ git clone https://github.com/tmux-plugins/tmux-resurrect ~/clone/path
2014-08-26 14:07:04 +00:00
Add this line to the bottom of `.tmux.conf`:
run-shell ~/clone/path/resurrect.tmux
2014-08-26 14:07:04 +00:00
Reload TMUX environment:
# type this in terminal
$ tmux source-file ~/.tmux.conf
You should now be able to use the plugin.
2014-08-27 19:31:10 +00:00
### Configuration
2014-08-28 23:04:03 +00:00
Configuration is not required - but it enables extra features.
Only a conservative list of programs is restored by default:<br/>
`vi vim emacs man less more tail top htop irssi irb pry "~rails console"`.
2014-08-27 19:31:10 +00:00
Open a github issue if you think some other program should be on the default list.
- Restore additional programs with the setting in `.tmux.conf`:
2014-08-27 19:31:10 +00:00
set -g @resurrect-processes 'ssh psql mysql sqlite3'
2014-08-27 19:31:10 +00:00
- Programs with arguments should be double quoted:
set -g @resurrect-processes 'some_program "git log"'
- Start with tilde to restore a program whose process contains target name:
set -g @resurrect-processes 'some_program "~rails server"'
2014-08-27 19:31:10 +00:00
- Don't restore any programs:
set -g @resurrect-processes 'false'
2014-08-27 19:31:10 +00:00
- Restore **all** programs (be careful with this!):
set -g @resurrect-processes ':all:'
2014-08-27 19:31:10 +00:00
2014-08-27 23:09:55 +00:00
#### Restoring vim sessions
- save vim sessions. I recommend [tpope/vim-obsession](tpope/vim-obsession).
2014-08-27 23:09:55 +00:00
- in `.tmux.conf`:
set -g @resurrect-strategy-vim "session"
2014-08-27 23:09:55 +00:00
`tmux-resurrect` will now restore vim sessions if `Sessions.vim` file is
2014-08-27 23:09:55 +00:00
present.
2014-08-27 19:31:10 +00:00
### Reporting bugs and contributing
Both contributing and bug reports are welcome. Please check out
[contributing guidelines](CONTRIBUTING.md).
2014-08-27 19:31:10 +00:00
### Credits
2014-08-27 23:09:55 +00:00
[Mislav Marohnić](https://github.com/mislav) - the idea for the plugin came from his
2014-08-27 19:31:10 +00:00
[tmux-session script](https://github.com/mislav/dotfiles/blob/master/bin/tmux-session).
2014-08-25 19:52:07 +00:00
### License
[MIT](LICENSE.md)