forked from foxora/nix
init
This commit is contained in:
commit
a07bd5fd9b
66 changed files with 6115 additions and 0 deletions
69
homes/modules/programs/neovim/init.lua
Normal file
69
homes/modules/programs/neovim/init.lua
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
vim.g.mapleader = " "
|
||||
|
||||
vim.opt.termguicolors = true -- use terminal colors
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.wrap = false
|
||||
vim.opt.colorcolumn = "80"
|
||||
|
||||
require("plugins")
|
||||
require("lsp")
|
||||
|
||||
local uv = vim.loop
|
||||
local colorscheme_filepath = "/home/aurora/.cache/nvim/neovim-colors"
|
||||
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
|
||||
|
||||
-- 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
|
||||
end
|
||||
|
||||
-- initial load
|
||||
load_colors()
|
||||
|
||||
-- vim.defer_fn(load_colors, 1)
|
||||
|
||||
-- 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
|
||||
end
|
||||
|
||||
watch_colorscheme()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue