95 lines
3.9 KiB
Plaintext
Executable File
95 lines
3.9 KiB
Plaintext
Executable File
==============================================================================
|
|
------------------------------------------------------------------------------
|
|
*mini.trailspace*
|
|
*MiniTrailspace*
|
|
Work with trailing whitespace
|
|
|
|
Features:
|
|
- Highlighting is done only in modifiable buffer by default, only in Normal
|
|
mode, and stops in Insert mode and when leaving window.
|
|
- Trim all trailing whitespace with |MiniTrailspace.trim()|.
|
|
- Trim all trailing empty lines with |MiniTrailspace.trim_last_lines()|.
|
|
|
|
# Setup~
|
|
|
|
This module needs a setup with `require('mini.trailspace').setup({})`
|
|
(replace `{}` with your `config` table). It will create global Lua table
|
|
`MiniTrailspace` which you can use for scripting or manually (with
|
|
`:lua MiniTrailspace.*`).
|
|
|
|
See |MiniTrailspace.config| for `config` structure and default values.
|
|
|
|
You can override runtime config settings locally to buffer inside
|
|
`vim.b.minitrailspace_config` which should have same structure as
|
|
`MiniTrailspace.config`. See |mini.nvim-buffer-local-config| for more details.
|
|
|
|
# Highlight groups~
|
|
|
|
* `MiniTrailspace` - highlight group for trailing space.
|
|
|
|
To change any highlight group, modify it directly with |:highlight|.
|
|
|
|
# Disabling~
|
|
|
|
To disable, set `g:minitrailspace_disable` (globally) or
|
|
`b:minitrailspace_disable` (for a buffer) to `v:true`. Considering high
|
|
number of different scenarios and customization intentions, writing exact
|
|
rules for disabling module's functionality is left to user. See
|
|
|mini.nvim-disabling-recipes| for common recipes. Note: after disabling
|
|
there might be highlighting left; it will be removed after next
|
|
highlighting update (see |events| and `MiniTrailspace` |augroup|).
|
|
|
|
------------------------------------------------------------------------------
|
|
*MiniTrailspace.setup()*
|
|
`MiniTrailspace.setup`({config})
|
|
Module setup
|
|
|
|
Parameters~
|
|
{config} `(table)` Module config table. See |MiniTrailspace.config|.
|
|
|
|
Usage~
|
|
`require('mini.trailspace').setup({})` (replace `{}` with your `config` table)
|
|
|
|
------------------------------------------------------------------------------
|
|
*MiniTrailspace.config*
|
|
`MiniTrailspace.config`
|
|
Module config
|
|
|
|
Default values:
|
|
>
|
|
MiniTrailspace.config = {
|
|
-- Highlight only in normal buffers (ones with empty 'buftype'). This is
|
|
-- useful to not show trailing whitespace where it usually doesn't matter.
|
|
only_in_normal_buffers = true,
|
|
}
|
|
<
|
|
|
|
------------------------------------------------------------------------------
|
|
*MiniTrailspace.highlight()*
|
|
`MiniTrailspace.highlight`()
|
|
Highlight trailing whitespace in current window
|
|
|
|
------------------------------------------------------------------------------
|
|
*MiniTrailspace.unhighlight()*
|
|
`MiniTrailspace.unhighlight`()
|
|
Unhighlight trailing whitespace in current window
|
|
|
|
------------------------------------------------------------------------------
|
|
*MiniTrailspace.trim()*
|
|
`MiniTrailspace.trim`()
|
|
Trim trailing whitespace
|
|
|
|
------------------------------------------------------------------------------
|
|
*MiniTrailspace.trim_last_lines()*
|
|
`MiniTrailspace.trim_last_lines`()
|
|
Trim last blank lines
|
|
|
|
------------------------------------------------------------------------------
|
|
*MiniTrailspace.track_normal_buffer()*
|
|
`MiniTrailspace.track_normal_buffer`()
|
|
Track normal buffer
|
|
|
|
Designed to be used with |autocmd|. No need to use it directly.
|
|
|
|
|
|
vim:tw=78:ts=8:noet:ft=help:norl: |