8000 mini.nvim/doc/mini-map.txt at main · vandalt/mini.nvim · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
717 lines (586 loc) · 30.4 KB

mini-map.txt

File metadata and controls

717 lines (586 loc) · 30.4 KB
█
<
Parameters ~
{strings} `(table)` Array of arbitrary strings.
{opts} `(table|nil)` Options. Possible fields:
- <n_rows> - number of rows in output encoding. If too big, will be
truncated to be maximum needed to encode all input strings (taking into
account symbols row resolution). Default: `math.huge`.
- <n_cols> - width of every encoding string. If too big, will be truncated
to be maximum needed to encode all input strings (taking into account
symbols column resolution). Default: `math.huge`.
- <symbols> - array of symbols with extra `resolution` field. See "Encode
symbols" section of |MiniMap.config| for more details. Default: output
of |MiniMap.gen_encode_symbols.block()| with `'3x2'` identifier.
Return ~
`(table)` Array of encoded strings.
------------------------------------------------------------------------------
*MiniMap.open()*
`MiniMap.open`({opts})
Open map window
This creates and shows map window in current tabpage. It basically has
two steps:
- If not already done, create map buffer (used to set lines and other
visual indicators) and map window.
- Call |MiniMap.refresh()|.
Parameters ~
{opts} `(table|nil)` Options used to define map configuration. Same structure
as |MiniMap.config|. Will have effect until at least one tabpage has opened
map window. Default values are taken in the following order:
- From `opts` field of |MiniMap.current|.
- From `vim.b.minimap_config`.
- From |MiniMap.config|.
------------------------------------------------------------------------------
*MiniMap.refresh()*
`MiniMap.refresh`({opts}, {parts})
Refresh map window
This function serves two purposes:
- Update current map configuration via `opts`.
- Update parts of displayed content via `parts`.
Parameters ~
{opts} `(table|nil)` Options used to define map configuration. Same structure
as |MiniMap.config|. Will have effect until at least one tabpage has opened
map window. Default values are taken in the following order:
- From `opts` field of |MiniMap.current|.
- From `vim.b.minimap_config`.
- From |MiniMap.config|.
{parts} `(table|nil)` Which parts to update. Recognised keys with boolean
values (all `true` by default):
- <integrations> - whether to update integration highlights.
- <lines> - whether to update map lines.
- <scrollbar> - whether to update scrollbar.
------------------------------------------------------------------------------
*MiniMap.close()*
`MiniMap.close`()
Close map window
Also resets `opts` field of |MiniMap.current| after closing last map window
(among possibly several tabpages).
------------------------------------------------------------------------------
*MiniMap.toggle()*
`MiniMap.toggle`({opts})
Toggle map window
Open if not shown in current tabpage, close otherwise.
Parameters ~
{opts} `(table|nil)` Input for |MiniMap.open()|.
------------------------------------------------------------------------------
*MiniMap.toggle_focus()*
`MiniMap.toggle_focus`({use_previous_cursor})
Toggle focus to/from map window
When not inside map window, put cursor inside map window; otherwise put
cursor in previous window with source buffer.
When cursor is moving inside map window (but not just after focusing), view of
source window is updated to show first line convertible to current map line.
This allows quick targeted source buffer exploration.
There are at least these extra methods to focus back from map window:
- Press `<CR>` to accept current explored position in source buffer.
Equivalent to calling this function with `false` argument.
- Press `<Esc>` to go back to original position prior focusing on map window.
Equivalent to calling this function with `true` argument.
Parameters ~
{use_previous_cursor} `(boolean|nil)` Whether to focus on source window at
original cursor position (the one prior focusing on map window).
------------------------------------------------------------------------------
*MiniMap.toggle_side()*
`MiniMap.toggle_side`()
Toggle side of map window
A small convenience wrapper for calling |MiniMap.refresh()| to change the
side of map window.
------------------------------------------------------------------------------
*MiniMap.gen_encode_symbols*
`MiniMap.gen_encode_symbols`
Generate encode symbols
This is a table with function elements. Call to actually get encode symbols.
Each element takes a string resolution identifier of a form `'rxc'` (like `'3x2'`)
where `r` is a row resolution of each symbol (how many rows of binary data it
can encode) and `c` is a column resolution (how many columns it can encode).
------------------------------------------------------------------------------
*MiniMap.gen_encode_symbols.block()*
`MiniMap.gen_encode_symbols.block`({id})
Generate block encode symbols
Outputs use solid block to encode binary data. Example: `'🬗'`, `'▟'`, `'█'`.
Parameters ~
{id} `(string)` Resolution identifier.
Available values: `'1x2'`, `'2x1'`, `'2x2'`, `'3x2'` (default in |mini.map|).
------------------------------------------------------------------------------
*MiniMap.gen_encode_symbols.dot()*
`MiniMap.gen_encode_symbols.dot`({id})
Generate dot encode symbols
Outputs use dots to encode binary data. Example: `'⡪'`, `'⣼'`, `'⣿'`.
Parameters ~
{id} `(string)` Resolution identifier. Available values: `'4x2'`, `'3x2'`.
------------------------------------------------------------------------------
*MiniMap.gen_encode_symbols.shade()*
`MiniMap.gen_encode_symbols.shade`({id})
Generate shade encode symbols
Outputs use whole cell shades to encode binary data. They use same set of
characters (`'░'`, `'▒'`, `'▒'`, `'▓'`), but with different resolution.
Parameters ~
{id} `(string)` Resolution identifier. Available values: `'1x2'`, `'2x1'`.
------------------------------------------------------------------------------
*MiniMap.gen_integration*
`MiniMap.gen_integration`
Generate integrations
This is a table with function elements. Call to actually get encode symbols.
Each element takes a table defining highlight groups used for to highlight
map lines.
------------------------------------------------------------------------------
*MiniMap.gen_integration.builtin_search()*
`MiniMap.gen_integration.builtin_search`({hl_groups})
Builtin search
Highlight lines with matches of current builtin search (like with |/|, |?|, etc.).
Integration count reflects number of actual matches.
It prompts integration highlighting update on every change of |'hlsearch'|
(see |OptionSet|) or |v:hlsearch|. Note that it is not happening for some keys:
- After starting search with |n|, |N|, |star|, or |#|.
To enable highlight update on this keys, make custom mappings. Like this: >lua
for _, key in ipairs({ 'n', 'N', '*', '#' }) do
local rhs = key ..
'<Cmd>lua MiniMap.refresh({}, {lines = false, scrollbar = false})<CR>'
vim.keymap.set('n', key, rhs)
end
<
Parameters ~
{hl_groups} `(table|nil)` Table defining highlight groups. Can have the
following fields:
- <search> - highlight group for search matches. Default: |hl-Search|.
------------------------------------------------------------------------------
*MiniMap.gen_integration.diagnostic()*
`MiniMap.gen_integration.diagnostic`({hl_groups})
Builtin diagnostic
Highlight lines with matches of current diagnostic items. Items are computed
with |vim.diagnostic.get()| for current (source) buffer.
It prompts integration highlighting update on every |DiagnosticChanged| event.
Diagnostic items with higher severity (see |vim.diagnostic.severity|) have
higher highlight priority (errors will be shown over all others, etc.).
Parameters ~
{hl_groups} `(table|nil)` Table defining highlight groups. Supplied fields
also define which diagnostic severity to highlight.
Can have the following fields:
- <error> - highlight group for error items.
Default: |hl-DiagnosticFloatingError|.
- <warn> - highlight group for warning items. Default: `nil` (not shown).
- <info> - highlight group for info items. Default: `nil` (not shown).
- <hint> - highlight group for hint items. Default: `nil` (not shown).
Usage ~
>lua
-- Show all diagnostic levels
local map = require('mini.map')
local diagnostic_integration = map.gen_integration.diagnostic({
error = 'DiagnosticFloatingError',
warn = 'DiagnosticFloatingWarn',
info = 'DiagnosticFloatingInfo',
hint = 'DiagnosticFloatingHint',
})
map.setup({ integrations = { diagnostic_integration } })
<
------------------------------------------------------------------------------
*MiniMap.gen_integration.diff()*
`MiniMap.gen_integration.diff`({hl_groups})
General diff hunks from |mini.diff|
Highlight lines which are part of current diff.
Requires |mini.diff| as dependency.
Parameters ~
{hl_groups} `(table|nil)` Table defining highlight groups. If `nil` (not
supplied), this status is not highlighted. Can have the following fields:
- <add> - group name for "add" hunks. Default: "MiniDiffSignAdd".
- <change> - group name for "change" hunks. Default: "MiniDiffSignChange".
- <delete> - group name for "delete" hunks. Default: "MiniDiffSignDelete".
------------------------------------------------------------------------------
*MiniMap.gen_integration.gitsigns()*
`MiniMap.gen_integration.gitsigns`({hl_groups})
Hunks from `lewis6991/gitsigns.nvim`
Highlight lines which have non-trivial Git status.
Requires [lewis6991/gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim).
Parameters ~
{hl_groups} `(table|nil)` Table defining highlight groups. If `nil` (not
supplied), this status is not highlighted. Can have the following fields:
- <add> - group name for added lines. Default: "GitSignsAdd".
- <change> - group name for changed lines. Default: "GitSignsChange".
- <delete> - group name for deleted lines. Default: "GitSignsDelete".
vim:tw=78:ts=8:noet:ft=help:norl:
0