forked from foxora/nix
added formatter and format on save!!!
This commit is contained in:
parent
a8a297d142
commit
35bab88ce9
14 changed files with 620 additions and 494 deletions
|
|
@ -14,34 +14,46 @@ local colors = {}
|
|||
|
||||
-- function to load colors
|
||||
local function load_colors()
|
||||
local new_colors = {}
|
||||
for line in io.lines(colorscheme_filepath) do
|
||||
table.insert(new_colors, line)
|
||||
end
|
||||
local new_colors = {}
|
||||
for line in io.lines(colorscheme_filepath) do
|
||||
table.insert(new_colors, line)
|
||||
end
|
||||
|
||||
-- ensure the table has enough entries to avoid indexing issues
|
||||
if #new_colors >= 18 then
|
||||
colors = new_colors
|
||||
require('base16-colorscheme').setup({
|
||||
base00 = colors[17], base01 = colors[1], base02 = colors[3], base03 = colors[3],
|
||||
base04 = colors[5], base05 = colors[8], base06 = colors[5], base07 = colors[8],
|
||||
base08 = colors[18], base09 = colors[4], base0A = colors[11], base0B = colors[5],
|
||||
base0C = colors[6], base0D = colors[7], base0E = colors[6], base0F = colors[16],
|
||||
})
|
||||
-- ensure the table has enough entries to avoid indexing issues
|
||||
if #new_colors >= 18 then
|
||||
colors = new_colors
|
||||
require("base16-colorscheme").setup({
|
||||
base00 = colors[17],
|
||||
base01 = colors[1],
|
||||
base02 = colors[3],
|
||||
base03 = colors[3],
|
||||
base04 = colors[5],
|
||||
base05 = colors[8],
|
||||
base06 = colors[5],
|
||||
base07 = colors[8],
|
||||
base08 = colors[18],
|
||||
base09 = colors[4],
|
||||
base0A = colors[11],
|
||||
base0B = colors[5],
|
||||
base0C = colors[6],
|
||||
base0D = colors[7],
|
||||
base0E = colors[6],
|
||||
base0F = colors[16],
|
||||
})
|
||||
|
||||
-- set colors for blink.cmp's completion menu
|
||||
vim.api.nvim_set_hl(0, 'BlinkCmpMenu', { bg = colors[17] })
|
||||
vim.api.nvim_set_hl(0, 'BlinkCmpMenuBorder', { bg = colors[17], fg = colors[13] })
|
||||
vim.api.nvim_set_hl(0, 'BlinkCmpMenuSelection', { bg = colors[15], fg = colors[17] })
|
||||
vim.api.nvim_set_hl(0, 'BlinkCmpScrollBarThumb', { bg = colors[18] })
|
||||
vim.api.nvim_set_hl(0, 'BlinkCmpKind', { bg = colors[17], fg = colors[14] })
|
||||
vim.api.nvim_set_hl(0, 'BlinkCmpLabel', { bg = colors[17], fg = colors[18] })
|
||||
vim.api.nvim_set_hl(0, 'BlinkCmpLabelMatch', { bg = colors[17], fg = colors[18] })
|
||||
vim.api.nvim_set_hl(0, 'BlinkCmpLabelDetail', { bg = colors[17], fg = colors[18] })
|
||||
vim.api.nvim_set_hl(0, 'BlinkCmpLabelDescription', { bg = colors[17], fg = colors[18] })
|
||||
else
|
||||
print("Error: Not enough colors in file")
|
||||
end
|
||||
-- set colors for blink.cmp's completion menu
|
||||
vim.api.nvim_set_hl(0, "BlinkCmpMenu", { bg = colors[17] })
|
||||
vim.api.nvim_set_hl(0, "BlinkCmpMenuBorder", { bg = colors[17], fg = colors[13] })
|
||||
vim.api.nvim_set_hl(0, "BlinkCmpMenuSelection", { bg = colors[15], fg = colors[17] })
|
||||
vim.api.nvim_set_hl(0, "BlinkCmpScrollBarThumb", { bg = colors[18] })
|
||||
vim.api.nvim_set_hl(0, "BlinkCmpKind", { bg = colors[17], fg = colors[14] })
|
||||
vim.api.nvim_set_hl(0, "BlinkCmpLabel", { bg = colors[17], fg = colors[18] })
|
||||
vim.api.nvim_set_hl(0, "BlinkCmpLabelMatch", { bg = colors[17], fg = colors[18] })
|
||||
vim.api.nvim_set_hl(0, "BlinkCmpLabelDetail", { bg = colors[17], fg = colors[18] })
|
||||
vim.api.nvim_set_hl(0, "BlinkCmpLabelDescription", { bg = colors[17], fg = colors[18] })
|
||||
else
|
||||
print("Error: Not enough colors in file")
|
||||
end
|
||||
end
|
||||
|
||||
-- initial load
|
||||
|
|
@ -51,19 +63,18 @@ load_colors()
|
|||
|
||||
-- set up a file watcher
|
||||
local function watch_colorscheme()
|
||||
local handle
|
||||
handle = uv.new_fs_event()
|
||||
if handle then
|
||||
uv.fs_event_start(handle, colorscheme_filepath, {}, function(err, _, _)
|
||||
if err then
|
||||
print("Error watching colorscheme file:", err)
|
||||
return
|
||||
end
|
||||
-- debounce by adding a slight delay before reloading
|
||||
vim.defer_fn(load_colors, 100)
|
||||
end)
|
||||
end
|
||||
local handle
|
||||
handle = uv.new_fs_event()
|
||||
if handle then
|
||||
uv.fs_event_start(handle, colorscheme_filepath, {}, function(err, _, _)
|
||||
if err then
|
||||
print("Error watching colorscheme file:", err)
|
||||
return
|
||||
end
|
||||
-- debounce by adding a slight delay before reloading
|
||||
vim.defer_fn(load_colors, 100)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
watch_colorscheme()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue