Skip to content

Commit

Permalink
feat: add mapping for deleting sessions
Browse files Browse the repository at this point in the history
Release-As: 0.1.0
  • Loading branch information
scottmckendry committed Jun 22, 2024
1 parent cd8b6b6 commit 7360443
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lua/telescope/_extensions/resession/picker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ local utils = require("telescope._extensions.resession.utils")

local M = {}

-- TODO: add mapping to delete sessions
-- Delete the selected session
---@param prompt_bufnr number
function M.delete_session(prompt_bufnr)
local opts = require("telescope._extensions.resession.config").opts
local session = action_state.get_selected_entry()
local encoded = utils.encode_session(session[1], opts)
require("resession").delete(encoded, { dir = "dirsession" })

-- Refresh the picker
actions.close(prompt_bufnr)
M.resession_picker()
end

--- Load the selected session
---@param prompt_bufnr number
Expand All @@ -32,6 +43,8 @@ function M.resession_picker()
attach_mappings = function(_, map)
map("i", "<CR>", M.load_session)
map("n", "<CR>", M.load_session)
map("i", "<C-d>", M.delete_session)
map("n", "<C-d>", M.delete_session)
return true
end,

Expand Down

0 comments on commit 7360443

Please sign in to comment.