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 ++++++++++--- fnl/plugins.fnl | 10 +++++----- lazy-lock.json | 14 +++++++------- 7 files changed, 41 insertions(+), 40 deletions(-) delete mode 100644 fnl/config/auto-session.fnl 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] diff --git a/fnl/plugins.fnl b/fnl/plugins.fnl index 8b822b6..1300255 100644 --- a/fnl/plugins.fnl +++ b/fnl/plugins.fnl @@ -88,7 +88,6 @@ :tami5/sqlite.lua :ahmedkhalf/project.nvim :nvim-lua/plenary.nvim - :rmagatti/session-lens :nvim-telescope/telescope-fzf-native.nvim :nvim-telescope/telescope-frecency.nvim :joaomsa/telescope-orgmode.nvim] @@ -96,7 +95,7 @@ (require :config.project) (require :config.telescope))} {1 :tamago324/lir.nvim - :keys :- + :keys "-" :config (fn [] (require :config.lir)) :dependencies [:kyazdani42/nvim-web-devicons]} @@ -121,10 +120,10 @@ :config (fn [] (require :config.harpoon))} ;; Session plugins - {1 :rmagatti/auto-session - :lazy false + {1 :folke/persistence.nvim + :event :VeryLazy :config (fn [] - (require :config.auto-session))} + (require :config.persistence))} ;; Text manipulation {1 :numToStr/Comment.nvim :event :VeryLazy @@ -176,6 +175,7 @@ :event :VimEnter :config (fn [] (require :config.alpha))} + {1 :simrat39/symbols-outline.nvim :cmd :SymbolsOutline :config true} {1 :folke/which-key.nvim :event :VeryLazy :config (fn [] diff --git a/lazy-lock.json b/lazy-lock.json index e239458..b8657ea 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,10 +1,9 @@ { - "Comment.nvim": { "branch": "master", "commit": "ab00bcf5aa979c53f2f40dc2655c03e24f4ef50f" }, + "Comment.nvim": { "branch": "master", "commit": "9516bb2df7a11e2e598da366f2f1e936000b7516" }, "LuaSnip": { "branch": "master", "commit": "5570fd797eae0790affb54ea669a150cad76db5d" }, "SchemaStore.nvim": { "branch": "main", "commit": "c55c35929dd4e670af7ab6e2e197a4687baa2076" }, "alpha-nvim": { "branch": "main", "commit": "21a0f2520ad3a7c32c0822f943368dc063a569fb" }, "aniseed": { "branch": "master", "commit": "9892a40d4cf970a2916a984544b7f984fc12f55c" }, - "auto-session": { "branch": "main", "commit": "c8b2f4048f846387361bd04cc185bf1aa7d2e3d1" }, "better-escape.nvim": { "branch": "master", "commit": "d5ee0cef56a7e41a86048c14f25e964876ac20c1" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "23c51b2a3c00f6abc4e922dbd7c3b9aca6992063" }, @@ -17,7 +16,7 @@ "friendly-snippets": { "branch": "main", "commit": "484fb38b8f493ceeebf4e6fc499ebe41e10aae25" }, "gitsigns.nvim": { "branch": "main", "commit": "d4f8c01280413919349f5df7daccd0c172143d7c" }, "harpoon": { "branch": "master", "commit": "21d0d1bfa3000e4384740bfaefa0ebc51c773786" }, - "lazy.nvim": { "branch": "main", "commit": "7eadaacc48bd4d5eff375c1d303caff51e4ec99e" }, + "lazy.nvim": { "branch": "main", "commit": "c3132492714661121f70daf77d716053ab39bd0b" }, "leap.nvim": { "branch": "main", "commit": "a968ab4250840dc879e805f918b4f3b892310a12" }, "lir.nvim": { "branch": "master", "commit": "84af01547e51e15fc97e878330414385eeb825e8" }, "lspkind-nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" }, @@ -25,7 +24,7 @@ "lualine.nvim": { "branch": "master", "commit": "d8c392dd75778d6258da4e7c55522e94ac389732" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "33a198bc5ee0215ae8ab3f61781b29103cf4ca5a" }, "mason-null-ls.nvim": { "branch": "main", "commit": "c4b4a6fe3cb8d8590b831c22b3475166dc9a894e" }, - "mason.nvim": { "branch": "main", "commit": "73831cbe979fb3b385ed8e61626d16d9306a1f06" }, + "mason.nvim": { "branch": "main", "commit": "55bb4d80e52b79d9a512c7f508091fa2e93d4390" }, "minibar.nvim": { "branch": "master", "commit": "353ca4efaf7fff1566bb02e0d7cb51133c41f660" }, "neogit": { "branch": "master", "commit": "84cf7efba6e4daed11a1185ea09fa553a3ca3d4f" }, "no-clown-fiesta.nvim": { "branch": "master", "commit": "8d4f03c8211a7b5528cd9fa8212d8f1e7baea485" }, @@ -38,20 +37,21 @@ "nvim-lspconfig": { "branch": "master", "commit": "e69978a39e4d3262b09ce6a316beff384f443e3b" }, "nvim-spectre": { "branch": "master", "commit": "68ea562b485b6593e325e7916c3bd6e833d433e7" }, "nvim-surround": { "branch": "main", "commit": "ad56e6234bf42fb7f7e4dccc7752e25abd5ec80e" }, - "nvim-treesitter": { "branch": "master", "commit": "2d8e6b666297ddf19cbf7cbc2b0f1928bc49224a" }, + "nvim-treesitter": { "branch": "master", "commit": "0922634d371d45c344a559119ed398f91e399085" }, "nvim-web-devicons": { "branch": "master", "commit": "7f55bc36eddec87597167a97de5b690997edaf7d" }, "nvim-window-picker": { "branch": "main", "commit": "5902827d0e338890a22849e2f18dc80d1cc1a8db" }, "orgmode": { "branch": "master", "commit": "dadf56334d2be7d9e8ad1e22c697a6e75f0164b7" }, + "persistence.nvim": { "branch": "main", "commit": "8484fdaa284207f77ec69b9627316bf334ad653f" }, "plenary.nvim": { "branch": "master", "commit": "9d81624fbcedd3dd43b38d7e13a1e7b3f873d8cd" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "project.nvim": { "branch": "main", "commit": "685bc8e3890d2feb07ccf919522c97f7d33b94e4" }, - "session-lens": { "branch": "main", "commit": "b15e36782d01abacf6cd44e12f3292632064ab91" }, "sqlite.lua": { "branch": "master", "commit": "53cac3fdb5f5e4e63e243232b6eccf3c764ae18a" }, "stay-in-place.nvim": { "branch": "main", "commit": "c7aa6caad8a0e5181abbf83f50d9d8c7d06ddd43" }, + "symbols-outline.nvim": { "branch": "master", "commit": "6a3ed24c5631da7a5d418bced57c16b32af7747c" }, "telescope-frecency.nvim": { "branch": "master", "commit": "62cbd4e7f55fb6de2b8081087ce97026022ffcd2" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "fab3e2212e206f4f8b3bbaa656e129443c9b802e" }, "telescope-orgmode.nvim": { "branch": "main", "commit": "eabff061c3852a9aa94e672a7d2fa4a1ef63f9e2" }, - "telescope.nvim": { "branch": "master", "commit": "cd67e819e453643b818363e6b573484c8e2e41b0" }, + "telescope.nvim": { "branch": "master", "commit": "04af51dbfb17c2afa0b8d82b0e842e0638201ca9" }, "toggleterm.nvim": { "branch": "main", "commit": "b02a1674bd0010d7982b056fd3df4f717ff8a57a" }, "trim.nvim": { "branch": "master", "commit": "909150606eab44979eb9595145796f5bcb067955" }, "trouble.nvim": { "branch": "main", "commit": "83ec606e7065adf134d17f4af6bae510e3c491c1" }, -- cgit v1.2.3-70-g09d2