neo-trim
is a Neovim plugin written designed to highlight and trim trailing whitespace.
Detect and trim whitespace with TrimWhitespace
command.
Or automatically trim it with :w
.
- Automatically trims trailing whitespace on saving files.
- Highlights trailing whitespace.
- Customizable: Exclude specific file types from trimming or diagnostics. Enable / Disable auto trimming.
- Easy to configure and use.
Install neo-trim
using your favorite package manager.
use 'BusterWarn/neo-trim'
require('lazy').setup({
{
'BusterWarn/neo-trim',
config = {
auto_trim_on_write = false,
},
},
}, {})
To use neo-trim
with its default configuration, simply add the following line to your Neovim configuration:
require('neo_trim').setup()
neo-trim
is configurable. You can set up the plugin with custom settings:
require('neo_trim').setup({
exclude_diagnostics_for_languages = {"html", "markdown"}, -- File types to exclude from diagnostics
exclude_auto_trimming_for_languages = {"cpp", "lua"} -- File types to exclude from automatic trimming
})
exclude_diagnostics_for_languages
: A list of file types to exclude from trailing whitespace diagnostics. Default:{}
exclude_auto_trimming_for_languages
: A list of file types to exclude from automatic trailing whitespace trimming on save. Default:{}
trim_command_name
: If you want to change the command name for trimming, for some reason. Default:"TrimWhitespace"
auto_trim_on_write
: Trims whitespace whenever a write is done. Default:true
Contributions to neo-trim
are welcome! Feel free to open issues for bugs or suggestions and submit pull requests for improvements.