mirror of
https://github.com/tmux-plugins/tmux-resurrect.git
synced 2025-09-09 20:58:45 +00:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
95303946b2 | |||
1d09f07d2b | |||
618769b62f | |||
fac377bf8c | |||
dc7561df74 | |||
eb2cd31d4b | |||
e242ea6d8d | |||
a0a3f2fd56 | |||
d606106f1c | |||
d5598d1c61 |
@ -2,6 +2,15 @@
|
||||
|
||||
### master
|
||||
|
||||
### v1.3.0, 2014-09-20
|
||||
- remove dependency on `pgrep` command. Use `ps` for fetching process names.
|
||||
|
||||
### v1.2.1, 2014-09-02
|
||||
- tweak 'new_pane' creation strategy to fix #36
|
||||
- when running multiple tmux server and for a large number of panes (120 +) when
|
||||
doing a restore, some panes might not be created. When that is the case also
|
||||
don't restore programs for those panes.
|
||||
|
||||
### v1.2.0, 2014-09-01
|
||||
- new feature: inline strategies when restoring a program
|
||||
|
||||
|
16
README.md
16
README.md
@ -27,8 +27,8 @@ Some people can't get `Alt` key mappings to work so they are deprecated.
|
||||
|
||||
For custom key bindings, add to `.tmux.conf`:
|
||||
|
||||
set -g @resurrect-save "S"
|
||||
set -g @resurrect-restore "R"
|
||||
set -g @resurrect-save 'S'
|
||||
set -g @resurrect-restore 'R'
|
||||
|
||||
### About
|
||||
|
||||
@ -47,7 +47,10 @@ This plugin goes to great lengths to save and restore all the details from your
|
||||
- restoring vim sessions (optional). More details in
|
||||
[restoring vim sessions](#restoring-vim-sessions).
|
||||
|
||||
Requirements / dependencies: `tmux 1.9` or higher, `pgrep`
|
||||
Requirements / dependencies: `tmux 1.9` or higher, `bash`.
|
||||
|
||||
`tmux-resurrect` is idempotent! It will not try to restore panes or windows that
|
||||
already exist.
|
||||
|
||||
### Installation with [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm) (recommended)
|
||||
|
||||
@ -84,7 +87,6 @@ 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`.
|
||||
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`:
|
||||
|
||||
@ -98,8 +100,8 @@ Open a GitHub issue if you think some other program should be on the default lis
|
||||
|
||||
set -g @resurrect-processes 'irb pry "~rails server" "~rails console"'
|
||||
|
||||
- If the wrong command is restored, try specifying inline strategy for the
|
||||
program with `->`:
|
||||
- Use `->` to specify a command to be used when restoring a program (useful if
|
||||
the default restore command fails ):
|
||||
|
||||
set -g @resurrect-processes 'some_program "grunt->grunt development"'
|
||||
|
||||
@ -116,7 +118,7 @@ Open a GitHub issue if you think some other program should be on the default lis
|
||||
- save vim sessions. I recommend [tpope/vim-obsession](https://github.com/tpope/vim-obsession).
|
||||
- in `.tmux.conf`:
|
||||
|
||||
set -g @resurrect-strategy-vim "session"
|
||||
set -g @resurrect-strategy-vim 'session'
|
||||
|
||||
`tmux-resurrect` will now restore vim sessions if `Sessions.vim` file is
|
||||
present.
|
||||
|
@ -43,6 +43,9 @@ _process_should_be_restored() {
|
||||
# Scenario where pane existed before restoration, so we're not
|
||||
# restoring the proces either.
|
||||
return 1
|
||||
elif ! pane_exists "$session_name" "$window_number" "$pane_index"; then
|
||||
# pane number limit exceeded, pane does not exist
|
||||
return 1
|
||||
elif _restore_all_processes; then
|
||||
return 0
|
||||
elif _process_on_the_restore_list "$pane_full_command"; then
|
||||
|
@ -99,8 +99,9 @@ new_pane() {
|
||||
local window_number="$2"
|
||||
local window_name="$3"
|
||||
local dir="$4"
|
||||
tmux split-window -t "${session_name}:${window_number}" -c "$dir" -h
|
||||
tmux resize-pane -t "${session_name}:${window_number}" -L "999"
|
||||
tmux split-window -t "${session_name}:${window_number}" -c "$dir"
|
||||
# minimize window so more panes can fit
|
||||
tmux resize-pane -t "${session_name}:${window_number}" -U "999"
|
||||
}
|
||||
|
||||
restore_pane() {
|
||||
|
@ -66,8 +66,9 @@ dump_panes_raw() {
|
||||
}
|
||||
|
||||
pane_full_command() {
|
||||
pane_pid="$1"
|
||||
\pgrep -lf -P "$pane_pid" |
|
||||
local pane_pid="$1"
|
||||
ps -eo "ppid command" |
|
||||
grep "^${pane_pid}" |
|
||||
cut -d' ' -f2-
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user