Add scratch function

This commit is contained in:
2025-07-27 21:04:14 +02:00
parent 94e35e9593
commit 6ce1f491a8
3 changed files with 20 additions and 2 deletions
+17
View File
@@ -0,0 +1,17 @@
local function scratch()
local fts = vim.fn.getcompletion("", "filetype")
vim.ui.select(fts, {
prompt = "Scratch ft",
}, function(ft)
if ft == nil then
return
end
local buf = vim.api.nvim_create_buf(false, true)
vim.api.nvim_set_option_value("filetype", ft, { buf = buf })
vim.api.nvim_set_current_buf(buf)
end)
end
vim.keymap.set("n", "<leader>s", scratch, { desc = "Scratch" })
return {}