tmux-resurrect icon indicating copy to clipboard operation
tmux-resurrect copied to clipboard

Cannot save when using zsh

Open marianopeck opened this issue 7 years ago • 5 comments

Hi guys,

I am using tmux with zsh on Linux Mint. When I try to save it, I get this error:

 ❯ ^[[4~ fc -R '/home/mpeck/.tmux/resurrect/zsh_history-0:1.1'                                              [16:15:13]
zsh: substitution failed
>>> elapsed time 35s

If add below line to my zshrc:

#bindkey "^u" backward-kill-line

Then I get this when saving the session:

 mpeck@vm-mint64  ~ 
 ❯  fc -lLn -64 > '/home/mpeck/.tmux/resurrect/zsh_history-0:1.1'             [18:51:18]
zsh: file exists: /home/mpeck/.tmux/resurrect/zsh_history-0:1.1

 ✘ mpeck@vm-mint64  ~ 
 ❯  fc -R '/home/mpeck/.tmux/resurrect/zsh_history-0:1.1'                     [18:51:18]

 mpeck@vm-mint64  ~ 
 ❯  

So..2 errors..one is the > when the file exists with zsh. The other one is the print out to console of the read command.

Any ideas how to fix both?

marianopeck avatar May 07 '18 19:05 marianopeck

Same issue here.

phretor avatar Dec 13 '18 11:12 phretor

Ping @marianopeck

phretor avatar Sep 06 '19 14:09 phretor

same issue here.

qz267 avatar Dec 06 '19 20:12 qz267

I also face the same issue. Seems to be caused by zprezto modules. I could solve the first issue by putting this in my zshrc:

bindkey "^E" end-of-line # Map end-of-line key in the same way as zprezto editor module to prevent issue with tmux-resurrect.

The editor module seems to make keybindings for different modes. The end-of-line binding for viins conflicts here. So by adding the same binding which is then also retrieved by tmux-resurrect solves the issue.

The file write issue can be solved by putting this in zshrc:

setopt CLOBBER # Allow pipe to existing file. Prevent issue with history save in tmux-resurrect.

The cleaner way maybe would be that save.sh in resurrect would use force here:

local history_w='fc -lLn -64 >!'

mstaz avatar Jan 13 '21 11:01 mstaz

Thanks @mstaz - this is the first concrete workaround I see in many months!

phretor avatar Jan 13 '21 11:01 phretor