From f4e9507094d0fe93c9f5fa3cfea556caadc8f9ef Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Mon, 29 Jan 2024 19:50:23 +0200 Subject: [PATCH] (all) Update help to highlight code inside lists with tree-sitter on. Details: - https://github.com/neovim/tree-sitter-vimdoc/issues/118 --- doc/mini-ai.txt | 21 ++++++++++----------- doc/mini-align.txt | 16 ++++++++-------- doc/mini-cursorword.txt | 4 ++-- doc/mini-indentscope.txt | 8 ++++---- doc/mini-surround.txt | 21 ++++++++++----------- lua/mini/ai.lua | 21 ++++++++++----------- lua/mini/align.lua | 16 ++++++++-------- lua/mini/cursorword.lua | 4 ++-- lua/mini/indentscope.lua | 8 ++++---- lua/mini/surround.lua | 21 ++++++++++----------- 10 files changed, 68 insertions(+), 72 deletions(-) diff --git a/doc/mini-ai.txt b/doc/mini-ai.txt index da5f0866..df28a210 100644 --- a/doc/mini-ai.txt +++ b/doc/mini-ai.txt @@ -250,16 +250,16 @@ Textobject specification has a structure of composed pattern (see arguments as |MiniAi.find_textobject()| and should return one of: - Composed pattern. Useful for implementing user input. Example of simplified variant of textobject for function call with name taken - from user prompt: -> + from user prompt: > + function() local left_edge = vim.pesc(vim.fn.input('Function name: ')) return { string.format('%s+%%b()', left_edge), '^.-%(().*()%)$' } end < - Single output region. Useful to allow full control over - textobject. Will be taken as is. Example of returning whole buffer: -> + textobject. Will be taken as is. Example of returning whole buffer: > + function() local from = { line = 1, col = 1 } local to = { @@ -273,8 +273,8 @@ Textobject specification has a structure of composed pattern (see instruments, like treesitter (see |MiniAi.gen_spec.treesitter()|). The best region will be picked in the same manner as with composed pattern (respecting options `n_lines`, `search_method`, etc.). - Example of selecting "best" line with display width more than 80: -> + Example of selecting "best" line with display width more than 80: > + function(_, _, _) local res = {} for i = 1, vim.api.nvim_buf_line_count(0) do @@ -297,8 +297,8 @@ Textobject specification has a structure of composed pattern (see !IMPORTANT NOTE!: it means that output's `from` shouldn't be strictly to the left of `init` (it will lead to infinite loop). Not allowed as last item (as it should be pattern with captures). - Example of matching only balanced parenthesis with big enough width: -> + Example of matching only balanced parenthesis with big enough width: > + { '%b()', function(s, init) @@ -307,7 +307,7 @@ Textobject specification has a structure of composed pattern (see end, '^.().*().$' } -> +< More examples: - See |MiniAi.gen_spec| for function wrappers to create commonly used textobject specifications. @@ -711,8 +711,7 @@ Example configuration for function definition textobject with }) } }) -> - +< Notes: - By default query is done using 'nvim-treesitter' plugin if it is present (falls back to builtin methods otherwise). This allows for a more diff --git a/doc/mini-align.txt b/doc/mini-align.txt index 5d0c318d..457c3fc5 100644 --- a/doc/mini-align.txt +++ b/doc/mini-align.txt @@ -488,14 +488,14 @@ Each modifier function: - Has signature `(steps, opts)` and should modify any of its input in place. Examples: -- Modifier function used for default 'i' modifier: -> +- Modifier function used for default 'i' modifier: > + function(steps, _) table.insert(steps.pre_split, MiniAlign.gen_step.ignore_split()) end < -- Tweak 't' modifier to use highest indentation instead of keeping it: -> +- Tweak 't' modifier to use highest indentation instead of keeping it: > + require('mini.align').setup({ modifiers = { t = function(steps, _) @@ -506,8 +506,8 @@ Examples: }) < - Tweak `j` modifier to cycle through available "justify_side" option - values (like in 'junegunn/vim-easy-align'): -> + values (like in 'junegunn/vim-easy-align'): > + require('mini.align').setup({ modifiers = { j = function(_, opts) @@ -536,8 +536,8 @@ For more details about options see |MiniAlign.align_strings()| and entries of alignment process. Examples: -- Align by default only first pair of columns: -> +- Align by default only first pair of columns: > + local align = require('mini.align') align.setup({ steps = { diff --git a/doc/mini-cursorword.txt b/doc/mini-cursorword.txt index b8bda38f..8528d83d 100644 --- a/doc/mini-cursorword.txt +++ b/doc/mini-cursorword.txt @@ -57,8 +57,8 @@ highlighting update. Module-specific disabling: - Don't show highlighting if cursor is on the word that is in a blocklist of current filetype. In this example, blocklist for "lua" is "local" and - "require" words, for "javascript" - "import": -> + "require" words, for "javascript" - "import": > + _G.cursorword_blocklist = function() local curword = vim.fn.expand('') local filetype = vim.bo.filetype diff --git a/doc/mini-indentscope.txt b/doc/mini-indentscope.txt index de8e889f..c160450f 100644 --- a/doc/mini-indentscope.txt +++ b/doc/mini-indentscope.txt @@ -175,8 +175,8 @@ Default values: It also controls how empty lines are treated: they are included in scope only if followed by a border. Another way of looking at it is that indent of blank line is computed based on value of `border` option. - Here is an illustration of how `border` works in presence of empty lines: -> + Here is an illustration of how `border` works in presence of empty lines: > + |both|bottom|top|none| 1|function foo() | 0 | 0 | 0 | 0 | 2| | 4 | 0 | 4 | 0 | @@ -196,8 +196,8 @@ Default values: computation of scope. If `true`, reference indent is a minimum of reference line's indent and cursor column. In main example, here how scope's body range differs depending on cursor column and `indent_at_cursor` - value (assuming cursor is on line 3 and it is whole buffer): -> + value (assuming cursor is on line 3 and it is whole buffer): > + Column\Option true|false 1 and 2 2-5 | 2-4 3 and more 2-4 | 2-4 diff --git a/doc/mini-surround.txt b/doc/mini-surround.txt index 4e7978a2..9ef2cc78 100644 --- a/doc/mini-surround.txt +++ b/doc/mini-surround.txt @@ -285,8 +285,8 @@ Specification for input surrounding has a structure of composed pattern arguments and should return one of: - Composed pattern. Useful for implementing user input. Example of simplified variant of input surrounding for function call with - name taken from user prompt: -> + name taken from user prompt: > + function() local left_edge = vim.pesc(vim.fn.input('Function name: ')) return { string.format('%s+%%b()', left_edge), '^.-%(().*()%)$' } @@ -294,8 +294,8 @@ Specification for input surrounding has a structure of composed pattern < - Single region pair (see |MiniSurround-glossary|). Useful to allow full control over surrounding. Will be taken as is. Example of - returning first and last lines of a buffer: -> + returning first and last lines of a buffer: > + function() local n_lines = vim.fn.line('$') return { @@ -315,8 +315,8 @@ Specification for input surrounding has a structure of composed pattern best region pair will be picked in the same manner as with composed pattern (respecting options `n_lines`, `search_method`, etc.) using output region (from start of left region to end of right region). - Example using edges of "best" line with display width more than 80: -> + Example using edges of "best" line with display width more than 80: > + function() local make_line_region_pair = function(n) local left = { line = n, col = 1 } @@ -343,8 +343,8 @@ Specification for input surrounding has a structure of composed pattern !IMPORTANT NOTE!: it means that output's `from` shouldn't be strictly to the left of `init` (it will lead to infinite loop). Not allowed as last item (as it should be pattern with captures). - Example of matching only balanced parenthesis with big enough width: -> + Example of matching only balanced parenthesis with big enough width: > + { '%b()', function(s, init) @@ -353,7 +353,7 @@ Specification for input surrounding has a structure of composed pattern end, '^.().*().$' } -> +< More examples: - See |MiniSurround.gen_spec| for function wrappers to create commonly used surrounding specifications. @@ -769,8 +769,7 @@ Example configuration for function definition textobject with f = ts_input({ outer = '@call.outer', inner = '@call.inner' }), } }) -> - +< Notes: - By default query is done using 'nvim-treesitter' plugin if it is present (falls back to builtin methods otherwise). This allows for a more diff --git a/lua/mini/ai.lua b/lua/mini/ai.lua index cd50eca0..8ed163f7 100644 --- a/lua/mini/ai.lua +++ b/lua/mini/ai.lua @@ -246,16 +246,16 @@ --- arguments as |MiniAi.find_textobject()| and should return one of: --- - Composed pattern. Useful for implementing user input. Example of --- simplified variant of textobject for function call with name taken ---- from user prompt: ---- > +--- from user prompt: > +--- --- function() --- local left_edge = vim.pesc(vim.fn.input('Function name: ')) --- return { string.format('%s+%%b()', left_edge), '^.-%(().*()%)$' } --- end --- < --- - Single output region. Useful to allow full control over ---- textobject. Will be taken as is. Example of returning whole buffer: ---- > +--- textobject. Will be taken as is. Example of returning whole buffer: > +--- --- function() --- local from = { line = 1, col = 1 } --- local to = { @@ -269,8 +269,8 @@ --- instruments, like treesitter (see |MiniAi.gen_spec.treesitter()|). --- The best region will be picked in the same manner as with composed --- pattern (respecting options `n_lines`, `search_method`, etc.). ---- Example of selecting "best" line with display width more than 80: ---- > +--- Example of selecting "best" line with display width more than 80: > +--- --- function(_, _, _) --- local res = {} --- for i = 1, vim.api.nvim_buf_line_count(0) do @@ -293,8 +293,8 @@ --- !IMPORTANT NOTE!: it means that output's `from` shouldn't be strictly --- to the left of `init` (it will lead to infinite loop). Not allowed as --- last item (as it should be pattern with captures). ---- Example of matching only balanced parenthesis with big enough width: ---- > +--- Example of matching only balanced parenthesis with big enough width: > +--- --- { --- '%b()', --- function(s, init) @@ -303,7 +303,7 @@ --- end, --- '^.().*().$' --- } ---- > +--- < --- More examples: --- - See |MiniAi.gen_spec| for function wrappers to create commonly used --- textobject specifications. @@ -894,8 +894,7 @@ end --- }) --- } --- }) ---- > ---- +--- < --- Notes: --- - By default query is done using 'nvim-treesitter' plugin if it is present --- (falls back to builtin methods otherwise). This allows for a more diff --git a/lua/mini/align.lua b/lua/mini/align.lua index f55afdf2..3abc2031 100644 --- a/lua/mini/align.lua +++ b/lua/mini/align.lua @@ -442,14 +442,14 @@ end --- - Has signature `(steps, opts)` and should modify any of its input in place. --- --- Examples: ---- - Modifier function used for default 'i' modifier: ---- > +--- - Modifier function used for default 'i' modifier: > +--- --- function(steps, _) --- table.insert(steps.pre_split, MiniAlign.gen_step.ignore_split()) --- end --- < ---- - Tweak 't' modifier to use highest indentation instead of keeping it: ---- > +--- - Tweak 't' modifier to use highest indentation instead of keeping it: > +--- --- require('mini.align').setup({ --- modifiers = { --- t = function(steps, _) @@ -460,8 +460,8 @@ end --- }) --- < --- - Tweak `j` modifier to cycle through available "justify_side" option ---- values (like in 'junegunn/vim-easy-align'): ---- > +--- values (like in 'junegunn/vim-easy-align'): > +--- --- require('mini.align').setup({ --- modifiers = { --- j = function(_, opts) @@ -490,8 +490,8 @@ end --- alignment process. --- --- Examples: ---- - Align by default only first pair of columns: ---- > +--- - Align by default only first pair of columns: > +--- --- local align = require('mini.align') --- align.setup({ --- steps = { diff --git a/lua/mini/cursorword.lua b/lua/mini/cursorword.lua index 1672c45c..5e508520 100644 --- a/lua/mini/cursorword.lua +++ b/lua/mini/cursorword.lua @@ -57,8 +57,8 @@ --- Module-specific disabling: --- - Don't show highlighting if cursor is on the word that is in a blocklist --- of current filetype. In this example, blocklist for "lua" is "local" and ---- "require" words, for "javascript" - "import": ---- > +--- "require" words, for "javascript" - "import": > +--- --- _G.cursorword_blocklist = function() --- local curword = vim.fn.expand('') --- local filetype = vim.bo.filetype diff --git a/lua/mini/indentscope.lua b/lua/mini/indentscope.lua index 7b1458e8..9c59aa38 100644 --- a/lua/mini/indentscope.lua +++ b/lua/mini/indentscope.lua @@ -139,8 +139,8 @@ end --- It also controls how empty lines are treated: they are included in scope --- only if followed by a border. Another way of looking at it is that indent --- of blank line is computed based on value of `border` option. ---- Here is an illustration of how `border` works in presence of empty lines: ---- > +--- Here is an illustration of how `border` works in presence of empty lines: > +--- --- |both|bottom|top|none| --- 1|function foo() | 0 | 0 | 0 | 0 | --- 2| | 4 | 0 | 4 | 0 | @@ -160,8 +160,8 @@ end --- computation of scope. If `true`, reference indent is a minimum of --- reference line's indent and cursor column. In main example, here how --- scope's body range differs depending on cursor column and `indent_at_cursor` ---- value (assuming cursor is on line 3 and it is whole buffer): ---- > +--- value (assuming cursor is on line 3 and it is whole buffer): > +--- --- Column\Option true|false --- 1 and 2 2-5 | 2-4 --- 3 and more 2-4 | 2-4 diff --git a/lua/mini/surround.lua b/lua/mini/surround.lua index 22989d06..ad62e567 100644 --- a/lua/mini/surround.lua +++ b/lua/mini/surround.lua @@ -281,8 +281,8 @@ --- arguments and should return one of: --- - Composed pattern. Useful for implementing user input. Example of --- simplified variant of input surrounding for function call with ---- name taken from user prompt: ---- > +--- name taken from user prompt: > +--- --- function() --- local left_edge = vim.pesc(vim.fn.input('Function name: ')) --- return { string.format('%s+%%b()', left_edge), '^.-%(().*()%)$' } @@ -290,8 +290,8 @@ --- < --- - Single region pair (see |MiniSurround-glossary|). Useful to allow --- full control over surrounding. Will be taken as is. Example of ---- returning first and last lines of a buffer: ---- > +--- returning first and last lines of a buffer: > +--- --- function() --- local n_lines = vim.fn.line('$') --- return { @@ -311,8 +311,8 @@ --- best region pair will be picked in the same manner as with composed --- pattern (respecting options `n_lines`, `search_method`, etc.) using --- output region (from start of left region to end of right region). ---- Example using edges of "best" line with display width more than 80: ---- > +--- Example using edges of "best" line with display width more than 80: > +--- --- function() --- local make_line_region_pair = function(n) --- local left = { line = n, col = 1 } @@ -339,8 +339,8 @@ --- !IMPORTANT NOTE!: it means that output's `from` shouldn't be strictly --- to the left of `init` (it will lead to infinite loop). Not allowed as --- last item (as it should be pattern with captures). ---- Example of matching only balanced parenthesis with big enough width: ---- > +--- Example of matching only balanced parenthesis with big enough width: > +--- --- { --- '%b()', --- function(s, init) @@ -349,7 +349,7 @@ --- end, --- '^.().*().$' --- } ---- > +--- < --- More examples: --- - See |MiniSurround.gen_spec| for function wrappers to create commonly used --- surrounding specifications. @@ -947,8 +947,7 @@ MiniSurround.gen_spec = { input = {}, output = {} } --- f = ts_input({ outer = '@call.outer', inner = '@call.inner' }), --- } --- }) ---- > ---- +--- < --- Notes: --- - By default query is done using 'nvim-treesitter' plugin if it is present --- (falls back to builtin methods otherwise). This allows for a more