From fd99bd9a00c872c10e65ea80e4089beed34f30b9 Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 13 Oct 2023 09:23:16 +0800 Subject: [PATCH 1/2] feat(hlchunk.nvim): migrate from 'indent-blankline.nvim' to 'hlchunk.nvim' --- lua/configs/shellRaining/hlchunk-nvim/config.lua | 5 +++++ lua/plugins/init.lua | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 lua/configs/shellRaining/hlchunk-nvim/config.lua diff --git a/lua/configs/shellRaining/hlchunk-nvim/config.lua b/lua/configs/shellRaining/hlchunk-nvim/config.lua new file mode 100644 index 00000000..be79dae5 --- /dev/null +++ b/lua/configs/shellRaining/hlchunk-nvim/config.lua @@ -0,0 +1,5 @@ +require("hlchunk").setup({ + blank = { + enable = false, + }, +}) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index b12a2e75..1247a5d0 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -117,10 +117,15 @@ local M = { keys = lua_keys("akinsho/bufferline.nvim"), }, -- Indentline + -- { + -- "lukas-reineke/indent-blankline.nvim", + -- event = { VeryLazy, BufReadPre, BufNewFile }, + -- config = lua_config("lukas-reineke/indent-blankline.nvim"), + -- }, { - "lukas-reineke/indent-blankline.nvim", + "shellRaining/hlchunk.nvim", event = { VeryLazy, BufReadPre, BufNewFile }, - config = lua_config("lukas-reineke/indent-blankline.nvim"), + config = lua_config("shellRaining/hlchunk.nvim"), }, -- Statusline { From 7a639197bbb97ff4a0de54aa40e1d42fb59cd476 Mon Sep 17 00:00:00 2001 From: linrongbin16 Date: Fri, 13 Oct 2023 10:11:14 +0800 Subject: [PATCH 2/2] feat(hlchunk.nvim): use syntax highlighting --- .../shellRaining/hlchunk-nvim/config.lua | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/lua/configs/shellRaining/hlchunk-nvim/config.lua b/lua/configs/shellRaining/hlchunk-nvim/config.lua index be79dae5..9c08f581 100644 --- a/lua/configs/shellRaining/hlchunk-nvim/config.lua +++ b/lua/configs/shellRaining/hlchunk-nvim/config.lua @@ -1,4 +1,55 @@ +local constants = require("builtin.utils.constants") + +---@return string? +local function hlcode(name) + local hlnr = vim.fn.hlID(name) + if type(hlnr) ~= "number" or hlnr <= 0 then + return nil + end + local synnr = vim.fn.synIDtrans(hlnr) + if type(synnr) ~= "number" or synnr <= 0 then + return nil + end + local guicode = vim.fn.synIDattr(synnr, "fg", "gui") + if type(guicode) == "string" and string.len(guicode) > 0 then + return guicode + end + return vim.fn.synIDattr(synnr, "fg", "cterm") +end + +local HL = "#806d9c" +local ERRHL = "#c21f30" + +do + local line_nr = hlcode("Float") + if line_nr then + HL = line_nr + end + local err_msg = hlcode("DiagnosticError") + if err_msg then + ERRHL = err_msg + else + err_msg = hlcode("ErrorMsg") + if err_msg then + ERRHL = err_msg + end + end +end + require("hlchunk").setup({ + chunk = { + notify = false, + style = { + { fg = HL }, + { fg = ERRHL }, + }, + max_file_size = constants.perf.file.maxsize, + }, + line_num = { + enable = true, + use_treesitter = false, + style = HL, + }, blank = { enable = false, },