Skip to content

Commit

Permalink
fix bug and typo
Browse files Browse the repository at this point in the history
  • Loading branch information
glepnir committed May 2, 2024
1 parent 22280da commit 505d01e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ install with any plugin management or default vim package.
available config values in setup table.

- char -- string type default is ``,
- ucrrent -- boolean highlight current indent level
- current -- boolean highlight current indent level
- exclude -- table type add exclude filetype in this table ie `{ 'markdown', 'xxx'}`

```lua
Expand Down
9 changes: 6 additions & 3 deletions lua/indentmini/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ local function on_line(_, _, bufnr, row)

for i = 1, indent - 1, shiftw do
local col = i - 1
local hi_name = ('IndentLine%d%d'):format(row + 1, col + 1)
local level = math.floor(col / shiftw) + 1
local hi_name = ('IndentLine%d%d'):format(row + 1, level)
if col_in_screen(col) and is_space(row, col) then
opt.config.virt_text[1][2] = hi_name
if line_is_empty and col > 0 then
Expand Down Expand Up @@ -107,8 +108,10 @@ local function on_line(_, _, bufnr, row)
if erow < 1 then
return
end
for i = srow, erow, 1 do
api.nvim_set_hl(ns, ('IndentLine%d%d'):format(i + 1, curindent - 1), { link = cur_hi })

local level = math.floor(curindent / shiftw)
for i = srow + 1, erow, 1 do
api.nvim_set_hl(ns, ('IndentLine%d%d'):format(i + 1, level), { link = cur_hi })
end
end,
})
Expand Down

0 comments on commit 505d01e

Please sign in to comment.