Updated theme func
This commit is contained in:
@@ -7,14 +7,23 @@ function M.themeselector(opts)
|
||||
local conf = require("telescope.config").values
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require("telescope.actions.state")
|
||||
-- local action_set = require("telescope.actions.set")
|
||||
local action_set = require("telescope.actions.set")
|
||||
local ivytheme = require("telescope.themes").get_ivy()
|
||||
|
||||
local themes = themefuncs.getAllThemes()
|
||||
local applytofile = themefuncs.applytofile
|
||||
local themes = themefuncs.get_all_themes()
|
||||
local change_theme = themefuncs.change_theme
|
||||
|
||||
local current_theme = vim.g.colors_name
|
||||
|
||||
opts = opts or {}
|
||||
local combined = vim.tbl_extend("force", ivytheme, {
|
||||
layout_config = {
|
||||
height = 10,
|
||||
},
|
||||
}, opts)
|
||||
|
||||
pickers
|
||||
.new(opts, {
|
||||
.new(combined, {
|
||||
prompt_title = "Colorscheme",
|
||||
finder = finders.new_table({
|
||||
results = themes,
|
||||
@@ -24,26 +33,26 @@ function M.themeselector(opts)
|
||||
actions.select_default:replace(function()
|
||||
actions.close(prompt_bufnr)
|
||||
local selection = action_state.get_selected_entry()
|
||||
applytofile(selection.value)
|
||||
change_theme(selection.value)
|
||||
end)
|
||||
-- action_set.shift_selection:enhance({
|
||||
-- post = function()
|
||||
-- local selection = action_state.get_selected_entry()
|
||||
-- if selection == nil then
|
||||
-- vim.notify("Error while selecting theme", vim.log.levels.ERROR)
|
||||
-- end
|
||||
-- vim.cmd("colorscheme " .. selection.value)
|
||||
-- end,
|
||||
-- })
|
||||
-- actions.close:enhance({
|
||||
-- post = function()
|
||||
-- local selection = action_state.get_selected_entry()
|
||||
-- if selection == nil then
|
||||
-- vim.notify("Error while selecting theme", vim.log.levels.ERROR)
|
||||
-- end
|
||||
-- exec(selection.value)
|
||||
-- end,
|
||||
-- })
|
||||
action_set.shift_selection:enhance({
|
||||
post = function()
|
||||
local selection = action_state.get_selected_entry()
|
||||
if selection == nil then
|
||||
vim.notify("Error while selecting theme", vim.log.levels.ERROR)
|
||||
end
|
||||
vim.cmd("colorscheme " .. selection.value)
|
||||
end,
|
||||
})
|
||||
actions.close:enhance({
|
||||
post = function()
|
||||
local selection = action_state.get_selected_entry()
|
||||
if selection == nil then
|
||||
vim.notify("Error while selecting theme", vim.log.levels.ERROR)
|
||||
end
|
||||
vim.cmd("colorscheme " .. current_theme)
|
||||
end,
|
||||
})
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user