summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-08-08 13:51:12 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-08-08 13:51:12 +0200
commit98f906b644a24dfb10b2eaa56ccc7c99c94c876f (patch)
tree99046bf5fd111dbdfbe6b4a793c57fa354af2927
parent9dd308b444ede3a68a29961e956937d2ce402e45 (diff)
Add session plugin
-rw-r--r--fnl/config/alpha.fnl6
-rw-r--r--fnl/config/auto-session.fnl20
-rw-r--r--fnl/config/init.fnl1
-rw-r--r--fnl/config/telescope.fnl1
-rw-r--r--fnl/plugins.fnl2
5 files changed, 28 insertions, 2 deletions
diff --git a/fnl/config/alpha.fnl b/fnl/config/alpha.fnl
index fcbbb8c..0f0f680 100644
--- a/fnl/config/alpha.fnl
+++ b/fnl/config/alpha.fnl
@@ -24,12 +24,14 @@
(let [dashboard (require :alpha.themes.dashboard)]
(set dashboard.section.header.val ascii-art)
(set dashboard.section.buttons.val
- [(dashboard.button :f " Find file" ":Telescope find_files <CR>")
+ [
(dashboard.button :e " New file" ":ene <BAR> startinsert <CR>")
+ (dashboard.button :f " Find file" ":Telescope find_files <CR>")
+ (dashboard.button :t " Find text" ":Telescope live_grep <CR>")
+ (dashboard.button :s " Find Session" ":SearchSession<CR>")
(dashboard.button :p " Find project" ":Telescope projects <CR>")
(dashboard.button :r " Recently used files"
":Telescope oldfiles <CR>")
- (dashboard.button :t " Find text" ":Telescope live_grep <CR>")
(dashboard.button :c " Configuration"
":e ~/.config/nvim/init.lua <CR>")
(dashboard.button :q " Quit Neovim" ":qa<CR>")])
diff --git a/fnl/config/auto-session.fnl b/fnl/config/auto-session.fnl
new file mode 100644
index 0000000..62e28b4
--- /dev/null
+++ b/fnl/config/auto-session.fnl
@@ -0,0 +1,20 @@
+;; Session manager.
+(module config.auto-session {autoload {: 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]})
+
+(def- lens-opts {:path_display [:shorten]
+ :previewer false
+ :prompt_title :Sessions})
+
+(set vim.o.sessionoptions "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal")
+(util.use-config :session-lens lens-opts)
+(util.use-config :auto-session auto-opts)
diff --git a/fnl/config/init.fnl b/fnl/config/init.fnl
index 1f7c174..ade6d91 100644
--- a/fnl/config/init.fnl
+++ b/fnl/config/init.fnl
@@ -1,6 +1,7 @@
;; Load all plugin configs.
(module config.init {require [config.aerial
config.alpha
+ ;;config.auto-session
config.autocmd
config.autopairs
config.better-escape
diff --git a/fnl/config/telescope.fnl b/fnl/config/telescope.fnl
index 9d11106..a53433d 100644
--- a/fnl/config/telescope.fnl
+++ b/fnl/config/telescope.fnl
@@ -77,4 +77,5 @@
:case_mode :smart_case}}})
(telescope.load_extension :fzf)
(telescope.load_extension :file_browser)
+ (telescope.load_extension :session-lens)
(telescope.load_extension :projects)))
diff --git a/fnl/plugins.fnl b/fnl/plugins.fnl
index 27d9e0d..070c16c 100644
--- a/fnl/plugins.fnl
+++ b/fnl/plugins.fnl
@@ -4,6 +4,7 @@
:stevearc/aerial.nvim {}
:goolord/alpha-nvim {}
:Olical/aniseed {}
+ :rmagatti/auto-session {}
:max397574/better-escape.nvim {}
:hrsh7th/cmp-buffer {}
:hrsh7th/cmp-cmdline {}
@@ -47,6 +48,7 @@
:nvim-lua/popup.nvim {}
:ahmedkhalf/project.nvim {}
:b0o/SchemaStore.nvim {}
+ :rmagatti/session-lens {}
:lewis6991/spellsitter.nvim {}
:gbprod/stay-in-place.nvim {}
:nvim-telescope/telescope-file-browser.nvim {}