Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/VidocqH/auto-indent.nvim
Auto indent like VSCode when cursor at the first column and press <TAB> key
https://github.com/VidocqH/auto-indent.nvim
autoindent indent indentation neovim-plugin nvim-plugin
Last synced: about 2 months ago
JSON representation
Auto indent like VSCode when cursor at the first column and press <TAB> key
- Host: GitHub
- URL: https://github.com/VidocqH/auto-indent.nvim
- Owner: VidocqH
- License: mit
- Created: 2023-10-18T08:15:48.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2023-11-03T10:05:56.000Z (7 months ago)
- Last Synced: 2024-01-24T10:46:06.882Z (4 months ago)
- Topics: autoindent, indent, indentation, neovim-plugin, nvim-plugin
- Language: Lua
- Homepage:
- Size: 31.3 KB
- Stars: 54
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-neovim - VidocqH/auto-indent.nvim - Auto indent cursor when cursor at the first column and press `<TAB>` key like VSCode. (Formatting / Indent)
- awesome-neovim - VidocqH/auto-indent.nvim - Auto indent cursor when cursor at the first column and press `<TAB>` key like VSCode. (Formatting / Indent)
- awesome-neovim - VidocqH/auto-indent.nvim - Auto indent cursor when cursor at the first column and press `<TAB>` key like VSCode. (Formatting / Indent)
README
# AutoIndent.nvim
A simple util providing auto indent like VSCode when cursor at the first column and press \ key
https://github.com/VidocqH/auto-indent.nvim/assets/16725418/b0eda63f-9b7d-4708-8477-00bde49d8f40
## Installation
### Lazy
```lua
requir("lazy").setup({
{
'vidocqh/auto-indent.nvim',
opts = {},
},
})
```## Configuration
### Default Config
```lua
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' }
})
```### Custom Indent Evaluate Method
`indentexpr` should be a function returns quantity of indents
example using [treesitter.indent](https://github.com/nvim-treesitter/nvim-treesitter#indentation) module
```lua
{
---@param lnum: number
---@return number
indentexpr = function(lnum)
return require("nvim-treesitter.indent").get_indent(lnum)
end
}
```