mirror of
https://github.com/DefectingCat/nvim
synced 2025-07-16 01:01:34 +00:00
add filetypes source for snacks
This commit is contained in:
@ -179,6 +179,7 @@ return {
|
||||
-- https://github.com/folke/snacks.nvim/discussions/860#discussioncomment-12027395
|
||||
picker = {
|
||||
sources = {
|
||||
-- change explorer to right
|
||||
explorer = {
|
||||
include = { "ignored", "hidden" },
|
||||
layout = {
|
||||
@ -187,6 +188,34 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
-- add filetypes source
|
||||
filetypes = {
|
||||
name = "filetypes",
|
||||
format = "text",
|
||||
preview = "none",
|
||||
layout = {
|
||||
preview = "main",
|
||||
preset = "ivy",
|
||||
},
|
||||
confirm = function(picker, item)
|
||||
picker:close()
|
||||
if item then
|
||||
vim.schedule(function()
|
||||
vim.cmd("setfiletype " .. item.text)
|
||||
end)
|
||||
end
|
||||
end,
|
||||
finder = function()
|
||||
local items = {}
|
||||
local filetypes = vim.fn.getcompletion("", "filetype")
|
||||
for _, type in ipairs(filetypes) do
|
||||
items[#items + 1] = {
|
||||
text = type,
|
||||
}
|
||||
end
|
||||
return items
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user