Skip to content

Commit

Permalink
Merge pull request #19 from AyushRawal/main
Browse files Browse the repository at this point in the history
support for tab indentation
  • Loading branch information
glepnir authored May 30, 2024
2 parents 71639eb + ecdf645 commit e488a19
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lua/indentmini/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local ffi = require('ffi')
local opt = {
config = {
virt_text_pos = 'overlay',
hl_mode = 'combine',
hl_mode = 'replace',
ephemeral = true,
},
}
Expand Down Expand Up @@ -42,7 +42,7 @@ end
local function non_or_space(row, col)
local line = ffi.string(ml_get(row + 1))
local text = line:sub(col, col)
return text and (#text == 0 or text == ' ') or false
return text and (#text == 0 or text == ' ' or text == ' ') or false
end

local function find_in_snapshot(lnum)
Expand Down Expand Up @@ -103,6 +103,7 @@ local function on_line(_, _, bufnr, row)
if row > cache.reg_srow and row < cache.reg_erow and level == cache.cur_inlevel then
higroup = 'IndentLineCurrent'
end
if not vim.o.expandtab then col = level - 1 end
if col >= cache.leftcol and non_or_space(row, col) then
opt.config.virt_text[1][2] = higroup
if is_empty and col > 0 then
Expand All @@ -117,7 +118,6 @@ end
local function on_win(_, winid, bufnr, toprow, botrow)
if
bufnr ~= api.nvim_get_current_buf()
or not api.nvim_get_option_value('expandtab', { buf = bufnr })
or vim.iter(opt.exclude):find(function(v)
return v == vim.bo[bufnr].ft or v == vim.bo[bufnr].buftype
end)
Expand Down

0 comments on commit e488a19

Please sign in to comment.