From 545bb3793cd11acc472c35f4b70d214b6d5bf17b Mon Sep 17 00:00:00 2001 From: Aadi Rave Date: Tue, 25 Mar 2025 20:55:14 -0400 Subject: [PATCH] added persistence --- init.lua | 20 ++++++++++++++++++++ lua/custom/plugins/init.lua | 9 +++++++++ 2 files changed, 29 insertions(+) diff --git a/init.lua b/init.lua index 39fbf855..b9d9c984 100644 --- a/init.lua +++ b/init.lua @@ -217,6 +217,24 @@ on_attach = end, }) +-- Persistence settings +-- load the session for the current directory +vim.keymap.set('n', 'ws', function() + require('persistence').load() +end) +-- select a session to load +vim.keymap.set('n', 'wS', function() + require('persistence').select() +end) +-- load the last session +vim.keymap.set('n', 'wl', function() + require('persistence').load { last = true } +end) +-- stop Persistence => session won't be saved on exit +vim.keymap.set('n', 'wd', function() + require('persistence').stop() +end) + -- tab management keybinds local map = vim.api.nvim_set_keymap local opts = { noremap = true, silent = true } @@ -549,6 +567,8 @@ require('lazy').setup({ Rule('(', ')', { 'typst', 'typ', 'latex', 'tex' }), Rule('{', '}', { 'typst', 'typ', 'latex', 'tex' }), Rule('[', ']', { 'typst', 'typ', 'latex', 'tex' }), + Rule('_', '_', { 'typst', 'markdown' }), + Rule('*', '*', 'typst'), } -- Brief aside: **What is LSP?** diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index a802bd86..147cb421 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -378,4 +378,13 @@ return { }, }, }, + + -- persistence + { + 'folke/persistence.nvim', + event = 'BufReadPre', -- this will only start session saving when an actual file was opened + opts = { + -- add any custom options here + }, + }, }