Skip to content

I made plugin that saves metadata along with panes (like env vars, etc) #312

@cspotcode

Description

@cspotcode

Some users want the ability to save pane-specific state, such as environment variables or a python virtualenv. When the pane is restored, they want this extra state to be restored as well.

I created https://github.com/cspotcode/tmux-resurrect-metadata to do this in a generic, reusable way. I took the code from https://github.com/ashb/tmux-resurrect-virtualenvwrapper and made it more generic. It will save and restore any tmux settings that start with @resurrect-metadata-. This can be used to save and restore session, pane, or window-specific values.

For example, your shell can call tmux set @tmux-resurrect-$TMUX_PANE-foo $someValue and it'll be automatically saved and restored when tmux-resurrect saves and restores the session. Your shell profile or default command is responsible for reading the values and doing something useful with them. (for example, setting the PATH, customizing the prompt, or setting a venv)

It's a work-in-progress. There needs to be a better mechanism for deleting pane-specific metadata values when the pane is closed, so they don't hang around and affect new panes.

Related to #109, #132, and #240. I hope this helps other people looking for the same thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions