make color swapper change colorscheme in config
This commit is contained in:
parent
119127accf
commit
6deb1b6a6b
2 changed files with 14 additions and 0 deletions
|
|
@ -11,6 +11,16 @@ function M.colorscheme(name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.replaceword(old, new)
|
||||||
|
local conf = vim.fn.stdpath("config").."/lua/conf/".."opts.lua"
|
||||||
|
local f = io.open(conf, "r")
|
||||||
|
local new_content = f:read("*all"):gsub(old, new)
|
||||||
|
|
||||||
|
f = io.open(conf, "w")
|
||||||
|
f:write(new_content)
|
||||||
|
f:close()
|
||||||
|
end
|
||||||
|
|
||||||
function M.include(fn)
|
function M.include(fn)
|
||||||
if not pcall(require, fn) then
|
if not pcall(require, fn) then
|
||||||
vim.notify('Could not find "'..fn, vim.log.levels.WARN..'"', { title = M.appid })
|
vim.notify('Could not find "'..fn, vim.log.levels.WARN..'"', { title = M.appid })
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,10 @@ function M.switcher()
|
||||||
if action_state.get_selected_entry() then
|
if action_state.get_selected_entry() then
|
||||||
actions.close(prompt_bufnr)
|
actions.close(prompt_bufnr)
|
||||||
misc.colorscheme(action_state.get_selected_entry()[1])
|
misc.colorscheme(action_state.get_selected_entry()[1])
|
||||||
|
|
||||||
|
-- make the colorscheme swap persistant
|
||||||
|
misc.replaceword("misc.colorscheme%(.+%)",
|
||||||
|
"misc.colorscheme('"..action_state.get_selected_entry()[1].."')")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
return true
|
return true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue