feat(scratch): use Snacks.debug.run() to execute buffer/selection

This commit is contained in:
Folke Lemaitre 2024-12-01 12:46:52 +01:00
parent 7db0ed4239
commit 32c46b4e2f
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
3 changed files with 17 additions and 28 deletions

View file

@ -46,15 +46,10 @@ local defaults = {
lua = {
keys = {
["source"] = {
function()
if vim.fn.mode():match("[vV]") then
vim.fn.feedkeys(":", "nx")
vim.cmd([['<,'>source]])
vim.fn.feedkeys("gv", "n")
else
vim.cmd([[source]])
end
"<cr>",
function(self)
local name = "scratch." .. vim.fn.fnamemodify(vim.api.nvim_buf_get_name(self.buf), ":e")
Snacks.debug.run({ buf = self.buf, name = name })
end,
desc = "Source buffer",
mode = { "n", "x" },