From 0c3101e386c3c83c079b97710351792f83bc4240 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Fri, 7 Oct 2022 12:20:43 -0400 Subject: [PATCH] Add session manager --- lua/install-plugins.lua | 13 +++++++++++++ lua/plugins/auto-session.lua | 7 +++++++ lua/plugins/lualine-nvim.lua | 8 +++++++- lua/plugins/session-lens.lua | 1 + lua/plugins/telescope.lua | 7 +++++++ lua/user/settings.lua | 1 + 6 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 lua/plugins/auto-session.lua create mode 100644 lua/plugins/session-lens.lua diff --git a/lua/install-plugins.lua b/lua/install-plugins.lua index c5b89d3..d8fb28d 100644 --- a/lua/install-plugins.lua +++ b/lua/install-plugins.lua @@ -355,6 +355,19 @@ return require('packer').startup(function(use) requires = { "nvim-lua/plenary.nvim" }, } use 'dhruvasagar/vim-zoom' + use { + 'rmagatti/auto-session', + config = function() + require('plugins.auto-session') + end + } + use { + 'rmagatti/session-lens', + requires = {'rmagatti/auto-session', 'nvim-telescope/telescope.nvim'}, + config = function() + require('plugins.session-lens') + end + } -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins diff --git a/lua/plugins/auto-session.lua b/lua/plugins/auto-session.lua new file mode 100644 index 0000000..2845729 --- /dev/null +++ b/lua/plugins/auto-session.lua @@ -0,0 +1,7 @@ +vim.o.sessionoptions='blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal' + +require('auto-session').setup({ + log_level = 'error', + auto_session_suppress_dirs = { '~/', '~/workspace', '~/Downloads', '/'}, + auto_session_enable_last_session = true, +}) diff --git a/lua/plugins/lualine-nvim.lua b/lua/plugins/lualine-nvim.lua index 90e6db2..5f255d6 100644 --- a/lua/plugins/lualine-nvim.lua +++ b/lua/plugins/lualine-nvim.lua @@ -1 +1,7 @@ -require('lualine').setup() +require('lualine').setup({ + sections = { + lualine_c = { + require('auto-session-library').current_session_name + } + } +}) diff --git a/lua/plugins/session-lens.lua b/lua/plugins/session-lens.lua new file mode 100644 index 0000000..104a4e7 --- /dev/null +++ b/lua/plugins/session-lens.lua @@ -0,0 +1 @@ +require('session-lens').setup() diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index ac54267..a01a839 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -27,6 +27,7 @@ require('telescope').load_extension('env') require('telescope').load_extension('emoji') require('telescope').load_extension('ui-select') require('telescope').load_extension('project') +require('telescope').load_extension('session-lens') vim.keymap.set( 'n', @@ -154,3 +155,9 @@ vim.keymap.set( [[lua require('telescope').extensions.project.project({ display_type = 'full' })]], { noremap = true, silent = true } ) +vim.keymap.set( + 'n', + '`', + [[lua require('session-lens').search_session()]], + { noremap = true, silent = true } +) diff --git a/lua/user/settings.lua b/lua/user/settings.lua index fbba20a..3fe0e28 100644 --- a/lua/user/settings.lua +++ b/lua/user/settings.lua @@ -31,6 +31,7 @@ vim.opt.mouse = 'a' -- Window decorations vim.opt.title = true +vim.opt.titlestring="%{substitute(getcwd(),$HOME,'~','')} - Neovide" -- Leader vim.g.mapleader = ' '