Skip to content

Commit

Permalink
(all) Update help to highlight code inside lists with tree-sitter on.
Browse files Browse the repository at this point in the history
  • Loading branch information
echasnovski committed Jan 29, 2024
1 parent 4fc7c1e commit f4e9507
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 72 deletions.
21 changes: 10 additions & 11 deletions doc/mini-ai.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions doc/mini-align.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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, _)
Expand All @@ -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)
Expand Down Expand Up @@ -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 = {
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-cursorword.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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('<cword>')
local filetype = vim.bo.filetype
Expand Down
8 changes: 4 additions & 4 deletions doc/mini-indentscope.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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
Expand Down
21 changes: 10 additions & 11 deletions doc/mini-surround.txt
Original file line number Diff line number Diff line change
Expand Up @@ -285,17 +285,17 @@ 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), '^.-%(().*()%)$' }
end
<
- 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 {
Expand All @@ -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 }
Expand All @@ -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)
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
21 changes: 10 additions & 11 deletions lua/mini/ai.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -303,7 +303,7 @@
--- end,
--- '^.().*().$'
--- }
--- >
--- <
--- More examples:
--- - See |MiniAi.gen_spec| for function wrappers to create commonly used
--- textobject specifications.
Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions lua/mini/align.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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, _)
Expand All @@ -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)
Expand Down Expand Up @@ -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 = {
Expand Down
4 changes: 2 additions & 2 deletions lua/mini/cursorword.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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('<cword>')
--- local filetype = vim.bo.filetype
Expand Down
8 changes: 4 additions & 4 deletions lua/mini/indentscope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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
Expand Down
21 changes: 10 additions & 11 deletions lua/mini/surround.lua
Original file line number Diff line number Diff line change
Expand Up @@ -281,17 +281,17 @@
--- 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), '^.-%(().*()%)$' }
--- end
--- <
--- - 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 {
Expand All @@ -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 }
Expand All @@ -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)
Expand All @@ -349,7 +349,7 @@
--- end,
--- '^.().*().$'
--- }
--- >
--- <
--- More examples:
--- - See |MiniSurround.gen_spec| for function wrappers to create commonly used
--- surrounding specifications.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f4e9507

Please sign in to comment.