Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kaplanz/retrail.nvim
Whitespace management for Neovim
https://github.com/kaplanz/retrail.nvim
neovim neovim-plugin whitespace
Last synced: 3 months ago
JSON representation
Whitespace management for Neovim
- Host: GitHub
- URL: https://github.com/kaplanz/retrail.nvim
- Owner: kaplanz
- License: mit
- Created: 2022-07-20T21:59:59.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-14T03:29:59.000Z (5 months ago)
- Last Synced: 2024-06-14T04:37:19.019Z (5 months ago)
- Topics: neovim, neovim-plugin, whitespace
- Language: Lua
- Homepage:
- Size: 20.5 KB
- Stars: 46
- Watchers: 2
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# retrail.nvim
Retrail is a small Neovim plugin for managing trailing whitespace. It has two
main features:
1. Highlight trailing whitespace.
1. Trim trailing whitespace upon `:write`.## Installation
Install this plugin using your favorite plugin manager. For example, using
[lazy]:```lua
{
"kaplanz/retrail.nvim",
opts = {}, -- calls `setup` using provided `opts`
},
```To manually set up the plugin, call the `setup` function:
```lua
require("retrail").setup()
```## Configuration
While the [defaults] should work for most users out of the box, the following
options can be configured as such:```lua
require("retrail").setup {
-- Highlight group to use for trailing whitespace.
hlgroup = "Search",
-- Pattern to match trailing whitespace against. Edit with caution!
pattern = "\\v((.*%#)@!|%#)\\s+$",
-- Enabled filetypes.
filetype = {
-- Strictly enable only on `include`ed filetypes. When false, only disabled
-- on an `exclude`ed filetype.
strict = false,
-- Included filetype list.
include = {},
-- Excluded filetype list. Overrides `include` list.
exclude = {
"",
"aerial",
"alpha",
"checkhealth",
"cmp_menu",
"diff",
"lazy",
"lspinfo",
"man",
"mason",
"TelescopePrompt",
"toggleterm",
"Trouble",
"WhichKey",
},
},
-- Enabled buftypes.
buftype = {
-- Strictly enable only on `include`ed buftypes. When false, only disabled
-- on an `exclude`ed buftype.
strict = false,
-- Included buftype list.
include = {},
-- Excluded buftype list. Overrides `include` list.
exclude = {
"help",
"nofile",
"prompt",
"quickfix",
"terminal",
}
},
-- Trim on write behaviour.
trim = {
-- Auto trim on BufWritePre
auto = true,
-- Trailing whitespace as highlighted.
whitespace = true,
-- Final blank (i.e. whitespace only) lines.
blanklines = false,
}
}
```## Commands
1. `:RetrailTrimWhitespace` Trim trailing whitespace
2. `:RetrailEnable` Enable trim trailing for the current buffer
3. `:RetrailDisable` Disable trim trailing for the current buffer
4. `:RetrailToggle` Toggle trim trailing for the current buffer[defaults]: ./lua/retrail/config/defaults.lua
[lazy]: https://github.com/folke/lazy.nvim