Skip to content

Commit c7e99d4

Browse files
numToStrgithub-actions[bot]
authored andcommitted
chore(docs): auto-generate :help doc
1 parent 089b972 commit c7e99d4

File tree

1 file changed

+66
-23
lines changed

1 file changed

+66
-23
lines changed

doc/Comment.txt

+66-23
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ Core Lua API··································
2222
Language/Filetype detection·········································|comment.ft|
2323
Utilities························································|comment.utils|
2424
Operator-mode API···············································|comment.opfunc|
25-
Insert API·······················································|comment.extra|
25+
Extra API························································|comment.extra|
2626

2727
================================================================================
2828
Introduction *comment-nvim*
2929

3030
Comment.nvim is a smart and powerful comment plugin for neovim. It supports
3131
dot-repeat, counts, line ('//') and block ('/* */') comments, and can be used
32-
with motion and text-objects. It has native integration with tressitter to
32+
with motion and text-objects. It has native integration with |tressitter| to
3333
support embedded filetypes like html, vue, markdown with codeblocks etc.
3434

3535
*comment.dotrepeat*
@@ -58,6 +58,10 @@ filetype also exists in the |comment.ft| then the commenting will be done using
5858
the string in |comment.ft| instead of using 'commentstring'. To override this
5959
behavior, you have to manually return the 'commentstring' from 'pre_hook'.
6060

61+
*comment.sourcecode*
62+
Comment.nvim is FOSS provided under MIT license. All the source code is avaiable
63+
at https://github.com/numToStr/Comment.nvim
64+
6165
================================================================================
6266
Usage *comment.usage*
6367

@@ -80,6 +84,10 @@ C.setup({config?}) *comment.usage.setup*
8084

8185
Usage: ~
8286
>
87+
-- Use default configuration
88+
require('Comment').setup()
89+
90+
-- or with custom configuration
8391
require('Comment').setup({
8492
ignore = '^$',
8593
toggler = {
@@ -97,25 +105,64 @@ C.setup({config?}) *comment.usage.setup*
97105
================================================================================
98106
Configuration *comment.config*
99107

108+
*comment.config.defaults*
109+
Following is the default config for the |comment.usage.setup|. If you want to
110+
override, just modify the option that you want, then it will be merged with the
111+
default config.
112+
113+
>
114+
{
115+
padding = true,
116+
sticky = true,
117+
ignore = nil,
118+
toggler = {
119+
line = 'gcc',
120+
block = 'gbc',
121+
},
122+
opleader = {
123+
line = 'gc',
124+
block = 'gb',
125+
},
126+
extra = {
127+
above = 'gcO',
128+
below = 'gco',
129+
eol = 'gcA',
130+
},
131+
mappings = {
132+
basic = true,
133+
extra = true,
134+
extended = false,
135+
},
136+
pre_hook = nil,
137+
post_hook = nil,
138+
}
139+
<
140+
100141
CommentConfig *comment.config.CommentConfig*
101142
Plugin's configuration
102143

103144
Fields: ~
104-
{padding} (boolean) Controls space between the comment
105-
and the line (default: 'true')
106-
{sticky} (boolean) Whether cursor should stay at the
107-
same position. Only works with NORMAL
108-
mode mappings (default: 'true')
109-
{ignore} (string|fun():string) Lua pattern used to ignore lines
110-
during (un)comment (default: 'nil')
111-
{mappings} (Mappings|boolean)
145+
{padding} (boolean|fun():boolean) Controls space between the comment
146+
and the line (default: 'true')
147+
{sticky} (boolean) Whether cursor should stay at the
148+
same position. Only works in NORMAL
149+
mode mappings (default: 'true')
150+
{ignore} (string|fun():string) Lua pattern used to ignore lines
151+
during (un)comment (default: 'nil')
152+
{mappings} (Mappings|false) Enables |comment.keybindings|
153+
NOTE: If given 'false', then the
154+
plugin won't create any mappings
112155
{toggler} (Toggler)
113156
{opleader} (Opleader)
114157
{extra} (ExtraMapping)
115-
{pre_hook} (fun(ctx):string) Function to call before (un)comment
116-
(default: 'nil')
117-
{post_hook} (fun(ctx)) Function to call after (un)comment
118-
(default: 'nil')
158+
{pre_hook} (fun(ctx):string) Function to call before (un)comment.
159+
It is called with a {ctx} argument
160+
of type |comment.utils.CommentCtx|
161+
(default: 'nil')
162+
{post_hook} (fun(ctx)) Function to call after (un)comment.
163+
It is called with a {ctx} argument
164+
of type |comment.utils.CommentCtx|
165+
(default: 'nil')
119166

120167

121168
Mappings *comment.config.Mappings*
@@ -287,8 +334,6 @@ api.toggle *comment.api.toggle*
287334
api.toggle.blockwise.current(motion?, config?)
288335
api.toggle.blockwise.count(count, config?)
289336
290-
-- NORMAL mode
291-
292337
-- Toggle current line (linewise) using C-/
293338
vim.keymap.set('n', '<C-_>', api.toggle.linewise.current)
294339
@@ -309,19 +354,17 @@ api.toggle *comment.api.toggle*
309354
{ expr = true }
310355
)
311356
312-
-- VISUAL mode
313-
314357
local esc = vim.api.nvim_replace_termcodes(
315358
'<ESC>', true, false, true
316359
)
317360
318-
-- Linewise toggle (linewise)
361+
-- Toggle selection (linewise)
319362
vim.keymap.set('x', '<leader>c', function()
320363
vim.api.nvim_feedkeys(esc, 'nx', false)
321364
api.toggle.linewise(vim.fn.visualmode())
322365
end)
323366
324-
-- Blockwise toggle (blockwise)
367+
-- Toggle selection (blockwise)
325368
vim.keymap.set('x', '<leader>b', function()
326369
vim.api.nvim_feedkeys(esc, 'nx', false)
327370
api.toggle.blockwise(vim.fn.visualmode())
@@ -674,7 +717,7 @@ U.get_count_lines({count}) *comment.utils.get_count_lines*
674717
{count} (integer) Probably 'vim.v.count'
675718

676719
Returns: ~
677-
{string[]} of lines
720+
{string[]} List of lines
678721
{CommentRange}
679722

680723

@@ -685,7 +728,7 @@ U.get_lines({range}) *comment.utils.get_lines*
685728
{range} (CommentRange)
686729

687730
Returns: ~
688-
{string[]} of lines
731+
{string[]} List of lines
689732

690733

691734
U.unwrap_cstr({cstr}) *comment.utils.unwrap_cstr*
@@ -843,7 +886,7 @@ Op.blockwise({param}, {partial?}) *comment.opfunc.blockwise*
843886

844887

845888
================================================================================
846-
Insert API *comment.extra*
889+
Extra API *comment.extra*
847890

848891
Underlying functions that powers the |comment.api.insert| lua API.
849892

0 commit comments

Comments
 (0)