A picker plugin for the wonderful resession.nvim plugin, with support for both Telescope and Snacks pickers.
{
"nvim-telescope/telescope.nvim",
dependencies = { "scottmckendry/pick-resession.nvim" },
config = function()
telescope.setup({
-- Other telescope config...
extensions = {
resession = {
prompt_title = "Find Sessions", -- telescope prompt title
dir = "session", -- directory where resession stores sessions
},
},
})
end,
}
-- No setup is required when using the defaults
-- Can be added a dependency for snacks or ressession configs, if desired
{ "scottmckendry/pick-resession.nvim" },
return {
"stevearc/resession.nvim",
config = function()
local resession = require("resession")
resession.setup({})
-- Automatically save sessions on by working directory on exit
vim.api.nvim_create_autocmd("VimLeavePre", {
callback = function()
resession.save(vim.fn.getcwd(), { notify = true })
end,
})
-- Automatically load sessions on startup by working directory
vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
-- Only load the session if nvim was started with no args
if vim.fn.argc(-1) == 0 then
resession.load(vim.fn.getcwd(), { silence_errors = true })
end
end,
nested = true,
})
end,
}
With Telescope:
:Telescope resession
require("telescope").extensions.resession.resession()
With Snacks Picker:
require("pick-resession").pick()
Key Maps:
Picker | Mode | Key Mapping | Description |
---|---|---|---|
Both | Normal, Insert | <CR> |
Load the selected session |
Both | Normal, Insert | <C-d> |
Delete the selected session |
extensions = {
resession = {
prompt_title = "Your custom prompt title",
path_substitutions = {
{ find = "/home/username", replace = "🏠" },
},
},
},
require("pick-resession").setup({
prompt_title = "Your custom prompt title",
layout = "dropdown", -- "default", "dropdown", "ivy", "select", "vscode"
default_icon = {
icon = "📁",
highlight = "Directory"
},
-- These are processed in order, so put more specific matches first
path_icons = {
{ match = "/home/username/projects", icon = "🛠️", highlight = "Special" },
{ match = "/home/username", icon = "🏠", highlight = "Directory" },
},
})