Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(hlchunk.nvim): migrate from 'indent-blankline.nvim' to 'hlchunk.nvim' #278

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions lua/configs/shellRaining/hlchunk-nvim/config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
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,
},
})
9 changes: 7 additions & 2 deletions lua/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down