-
Notifications
You must be signed in to change notification settings - Fork 180
/
mini-trailspace.txt
93 lines (70 loc) · 3.56 KB
/
mini-trailspace.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
*mini.trailspace* Trailspace (highlight and remove)
*MiniTrailspace*
MIT License Copyright (c) 2021 Evgeni Chasnovski
==============================================================================
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 `vim.g.minitrailspace_disable` (globally) or
`vim.b.minitrailspace_disable` (for a buffer) to `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|nil)` Module config table. See |MiniTrailspace.config|.
Usage ~
>lua
require('mini.trailspace').setup() -- use default config
-- OR
require('mini.trailspace').setup({}) -- replace {} with your config table
<
------------------------------------------------------------------------------
*MiniTrailspace.config*
`MiniTrailspace.config`
Module config
Default values:
>lua
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
vim:tw=78:ts=8:noet:ft=help:norl: