mirror of
https://github.com/zoriya/flake.git
synced 2025-12-06 06:36:19 +00:00
Add scratch function
This commit is contained in:
@@ -159,6 +159,5 @@ in
|
||||
|
||||
# repl
|
||||
usql
|
||||
lua
|
||||
];
|
||||
}
|
||||
|
||||
17
nvim/lua/plugins/scratch.lua
Normal file
17
nvim/lua/plugins/scratch.lua
Normal 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 {}
|
||||
@@ -7,7 +7,9 @@ return {
|
||||
{ "<leader>rr", "<cmd>SnipRun<cr>", desc = "Run code", mode = { "n" } },
|
||||
},
|
||||
opts = {
|
||||
repl_enable = {},
|
||||
selected_interpreters = {
|
||||
"Lua_nvim",
|
||||
},
|
||||
|
||||
display = { "VirtualLine", },
|
||||
live_display = { "VirtualTextOk" },
|
||||
|
||||
Reference in New Issue
Block a user