How to get tmux resurrect to restore neovim sessions

I tried both man and htop. Initially htop was restored fine however man (and neovim) were not!

iMy resurrect file looked like:

pane    dotfiles    0   1   :*  0   nvim ~/dotfiles :/home/haseeb/dotfiles  0   nvim    :/home/haseeb/.nix-profile/bin/nvim
pane    dotfiles    0   1   :*  1   man cat ~/dotfiles  :/home/haseeb/dotfiles  1   man :/home/haseeb/.nix-profile/bin/man cat
pane    dotfiles    0   1   :*  2   htop ~/dotfiles :/home/haseeb/dotfiles  0   htop    :htop

So I manually changed it to remove the .nix-profiles folder and leave it like htop like so (scroll across to see the final column):

pane    dotfiles    0   1   :*  0   nvim ~/dotfiles :/home/haseeb/dotfiles  0   nvim    :nvim
pane    dotfiles    0   1   :*  1   man cat ~/dotfiles  :/home/haseeb/dotfiles  1   man :man cat
pane    dotfiles    0   1   :*  2   htop ~/dotfiles :/home/haseeb/dotfiles  0   htop    :htop

Then it worked!

EDIT: The following lines in my tmux config fixed it :slight_smile:

resurrect_dir="$HOME/.tmux/resurrect"
set -g @resurrect-dir $resurrect_dir
set -g @resurrect-hook-post-save-all 'target=$(readlink -f $resurrect_dir/last); sed "s| --cmd .*-vim-pack-dir||g; s|/etc/profiles/per-user/$USER/bin/||g; s|/home/$USER/.nix-profile/bin/||g" $target | sponge $target'