From 3ad9d455a91b8bf3c24d4e50518d9a6b9dddb42c 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 ++++++++++----------- lua/mini/ai.lua | 21 ++++++++++----------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/doc/mini-ai.txt b/doc/mini-ai.txt index da5f086..df28a21 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/lua/mini/ai.lua b/lua/mini/ai.lua index cd50eca..8ed163f 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