Skip to main content

plugins.workspace

local workspace = require "plugins.workspace"

plugins.workspace.session​

active​

(field) active: boolean

Whether this is the current session


key​

(field) key: string

Filename within this project's storage directory


name​

(field) name: string

Display name derived from the filename


saved_at​

(field) saved_at: integer?

File modification timestamp


clear_sessions​

function plugins.workspace.clear_sessions()
-> integer

Clear this project's saved sessions and recovery file, preserving open tabs.


get_sessions​

function plugins.workspace.get_sessions()
-> table

List only this project's filenames and timestamps, without loading buffers.


load_session​

function plugins.workspace.load_session(key: string)
-> loaded: boolean

Replace the current document layout with a saved session and back up the outgoing one. Subsequent saves and checkpoints belong to the selected session. A failed backup or restore leaves the current layout and selected session intact.

@param key: string — Original key from get_sessions()

@return loaded: boolean — Whether the requested session was restored


remove_session​

function plugins.workspace.remove_session(key: any)
-> boolean

Remove one saved session, returning to main if it was active.


save_session​

function plugins.workspace.save_session(name?: string)
-> key: string?

Save the current workspace. A name saves and activates an additional session.

@param name?: string — Label for a new saved session; omit to update the active session.

@return key: string? — Storage key, or nil if saving is pending or failed.