Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Darazaki/indent-o-matic

Dumb automatic fast indentation detection for Neovim written in Lua
https://github.com/Darazaki/indent-o-matic

neovim neovim-lua neovim-plugin

Last synced: about 2 months ago
JSON representation

Dumb automatic fast indentation detection for Neovim written in Lua

Awesome Lists containing this project

README

        

# indent-o-matic

Dumb automatic fast indentation detection for Neovim written in Lua

## How it works

Instead of trying to be smart about detecting an indentation using statistics,
it will find the first thing that looks like a standard indentation (tab or 8/4/2 spaces)
and assume that's what the file's indentation is

This has the advantage of being fast and very often correct while being simple enough
that most people will understand what it will do predictably

## Requirements

- Neovim >= 0.4.4

## Installation

Can be installed through any standard Vim package manager, configuration is optional

E.g. through [vim-plug](https://github.com/junegunn/vim-plug):

```vim
call plug#begin()
Plug 'Darazaki/indent-o-matic'
call plug#end()
```

Then restart Neovim and run `:PlugInstall`

## Configuration

Configuration is done in Lua:

```lua
require('indent-o-matic').setup {
-- The values indicated here are the defaults

-- Number of lines without indentation before giving up (use -1 for infinite)
max_lines = 2048,

-- Space indentations that should be detected
standard_widths = { 2, 4, 8 },

-- Skip multi-line comments and strings (more accurate detection but less performant)
skip_multiline = true,
}
```

You can also directly configure it from a Vim file by using the `lua` instruction:

```vim
lua <