From 11eb82bcea1d29a23c7d6bed28f23a86b98cb2a6 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Sat, 7 Jan 2023 12:58:00 +0100 Subject: Replace session manager to persistence.nvim --- fnl/config/alpha.fnl | 1 - fnl/config/auto-session.fnl | 17 ----------------- fnl/config/cmd.fnl | 18 ++++++++++++++++++ fnl/config/telescope.fnl | 8 +------- fnl/config/which-key.fnl | 13 ++++++++++--- 5 files changed, 29 insertions(+), 28 deletions(-) delete mode 100644 fnl/config/auto-session.fnl (limited to 'fnl/config') diff --git a/fnl/config/alpha.fnl b/fnl/config/alpha.fnl index 2bb6041..e25e6ab 100644 --- a/fnl/config/alpha.fnl +++ b/fnl/config/alpha.fnl @@ -29,7 +29,6 @@ ":Telescope find_files theme=dropdown") (dashboard.button :t " Find text" ":Telescope live_grep theme=dropdown") - (dashboard.button :s " Find Session" ":SearchSession") (dashboard.button :p " Find project" ":Telescope projects theme=dropdown") (dashboard.button :r " Recently used files" diff --git a/fnl/config/auto-session.fnl b/fnl/config/auto-session.fnl deleted file mode 100644 index 97834f7..0000000 --- a/fnl/config/auto-session.fnl +++ /dev/null @@ -1,17 +0,0 @@ -;; Session manager. -(module config.auto-session {autoload {util config.util}}) - -(def- auto-opts {:log_level :info - :auto_session_enable_last_session false - :auto_session_root_dir (.. (vim.fn.stdpath :data) :/sessions/) - :auto_session_enabled true - :auto_save_enabled nil - :auto_restore_enabled nil - :auto_session_suppress_dirs [(os.getenv :HOME)] - :auto_session_use_git_branch nil - :bypass_session_save_file_types [:alpha]}) - -(set vim.o.sessionoptions - "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal") - -(util.setup :auto-session auto-opts) diff --git a/fnl/config/cmd.fnl b/fnl/config/cmd.fnl index 1971260..e548839 100644 --- a/fnl/config/cmd.fnl +++ b/fnl/config/cmd.fnl @@ -66,3 +66,21 @@ (let [spectre (util.prequire :spectre)] (spectre.open_file_search))) {:nargs 0}) + +(nvim.create_user_command :RestoreSession + (lambda [] + (let [persistence (util.prequire :persistence)] + (persistence.load))) + {:nargs 0}) + +(nvim.create_user_command :RestoreLastSession + (lambda [] + (let [persistence (util.prequire :persistence)] + (persistence.load {:last true}))) + {:nargs 0}) + +(nvim.create_user_command :IgnoreSession + (lambda [] + (let [persistence (util.prequire :persistence)] + (persistence.stop))) + {:nargs 0}) diff --git a/fnl/config/telescope.fnl b/fnl/config/telescope.fnl index a5fc4ab..ac3c33c 100644 --- a/fnl/config/telescope.fnl +++ b/fnl/config/telescope.fnl @@ -3,10 +3,6 @@ (def- opts {:noremap true :silent true}) -(def- lens-opts {:path_display [:shorten] - :previewer false - :prompt_title :Sessions}) - (let [telescope (util.prequire :telescope)] (let [actions (require :telescope.actions)] (telescope.setup {:defaults {:prompt_prefix "  " @@ -83,6 +79,4 @@ (telescope.load_extension :frecency) (telescope.load_extension :orgmode) (telescope.load_extension :projects) - (telescope.load_extension :harpoon) - (util.setup :session-lens lens-opts) - (telescope.load_extension :session-lens))) + (telescope.load_extension :harpoon))) diff --git a/fnl/config/which-key.fnl b/fnl/config/which-key.fnl index 3944959..405fb1c 100644 --- a/fnl/config/which-key.fnl +++ b/fnl/config/which-key.fnl @@ -112,9 +112,14 @@ :s ["Telescope lsp_document_symbols" "Document Symbols"]}) (def- replace {:name :replace - :f [:ReplaceInBuf "Replace in Buffer"] - :r [:Replace :Replace] - :w [:ReplaceWord "Replace Word"]}) + :m [:ReplaceInBuf "Replace in Buffer"] + :n [:Replace :Replace] + :e [:ReplaceWord "Replace Word"]}) + +(def- session {:name :session + :m [:RestoreSession "Restore session"] + :n [:RestoreLastSession "Restore last session"] + :e [:IgnoreSession "Ignore current session"]}) (def- treesitter {:name :Treesitter :p [:TSPlaygroundToggle :Playground]}) @@ -129,7 +134,9 @@ :h [:ColorizerToggle :Colorizer] :l lsp :m [:Mason :Mason] + :n [:SymbolsOutline "Symbols outline"] :r replace + :s session :t [:ToggleTerm :Terminal] :u [:UndotreeToggle :Undotree] :y ["Lazy home" :Home] -- cgit v1.2.3-70-g09d2