https://github.com/jokesper/align.nvim
A simple plugin to allow alignment over multiple lines.
https://github.com/jokesper/align.nvim
alignment elastic-tabst lua neovim neovim-plugin nvim nvim-lua
Last synced: 10 months ago
JSON representation
A simple plugin to allow alignment over multiple lines.
- Host: GitHub
- URL: https://github.com/jokesper/align.nvim
- Owner: jokesper
- Created: 2024-05-02T20:11:04.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-26T20:56:33.000Z (almost 2 years ago)
- Last Synced: 2024-08-26T23:57:10.123Z (almost 2 years ago)
- Topics: alignment, elastic-tabst, lua, neovim, neovim-plugin, nvim, nvim-lua
- Language: Lua
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# align.nvim
A simple plugin to allow alignment over multiple lines.
## [Elastic Tabstops](https://nick-gravgaard.com/elastic-tabstops/)
[Elastic Tabstops](https://nick-gravgaard.com/elastic-tabstops/) can be emulated
with `\t` in the `align` field. This is set by default.
The width of the alignment does not follow the specs (minimum width)
## Requirements
- nvim >= 0.10.x
## Installation
### [lazy.nvim](https://github.com/wbthomason/packer.nvim)
```lua
{ 'jokesper/align.nvim' }
```
## Configuration
Configuration happens in lua.
If you would like to instead configure it using vimscript,
see `:help lua-heredoc`.
### Default configuration
```lua
require 'align'.setup {
-- `array` of `modes` (output of `nvim_get_mode().mode` (`n`, `i`, ...)).
-- Leave empty if you want to always update the alignments.
update_in_modes = {},
-- `table` of patterns to align.
-- - `number` (positional) arguments are global alignments.
-- - `string` arguments are filetype specific.
-- The key has to be the same as the filetype (value of `vim.opt.filetype`)
-- or `*` as a fallback.
--
-- A pattern can be either:
-- 1. `false` to disable defaults (usually at index `0`).
-- 2. A `string` representing a lua pattern which gets leftaligned.
-- 4. A `table` representing multiple patterns with optional properties.
-- The properties can be:
-- - `align` which specifies how to align the pattern.
-- One of `left`, `right` or `center`.
align = {
[0] = {
'\t',
{ '%s[+-]?[%d.,]+', align = 'right' },
},
['*'] = {
[0] = {
' = ',
},
},
csv = {
[0] = {
',',
},
},
},
}
```