From 7a8a60ffea95e729743c4df9e9f8b39b1cb3e27a Mon Sep 17 00:00:00 2001 From: Nathan Knowler Date: Sat, 12 Mar 2022 17:38:10 -0600 Subject: [PATCH] [neovim] set highlights with lua api --- .config/nvim/lua/colors.lua | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/.config/nvim/lua/colors.lua b/.config/nvim/lua/colors.lua index 71c21e5..30e2c02 100644 --- a/.config/nvim/lua/colors.lua +++ b/.config/nvim/lua/colors.lua @@ -1,15 +1,30 @@ local cmd = vim.cmd local opt = vim.opt ---cmd [[set t_Co = 256]] +vim.g.t_Co = 256 cmd [[if &term =~ '256color' | set t_ut= | endif]] -cmd [[let $NVIM_TUI_ENABLE_TRUE_COLOR=1]] +vim.env.NVIM_TUI_ENABLE_TRUE_COLOR = 1 opt.termguicolors = true cmd [[colorscheme iceberg]] opt.background = 'dark' -cmd [[highlight NonText guibg=NONE ctermbg=NONE]] -cmd [[highlight Normal guibg=NONE ctermbg=NONE]] -cmd [[highlight EndOfBuffer guibg=NONE ctermbg=NONE]] -cmd [[highlight LineNr guibg=NONE ctermbg=NONE]] + +local highlights = { + 'NonText', + 'Normal', + 'EndOfBuffer', + 'LineNr', +} + +for _, highlight in ipairs(highlights) do + vim.api.nvim_set_hl( + 0, + highlight, + vim.tbl_extend( + 'force', + vim.api.nvim_get_hl_by_name(highlight, true), + {background = 'NONE'} + ) + ) +end cmd [[let g:lightline = {'colorscheme': 'iceberg'}]] -- 2.51.2