A simple util providing auto indent like VSCode when cursor at the first column and press <TAB> key
2023-10-23.1.21.40.mov
requir("lazy").setup({
{
'vidocqh/auto-indent.nvim',
opts = {},
},
})
require("auto-indent").setup({
lightmode = true, -- Lightmode assumes tabstop and indentexpr not change within buffer's lifetime
indentexpr = nil, -- Use vim.bo.indentexpr by default, see 'Custom Indent Evaluate Method'
ignore_filetype = {}, -- Disable plugin for specific filetypes, e.g. ignore_filetype = { 'javascript' }
})
indentexpr
should be a function returns quantity of indents
example using treesitter.indent module
{
---@param lnum: number
---@return number
indentexpr = function(lnum)
return require("nvim-treesitter.indent").get_indent(lnum)
end
}