From c59fc57dd4980a3e4c96db517402d8b595eadab2 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Wed, 9 Mar 2022 13:37:25 -0600 Subject: [PATCH] Fix session handling --- common/neovim/lua/keymap.lua | 6 ++++++ common/neovim/lua/options.lua | 4 ++-- common/neovim/lua/plugins.lua | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/common/neovim/lua/keymap.lua b/common/neovim/lua/keymap.lua index b62a651..bdaaf61 100644 --- a/common/neovim/lua/keymap.lua +++ b/common/neovim/lua/keymap.lua @@ -32,6 +32,12 @@ local keymap = { [' n'] = "'Nn'[v:searchforward]", [' N'] = "'nN'[v:searchforward]", [''] = ':lua SynGroup()', + + ['s'] = "SessionToggleecho 'Persisting Session: ' .. g:persisting .. ' (' .. getcwd() .. ')'", + ['S'] = "SessionSaveecho 'Saved Session: ' .. getcwd()", + ['l'] = "SessionLoadecho 'Loaded Session: ' .. getcwd()", + ['L'] = "SessionLoadLastecho 'Loaded Last Session: ' .. getcwd()", + ['d'] = "SessionDeleteecho 'Deleted Session for cwd: ' .. getcwd()", }, -- terminal bindings diff --git a/common/neovim/lua/options.lua b/common/neovim/lua/options.lua index b273be9..72896a0 100644 --- a/common/neovim/lua/options.lua +++ b/common/neovim/lua/options.lua @@ -51,10 +51,10 @@ local options = { shortmess = 'filnxToOFIac', history = 1000, undofile = true, - undodir = vim.g.vimdir .. '/undo', + undodir = vim.fn.stdpath'data' .. '/undo', undolevels = 1000, undoreload = 1000, - spellfile = vim.g.vimdir .. '/spell/en.utf-8.add', + spellfile = vim.fn.stdpath'data' .. '/spell/en.utf-8.add', ignorecase = true, smartcase = true, incsearch = true, diff --git a/common/neovim/lua/plugins.lua b/common/neovim/lua/plugins.lua index bbcab19..f61425a 100644 --- a/common/neovim/lua/plugins.lua +++ b/common/neovim/lua/plugins.lua @@ -23,9 +23,10 @@ packer.startup(function() -- session management 'olimorris/persisted.nvim', config = function() - -- TODO: only load session if no arguments passed? + local should_autoload = #vim.v.argv == 1 require'persisted'.setup{ - autoload = true, + autoload = should_autoload, + autosave = should_autoload, } end },