Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
glepnir committed Apr 29, 2024
1 parent b3c961c commit 3b2d87b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 42 deletions.
46 changes: 5 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# indentmini.nvim
A minimal less than ~100 lines and blazing fast indentline plugin. no much more features.

![old](https://github.com/nvimdev/indentmini.nvim/assets/41671631/d836db79-4c41-45bc-99cb-d9f807dfe9af)

## Install

- Lazy.nvim
Expand All @@ -24,6 +26,7 @@ require('lazy').setup({
config = function()
require("indentmini").setup({
char = "|",
current = true,
exclude = {
"erlang",
"markdown",
Expand All @@ -33,49 +36,10 @@ config = function()
-- Colors are applied automatically based on user-defined highlight groups.
-- There is no default value.
vim.cmd.highlight('IndentLine guifg=#123456')
-- Current indent line highlight
vim.cmd.highlight('IndentLineCurrent guifg=#123456')
end,
```

## Recipies

By default, if you switch colorschemes your indent colors will be cleared out.
To fix this, create an autocommand that will set them again on change. You can
also set it up with different colors per-scheme if you'd like.

```lua
config = function()
-- create a function to set the colors
local setColors = function()
local hi_colors = {
'#AD7021',
'#8887C3',
'#738A05',
'#5F819D',
'#9E8FB2',
'#907AA9',
'#CDA869',
'#8F9D6A',
}

-- you could add some logic here to conditionally set the
-- highlight colors based on what scheme you're switching to.

for i, val in pairs(hi_colors) do
vim.api.nvim_set_hl(0, 'IndentLine' .. i, { fg = val })
end
end

-- set up an autocommand to set the colors when the colorscheme changes
vim.api.nvim_create_autocmd('ColorScheme', {
pattern = '*',
callback = setColors,
})

-- don't forget to call it on startup!
setColors()

require('indentmini').setup()
end,
```

## License MIT
2 changes: 1 addition & 1 deletion lua/indentmini/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ return {
return
end
local name = ('IndentLine%d'):format(level)
if hls[name].link and hls[name].link == 'IndentLineCurrent' then
if hls[name] and hls[name].link and hls[name].link == 'IndentLineCurrent' then
return
end
api.nvim_set_hl(ns, name, { link = 'IndentLineCurrent' })
Expand Down

0 comments on commit 3b2d87b

Please sign in to comment.