Skip to content

Commit

Permalink
feat: adds session persistence
Browse files Browse the repository at this point in the history
  • Loading branch information
ixahmedxi committed Dec 17, 2022
1 parent edc5dc2 commit dff755e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
plugin
.DS_Store
sessions
12 changes: 10 additions & 2 deletions lua/config/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ return packer.startup(function(use)
use("L3MON4D3/LuaSnip")
use("rafamadriz/friendly-snippets")
use("onsails/lspkind.nvim")
use("zbirenbaum/copilot.lua")
use("zbirenbaum/copilot-cmp")
use("zbirenbaum/copilot.lua")
use("zbirenbaum/copilot-cmp")

-- LSP
use("williamboman/mason.nvim")
Expand Down Expand Up @@ -135,6 +135,14 @@ return packer.startup(function(use)
use("rcarriga/nvim-notify")
use("ThePrimeagen/vim-be-good")
use("aserowy/tmux.nvim")
use({
"folke/persistence.nvim",
event = "BufReadPre",
module = "persistence",
config = function()
require("persistence").setup()
end,
})

if PACKER_BOOTSTRAP then
require("packer").sync()
Expand Down
2 changes: 1 addition & 1 deletion lua/config/toggleterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import("toggleterm", function(toggleterm)
terminal_mappings = true,
insert_mappings = true,
shade_terminals = false,
start_in_insert = false,
start_in_insert = true,
})

function _G.set_terminal_keymaps()
Expand Down
16 changes: 11 additions & 5 deletions lua/config/which-key.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ import("which-key", function(whichKey)
["g"] = { "<cmd>TypescriptGoToSourceDefinition<CR>", "Go to source definition" },
["r"] = { "<cmd>TypescriptRenameFile<CR>", "Rename file" },
},
["r"] = {
name = "Rust",
["r"] = { "<cmd>RustRun<cr>", "Run" },
["a"] = { "<cmd>RustRunnables<cr>", "Runnables"}
},
["r"] = {
name = "Rust",
["r"] = { "<cmd>RustRun<cr>", "Run" },
["a"] = { "<cmd>RustRunnables<cr>", "Runnables" },
},
["u"] = {
name = "Trouble",
r = { "<cmd>TroubleToggle lsp_references<cr>", "References" },
Expand All @@ -111,6 +111,12 @@ import("which-key", function(whichKey)
},
["t"] = { "<cmd>ToggleTermToggleAll<cr>", "Toggle terminals" },
["m"] = { "<cmd>lua require('harpoon.mark').add_file()<cr>", "Mark file" },
["s"] = {
name = "Session",
["s"] = { "<cmd>lua require('persistence').load()<cr>", "Load current directory" },
["l"] = { "<cmd>lua require('persistence').load({ last = true })<cr>", "Load last session" },
["d"] = { "<cmd>lua require('persistence').stop()<cr>", "Stop session" },
},
}

whichKey.setup(setup)
Expand Down

0 comments on commit dff755e

Please sign in to comment.