diff options
| author | 2026-04-17 10:53:20 +0100 | |
|---|---|---|
| committer | 2026-04-17 10:53:20 +0100 | |
| commit | e01f1d6f5d42fac643facecd9ca2d240d53453bd (patch) | |
| tree | 6684173cbd992e4c0b5fa2002b9a6082f866ca51 /home/.config/nvim/lua/plugins/session.lua | |
| parent | dd2bc0a81d7ca6de60a509d8ff1a669e13785f01 (diff) | |
| download | dotfiles-e01f1d6f5d42fac643facecd9ca2d240d53453bd.tar.gz dotfiles-e01f1d6f5d42fac643facecd9ca2d240d53453bd.tar.bz2 dotfiles-e01f1d6f5d42fac643facecd9ca2d240d53453bd.zip | |
feat: migrate from lazy.nvim to vim.pack
Replace lazy.nvim plugin manager with Neovim 0.12's native vim.pack API.
All plugin config files rewritten from lazy.nvim spec tables to imperative
require/setup format with explicit vim.keymap.set() calls.
Key changes:
- vim.pack.add() with ~53 plugins in init.lua
- blink.cmp/pairs/download pinned to version tags (vim.version.range)
- PackChanged autocmd for markdown-preview build hook
- Ordered requires: colorscheme → ui → treesitter → completion → lsp → rest
- Plugin setup guards (gitsigns, which-key, blink.cmp) handle deferred
plugin/ file loading correctly
Net reduction: ~438 lines across 13 files.
Diffstat (limited to 'home/.config/nvim/lua/plugins/session.lua')
| -rw-r--r-- | home/.config/nvim/lua/plugins/session.lua | 151 |
1 files changed, 72 insertions, 79 deletions
diff --git a/home/.config/nvim/lua/plugins/session.lua b/home/.config/nvim/lua/plugins/session.lua index 36759b0..a094727 100644 --- a/home/.config/nvim/lua/plugins/session.lua +++ b/home/.config/nvim/lua/plugins/session.lua @@ -1,84 +1,77 @@ -return { - { - "rmagatti/auto-session", - lazy = false, - opts = function() - local function get_cwd_as_name() - local dir = vim.fn.getcwd(0) - return dir:gsub("[^A-Za-z0-9]", "_") +local function get_cwd_as_name() + local dir = vim.fn.getcwd(0) + return dir:gsub("[^A-Za-z0-9]", "_") +end +local overseer = require("overseer") + +require("auto-session").setup({ + use_git_branch = true, + pre_save_cmds = { + function() + overseer.save_task_bundle( + get_cwd_as_name(), + nil, + { on_conflict = "overwrite" } + ) + end, + }, + pre_restore_cmds = { + function() + for _, task in ipairs(overseer.list_tasks({})) do + task:dispose(true) end - local overseer = require("overseer") - return { - use_git_branch = true, - pre_save_cmds = { - function() - overseer.save_task_bundle( - get_cwd_as_name(), - nil, - { on_conflict = "overwrite" } - ) - end, - }, - pre_restore_cmds = { - function() - for _, task in ipairs(overseer.list_tasks({})) do - task:dispose(true) - end - end, - }, - post_restore_cmds = { - function() - overseer.load_task_bundle( - get_cwd_as_name(), - { ignore_missing = true, autostart = false } - ) - end, - }, - save_extra_data = function(_) - local ok, breakpoints = pcall(require, "dap.breakpoints") - if not ok or not breakpoints then - return - end + end, + }, + post_restore_cmds = { + function() + overseer.load_task_bundle( + get_cwd_as_name(), + { ignore_missing = true, autostart = false } + ) + end, + }, + save_extra_data = function(_) + local ok, breakpoints = pcall(require, "dap.breakpoints") + if not ok or not breakpoints then + return + end - local bps = {} - local breakpoints_by_buf = breakpoints.get() - for buf, buf_bps in pairs(breakpoints_by_buf) do - bps[vim.api.nvim_buf_get_name(buf)] = buf_bps - end - if vim.tbl_isempty(bps) then - return - end - local extra_data = { - breakpoints = bps, - } - return vim.fn.json_encode(extra_data) - end, + local bps = {} + local breakpoints_by_buf = breakpoints.get() + for buf, buf_bps in pairs(breakpoints_by_buf) do + bps[vim.api.nvim_buf_get_name(buf)] = buf_bps + end + if vim.tbl_isempty(bps) then + return + end + local extra_data = { + breakpoints = bps, + } + return vim.fn.json_encode(extra_data) + end, - restore_extra_data = function(_, extra_data) - local json = vim.fn.json_decode(extra_data) + restore_extra_data = function(_, extra_data) + local json = vim.fn.json_decode(extra_data) - if json.breakpoints then - local ok, breakpoints = pcall(require, "dap.breakpoints") + if json.breakpoints then + local ok, breakpoints = pcall(require, "dap.breakpoints") - if not ok or not breakpoints then - return - end - vim.notify("restoring breakpoints") - for buf_name, buf_bps in pairs(json.breakpoints) do - for _, bp in pairs(buf_bps) do - local line = bp.line - local opts = { - condition = bp.condition, - log_message = bp.logMessage, - hit_condition = bp.hitCondition, - } - breakpoints.set(opts, vim.fn.bufnr(buf_name), line) - end - end - end - end, - suppressed_dirs = { "~/", "/" }, - } - end, - }, -} + if not ok or not breakpoints then + return + end + vim.notify("restoring breakpoints") + for buf_name, buf_bps in pairs(json.breakpoints) do + for _, bp in pairs(buf_bps) do + local line = bp.line + local opts = { + condition = bp.condition, + log_message = bp.logMessage, + hit_condition = bp.hitCondition, + } + breakpoints.set(opts, vim.fn.bufnr(buf_name), line) + end + end + end + end, + suppressed_dirs = { "~/", "/" }, +}) |
