Skip to content

Commit acc3b93

Browse files
committed
rm architechture
1 parent ccf3867 commit acc3b93

File tree

2 files changed

+6
-45
lines changed

2 files changed

+6
-45
lines changed

lua/Comment/api.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,6 @@ api.locked = setmetatable({}, {
488488
end,
489489
})
490490

491-
---@tag comment.api.dotrepeat
492491
---Callback function which does the following
493492
--- 1. Sets 'operatorfunc' for dot-repeat
494493
--- 2. Preserves jumps and marks

lua/Comment/init.lua

Lines changed: 6 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -20,51 +20,13 @@
2020
---dot-repeat, counts, line ('//') and block ('/* */') comments, and can be used
2121
---with motion and text-objects. It has native integration with tressitter to
2222
---support embedded filetypes like html, vue, markdown with codeblocks etc.
23-
---
24-
---Comment.nvim uses |g@| and |Operator-pending-mode| to be able to easily comment
25-
---and to support dot-repeat. Following is the brief architecture of the plugin
26-
---
27-
--->
28-
--- - START (keybinding or API)
29-
---
30-
--- - Determine the region using marks, changed text |'[| |']| or visual |'>| |'<|
31-
---
32-
--- - Pick commentstring either linewise/blockwise from one of the following places
33-
--- 1. pre_hook (if string is returned)
34-
--- 2. stored inside the plugin (with the help of treesitter)
35-
--- 3. vim.bo.commentstring
36-
---
37-
--- - Parse commentstring, returns LHS and RHS of commentstring
38-
---
39-
--- >> Every is_comment check is made using the commentstring from the above step
40-
---
41-
--- >> If `gc` is used on the current line i.e., `gc3w` then use blockwise
42-
---
43-
--- - If linewise
44-
--- 1. if every line is commented
45-
--- 1.1 uncomment
46-
---
47-
--- 2. else
48-
--- 2.1 find the column no. to start the comment from (indentation)
49-
--- 2.2 comment
50-
---
51-
--- - If blockwise
52-
--- 1. if the first line or start of the block is commented with LHS
53-
--- and the last line or end of the block is commented with RHS
54-
--- 1.1 uncomment
55-
---
56-
--- 2. else
57-
--- 2.1 Prepend the LHS into the first line
58-
--- 2.2 Append the RHS into the last line
59-
---
60-
--- >> In visual block, we can't preprend or append, so in this case we need
61-
--- >> to slice and concat the line, putting RHS and LHS of commentstring into
62-
--- >> right place when doing comment and removing LHS and RHS when uncomment
63-
---
64-
--- - END
65-
---<
6623
---@brief ]]
67-
24+
---@tag comment.dotrepeat
25+
---@brief [[
26+
---Comment.nvim uses |operatorfunc| combined with |g@| to support dot-repeat, and
27+
---various marks i.e., |'[| |']| |'<| |'>| to deduce the region with the {motion}
28+
---argument provided by 'operatorfunc'. See |comment.api.call|
29+
---@brief ]]
6830
---@tag comment.commentstring
6931
---@brief [[
7032
---Comment.nvim picks commentstring, either linewise/blockwise, from one of the

0 commit comments

Comments
 (0)