-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlists.txt
181 lines (141 loc) · 7.31 KB
/
lists.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
*lists.txt* A Vim plugin to handle lists
*lists.vim*
Author: Karl Yngve Lervåg <karl.yngve@gmail.com>
License: MIT license {{{
Copyright (c) 2021 Karl Yngve Lervåg
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The software is provided "as is", without warranty of any kind, express or
implied, including but not limited to the warranties of merchantability,
fitness for a particular purpose and noninfringement. In no event shall the
authors or copyright holders be liable for any claim, damages or other
liability, whether in an action of contract, tort or otherwise, arising
from, out of or in connection with the software or the use or other dealings
in the software.
}}}
==============================================================================
INTRODUCTION *lists-intro*
This is a Vim plugin to manage text based lists. The plugin is inactive by
default. It can be activated for a specific buffer with |:ListsEnable|. One
can also specify to auto enable for specific filetypes with
|g:lists_filetypes|.
The functionality was earlier a part of |wiki.vim| [0] and implemented for my
personal convenience. However, as someone pointed out [1], these features do
not really have anything to do with the wiki functionality of |wiki.vim|. It
is now therefore a separate plugin.
[0]: https://github.com/lervag/wiki.vim
[1]: https://github.com/lervag/wiki.vim/issues/131
==============================================================================
LIST TYPES *lists-types*
|lists.vim| is quite minimal and does not have a lot of available
configuration choices. The implementation is based on the idea that list items
are indented consistently. The indentation makes it easy to parse a list to
determine its structure.
These types of lists are currently supported:
* Bullet lists. Bullets are either "*" or "-".
* Numbered lists formated similar to "1.".
* List items can be decorated with check boxes. Examples:
* [x] checked
* [ ] unchecked
* List items can be decorated with labels like "TODO:" and "DONE:".
==============================================================================
FEATURES *lists-features*
The following is a list of the commands and mappings provided by |lists.vim|.
*:ListsEnable*
Load |lists.vim| for the current buffer.
Note: This is the only global command. If |lists.vim| is not loaded, none of
the other features are available.
*:ListsToggle*
*<plug>(lists-toggle)*
Toggle a list items "status". For checkboxes, this means to toggle the
checkmark on/off. Elsewhere, we toggle between statuses defined in
|g:lists_todos|. This mapping exists in both normal and insert mode.
*:ListsToggleCheckbox*
*<plug>(lists-toggle-checkbox)*
Toggle a checklist item. If the current item does not have a checkbox, it
will be added. This mapping exists in both normal and insert mode.
*i_<plug>(lists-new-element)*
An insert mode mapping to add a new element in the current list. This is
useful after creating a new line below a list element to add the
bullet/dash/number in front, possibly with a checkbox if relevant.
*:ListsToggleBullet*
*<plug>(lists-bullet-toggle-all)*
Toggle the list bullet type between `-` and `*`. for the entire list.
*:ListsToggleBullet!*
*<plug>(lists-bullet-toggle-local)*
Toggle the list bullet type between `-` and `*` for the sibling list
entries.
*:ListsMoveUp*
*:ListsMoveDown*
*<plug>(lists-moveup)*
*<plug>(lists-movedown)*
Move current list item up/down through a list.
*:ListsUniq*
*<plug>(lists-uniq)*
Parse the current list and remove repeated entries recursively.
*:ListsUniqLocal*
*<plug>(lists-uniq-local)*
Similar to |:ListsUniq|, but only within the current list depth.
*<plug>(lists-al)*
*<plug>(lists-il)*
Text object for list items. The inner object is the current list item
including children, the outer object is the parent list item including all
its children.
The following mappings are available as visual mode and operator mode
mappings, i.e. |xmap| and |omap|.
*lists-maps-defaults*
The default mappings are listed in the following table. To disable the default
mappings, see |g:lists_maps_default_enable|. They can also be overrided
individually with |g:lists_maps_default_override|. The map mode is indicated
by the first letters of the various map commands (|nmap|, |imap|, |omap|, and
|xmap|).
PLUG DEFAULT MODE~
---- ------- ----~
|<plug>(lists-toggle)| <c-s> `in`
|<plug>(lists-toggle-checkbox)| NONE `in`
|i_<plug>(lists-new-element)| <c-a> `i`
|<plug>(lists-moveup)| <leader>wlk `n`
|<plug>(lists-movedown)| <leader>wlj `n`
|<plug>(lists-uniq)| <leader>wlu `n`
|<plug>(lists-uniq-local)| <leader>wlU `n`
|<plug>(lists-bullet-toggle-local)| <leader>wlT `n`
|<plug>(lists-bullet-toggle-all)| <leader>wlt `n`
|<plug>(lists-al)| al `ox`
|<plug>(lists-il)| il `ox`
==============================================================================
CONFIGURATION *lists-config*
*g:lists_filetypes*
List of filetypes for which |lists.vim| should be enabled.
Default: []
*g:lists_maps_default_enable*
Set to |v:false| or 0 to prevent |lists.vim| from applying the default maps.
Useful if you want to create your own mappings.
Default: |v:true|
*g:lists_maps_default_override*
A dictionary that allows to override one or more of the default mappings.
The dictionary keys should be one of the available mappings, possibly with
mode indicator. The value should be the desired map target. The available
mappings with default values are listed in |lists-maps-defaults|.
To disable a map, one can link it to an empty string.
For example, to remap the insert-mode mapping |<plug>(lists-new-element)| to
`<c-t>` and the normal mode variant of |<plug>(lists-toggle)| to `<c-y>`, as
well as disabling the insert mode variant of the latter, one could do this: >
let g:lists_maps_default_override = {
\ 'i_<plug>(lists-new-element)': '<c-t>',
\ 'i_<plug>(lists-toggle)': '',
\ '<plug>(lists-toggle)': '<c-y>',
\}
<
Default: `{}`
*g:lists_todos*
A list of TODO toggles that may be toggled with |<plug>(lists-toggle)|, which
is by default mapped to `<c-s>`.
Default: `['TODO', 'DONE']`
==============================================================================
vim:tw=78:ts=8:ft=help:norl:fdm=marker: