https://github.com/chardoncs/indent-wizard.nvim
Simple indentation configuration and guessing plugin for Neovim
https://github.com/chardoncs/indent-wizard.nvim
indentation lua luajit neovim neovim-plugin
Last synced: about 1 year ago
JSON representation
Simple indentation configuration and guessing plugin for Neovim
- Host: GitHub
- URL: https://github.com/chardoncs/indent-wizard.nvim
- Owner: chardoncs
- License: apache-2.0
- Created: 2024-12-17T08:49:45.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-25T06:03:42.000Z (about 1 year ago)
- Last Synced: 2025-03-29T03:53:23.598Z (about 1 year ago)
- Topics: indentation, lua, luajit, neovim, neovim-plugin
- Language: Lua
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# indent-wizard.nvim 🧙
Simple indentation configuration and guessing plugin for Neovim
## Install
### Manual
```lua
require("indent-wizard").setup {}
```
### [lazy.nvim](https://github.com/folke/lazy.nvim)
```lua
{
"chardoncs/indent-wizard.nvim",
opts = {},
}
```
## Usage
### Configuration
#### Default configuration
This snippet is about default config. You don't need to copypasta it.
```lua
require("indent-wizard").setup {
-- Auto guess and set buffer-wise indentation for each buffer
auto_guess = true,
scan = {
-- How many lines of sample in a file should be used for indentation guessing.
--
-- NOTE: 0-indented lines are ignored.
line_count = 25,
-- How many lines should be skipped.
--
-- If the number is between 0~1, indent-wizard will regard it
-- as percentage of total lines.
offset = 0,
},
-- Default settings
defaults = {
-- Nothing by default
},
}
```
#### Fallback indentations
Here is how fallback settings (`defaults`) looks like:
```lua
require("indent-wizard").setup {
defaults = {
-- Global settings, will be applied to `vim.opt`
{
-- All options are optional
options = {
tabstop = 8,
softtabstop = 4,
shiftwidth = 4,
expandtab = true,
smartindent = true,
},
},
-- Filetype-wise settings, will be applied to `vim.bo`
{
ft = "go",
options = {
shiftwidth = 4,
expandtab = false,
},
},
{
-- Or multiple filetypes
ft = {"c", "cpp", "rust", "zig"},
options = {
shiftwidth = 4,
expandtab = false,
},
},
},
}
```
### Commands
- `IndentInfo`: Guess the indentation and print the summary
- Output: `Apparently: shiftwidth=, expandtab=`
- ``: Number for shiftwidth, or `?` for inconclusive
- ``: If expands tab, `yes`, `no`, or `?` (inconclusive)
- `GuessIndent`: Guess the indentation and update the configuration
- Output: `Apparently: shiftwidth=, expandtab=`
- ``: Number for shiftwidth, or `?` for inconclusive
- ``: If expands tab, `yes`, `no`, or `?` (inconclusive)