https://github.com/blurfx/auto-indent.vim
Vim plugin that automatically detect and config indentation rule
https://github.com/blurfx/auto-indent.vim
vim vim-plugin
Last synced: 12 months ago
JSON representation
Vim plugin that automatically detect and config indentation rule
- Host: GitHub
- URL: https://github.com/blurfx/auto-indent.vim
- Owner: blurfx
- Created: 2021-11-13T12:05:39.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-04T13:35:22.000Z (over 4 years ago)
- Last Synced: 2025-03-15T22:29:22.863Z (over 1 year ago)
- Topics: vim, vim-plugin
- Language: Vim script
- Homepage:
- Size: 11.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# auto-indent.vim
Vim plug-in that automatically detects and sets indentation level
## Installtion
### Using [vim-plug](https://github.com/junegunn/vim-plug)
```vim
" .vimrc
Plug 'blurfx/auto-indent.vim'
```
## Customization
### Options
```vim
" The plugin follows the detected indentation.
" but if it's not detected, it follows fallback configuration.
" Fallback indentation type. (0: space, 1: tab)
" If you are using a tab indent, set it to 1.
" (default value: 0)
let g:autoindent_expandtab = 0
" Indent space size / tab width
" (default value: 2 for spaces, 4 for tab width)
let g:autoindent_indent_space_size = 2
let g:autoindent_indent_tab_size = 4
```
### Callback
If you want to do additional work with the detected indentation, define the callback function `AutoIndentCallback`.
```vim
function! AutoIndentCallback(indent)
" {'type': 'tab': 'size': 1}
echom a:indent
endfunction
```
#### Arguments
| Arugment | Type | Description |
|----------|---------|-------------|
| indent | `{'type': 'space' \| 'tab', 'size': number}`| - |