@@ -144,46 +144,6 @@ capture_pane_contents() {
144144 fi
145145}
146146
147- save_shell_history () {
148- if [ " $pane_command " = " bash" ]; then
149- local history_w=' history -w'
150- local history_r=' history -r'
151- local accept_line=' C-m'
152- local end_of_line=' C-e'
153- local backward_kill_line=' C-u'
154- elif [ " $pane_command " = " zsh" ]; then
155- # fc -W does not work with -L
156- # fc -l format is different from what's written by fc -W
157- # fc -R either reads the format produced by fc -W or considers
158- # the entire line to be a command. That's why we need -n.
159- # fc -l only list the last 16 items by default, I think 64 is more reasonable.
160- local history_w=' fc -lLn -64 >'
161- local history_r=' fc -R'
162-
163- local zsh_bindkey=" $( zsh -i -c bindkey) "
164- local accept_line=" $( expr " $( echo " $zsh_bindkey " | grep -m1 ' \saccept-line$' ) " : ' ^"\(.*\)".*' ) "
165- local end_of_line=" $( expr " $( echo " $zsh_bindkey " | grep -m1 ' \send-of-line$' ) " : ' ^"\(.*\)".*' ) "
166- local backward_kill_line=" $( expr " $( echo " $zsh_bindkey " | grep -m1 ' \sbackward-kill-line$' ) " : ' ^"\(.*\)".*' ) "
167- else
168- return
169- fi
170-
171- local pane_id=" $1 "
172- local pane_command=" $2 "
173- local full_command=" $3 "
174- if [ " $full_command " = " :" ]; then
175- # leading space prevents the command from being saved to history
176- # (assuming default HISTCONTROL settings)
177- local write_command=" $history_w '$( resurrect_history_file " $pane_id " " $pane_command " ) '"
178- local read_command=" $history_r '$( resurrect_history_file " $pane_id " " $pane_command " ) '"
179- # C-e C-u is a Bash shortcut sequence to clear whole line. It is necessary to
180- # delete any pending input so it does not interfere with our history command.
181- tmux send-keys -t " $pane_id " " $end_of_line " " $backward_kill_line " " $write_command " " $accept_line "
182- # Immediately restore after saving
183- tmux send-keys -t " $pane_id " " $end_of_line " " $backward_kill_line " " $read_command " " $accept_line "
184- fi
185- }
186-
187147get_active_window_index () {
188148 local session_name=" $1 "
189149 tmux list-windows -t " $session_name " -F " #{window_flags} #{window_index}" |
@@ -266,13 +226,6 @@ dump_pane_contents() {
266226 done
267227}
268228
269- dump_shell_history () {
270- dump_panes |
271- while IFS=$d read line_type session_name window_number window_active window_flags pane_index dir pane_active pane_command full_command; do
272- save_shell_history " $session_name :$window_number .$pane_index " " $pane_command " " $full_command "
273- done
274- }
275-
276229remove_old_backups () {
277230 # remove resurrect files older than 30 days (default), but keep at least 5 copies of backup.
278231 local delete_after=" $( get_tmux_option " $delete_backup_after_option " " $default_delete_backup_after " ) "
@@ -302,9 +255,6 @@ save_all() {
302255 pane_contents_create_archive
303256 rm " $( pane_contents_dir " save" ) " /*
304257 fi
305- if save_shell_history_option_on; then
306- dump_shell_history
307- fi
308258 remove_old_backups
309259 execute_hook " post-save-all"
310260}
0 commit comments