nvim: restore indent-blankline plugin and setup colors

This commit is contained in:
nicolas 2023-12-14 16:23:20 +01:00
parent 7eacb26990
commit 12f79aab5f
1 changed files with 30 additions and 10 deletions

View File

@ -1,6 +1,18 @@
local M = {}
local function switch_to_theme(theme_name)
local catppuccin_palette = require('catppuccin.palettes')
local function switch_to_theme(theme_name, indent_theme_builder)
local hooks = require "ibl.hooks"
hooks.clear_all()
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
local indent_theme = indent_theme_builder()
vim.api.nvim_set_hl(0, "IblScope", { fg = indent_theme.scope_color })
vim.api.nvim_set_hl(0, "IblWhitespace", { fg = indent_theme.whitespace_color })
end)
require("ibl").setup { indent = { char = '' } }
vim.cmd.colorscheme(theme_name)
require 'lualine'.setup {
@ -24,16 +36,23 @@ local function switch_to_theme(theme_name)
end
local function init_catppuccin()
switch_to_theme('catppuccin-macchiato')
-- local bg0 = require('nightfox.palette.dayfox').palette.bg0
-- vim.cmd(string.format("highlight IndentBlanklineIndent1 guifg=%s gui=nocombine", bg0))
switch_to_theme('catppuccin-macchiato', function()
local palette = catppuccin_palette.get_palette()
return {
scope_color = palette.subtext0,
whitespace_color = palette.surface0
}
end)
end
local function init_dayfox()
switch_to_theme('dayfox')
-- local bg0 = require('nightfox.palette.dayfox').palette.bg0
-- vim.cmd(string.format("highlight IndentBlanklineIndent1 guifg=%s gui=nocombine", bg0))
switch_to_theme('dayfox', function()
local palette = require('nightfox.palette.dayfox').palette
return {
scope_color = palette.fg1,
whitespace_color = palette.bg2
}
end)
end
function M.toggle()
@ -47,8 +66,9 @@ function M.toggle()
end
function M.setup()
local theme = "catppuccin-macchiato"
switch_to_theme(theme)
vim.opt.list = true
vim.opt.listchars:append "space:·,trail: "
init_catppuccin()
end
return M