diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-01-07 12:58:00 +0100 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-01-07 12:58:00 +0100 |
commit | 11eb82bcea1d29a23c7d6bed28f23a86b98cb2a6 (patch) | |
tree | dd6f18c3634399c5f8469a21bdf0deb4dedf2dec /fnl/config | |
parent | dedf2e53f661cde3e50852ddfd5f42cdfe97b215 (diff) |
Replace session manager to persistence.nvim
Diffstat (limited to 'fnl/config')
-rw-r--r-- | fnl/config/alpha.fnl | 1 | ||||
-rw-r--r-- | fnl/config/auto-session.fnl | 17 | ||||
-rw-r--r-- | fnl/config/cmd.fnl | 18 | ||||
-rw-r--r-- | fnl/config/telescope.fnl | 8 | ||||
-rw-r--r-- | fnl/config/which-key.fnl | 13 |
5 files changed, 29 insertions, 28 deletions
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<CR>") (dashboard.button :t " Find text" ":Telescope live_grep theme=dropdown<CR>") - (dashboard.button :s " Find Session" ":SearchSession<CR>") (dashboard.button :p " Find project" ":Telescope projects theme=dropdown<CR>") (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 ["<cmd>Telescope lsp_document_symbols<cr>" "Document Symbols"]}) (def- replace {:name :replace - :f [:<cmd>ReplaceInBuf<cr> "Replace in Buffer"] - :r [:<cmd>Replace<cr> :Replace] - :w [:<cmd>ReplaceWord<cr> "Replace Word"]}) + :m [:<cmd>ReplaceInBuf<cr> "Replace in Buffer"] + :n [:<cmd>Replace<cr> :Replace] + :e [:<cmd>ReplaceWord<cr> "Replace Word"]}) + +(def- session {:name :session + :m [:<cmd>RestoreSession<cr> "Restore session"] + :n [:<cmd>RestoreLastSession<cr> "Restore last session"] + :e [:<cmd>IgnoreSession<cr> "Ignore current session"]}) (def- treesitter {:name :Treesitter :p [:<cmd>TSPlaygroundToggle<cr> :Playground]}) @@ -129,7 +134,9 @@ :h [:<cmd>ColorizerToggle<cr> :Colorizer] :l lsp :m [:<cmd>Mason<cr> :Mason] + :n [:<cmd>SymbolsOutline<cr> "Symbols outline"] :r replace + :s session :t [:<cmd>ToggleTerm<cr> :Terminal] :u [:<cmd>UndotreeToggle<cr> :Undotree] :y ["<cmd>Lazy home<cr>" :Home] |