docs: MAINTAIN.md, nvim_get_mark

This commit is contained in:
Justin M. Keyes
2023-07-04 19:22:04 +02:00
parent 8c9e37cc09
commit 00d2f4b96e
7 changed files with 77 additions and 58 deletions

View File

@@ -128,17 +128,25 @@ These dependencies are "vendored" (inlined), we must update the sources manually
We may maintain forks, if we are waiting on upstream changes: https://github.com/neovim/neovim/wiki/Deps We may maintain forks, if we are waiting on upstream changes: https://github.com/neovim/neovim/wiki/Deps
CI Non-technical dependencies
-------------- --------------------------
* Domain names (held in https://namecheap.com):
* neovim.org
* neovim.io
* packspec.org
* pkgjson.org
Automation (CI)
---------------
Our CI and automation jobs are primarily driven by GitHub Actions. Guidelines:
### General ### General
As our CI is primarily dependent on GitHub Actions at the moment, then so will * Avoid macOS if an Ubuntu or a Windows runner can be used instead. This is
our CI strategy be. The following guidelines have worked well for us so far: because macOS runners have [tighter restrictions on the number of concurrent
jobs](https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#usage-limits).
* Never use a macOS runner if an Ubuntu or a Windows runner can be used
instead. This is because macOS runners have a [tighter restrictions on the
number of concurrent jobs](https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#usage-limits).
### Runner versions ### Runner versions

View File

@@ -987,13 +987,14 @@ nvim_get_keymap({mode}) *nvim_get_keymap()*
"buffer" key is always zero. "buffer" key is always zero.
nvim_get_mark({name}, {opts}) *nvim_get_mark()* nvim_get_mark({name}, {opts}) *nvim_get_mark()*
Return a tuple (row, col, buffer, buffername) representing the position of Returns a `(row, col, buffer, buffername)` tuple representing the position
the uppercase/file named mark. See |mark-motions|. of the uppercase/file named mark. "End of line" column position is
returned as |v:maxcol| (big number). See |mark-motions|.
Marks are (1,0)-indexed. |api-indexing| Marks are (1,0)-indexed. |api-indexing|
Note: Note:
fails with error if a lowercase or buffer local named mark is used. Lowercase name (or other buffer-local mark) is an error.
Parameters: ~ Parameters: ~
• {name} Mark name • {name} Mark name
@@ -2232,7 +2233,8 @@ nvim_buf_get_lines({buffer}, {start}, {end}, {strict_indexing})
Array of lines, or empty array for unloaded buffer. Array of lines, or empty array for unloaded buffer.
nvim_buf_get_mark({buffer}, {name}) *nvim_buf_get_mark()* nvim_buf_get_mark({buffer}, {name}) *nvim_buf_get_mark()*
Returns a tuple (row,col) representing the position of the named mark. See Returns a `(row,col)` tuple representing the position of the named mark.
"End of line" column position is returned as |v:maxcol| (big number). See
|mark-motions|. |mark-motions|.
Marks are (1,0)-indexed. |api-indexing| Marks are (1,0)-indexed. |api-indexing|

View File

@@ -1475,6 +1475,9 @@ on_key({fn}, {ns_id}) *vim.on_key()*
The Nvim command-line option |-w| is related but does not support The Nvim command-line option |-w| is related but does not support
callbacks and cannot be toggled dynamically. callbacks and cannot be toggled dynamically.
Note:
{fn} will be removed on error.
Note: Note:
{fn} will not be cleared by |nvim_buf_clear_namespace()| {fn} will not be cleared by |nvim_buf_clear_namespace()|
@@ -1482,10 +1485,9 @@ on_key({fn}, {ns_id}) *vim.on_key()*
{fn} will receive the keys after mappings have been evaluated {fn} will receive the keys after mappings have been evaluated
Parameters: ~ Parameters: ~
• {fn} (function) Callback function. It should take one string • {fn} fun(key: string) Function invoked on every key press.
argument. On each key press, Nvim passes the key char to |i_CTRL-V| Returning nil removes the callback associated with
fn(). |i_CTRL-V| If {fn} is nil, it removes the callback for namespace {ns_id}.
the associated {ns_id}
• {ns_id} integer? Namespace ID. If nil or 0, generates and returns a • {ns_id} integer? Namespace ID. If nil or 0, generates and returns a
new |nvim_create_namespace()| id. new |nvim_create_namespace()| id.
@@ -1493,9 +1495,6 @@ on_key({fn}, {ns_id}) *vim.on_key()*
(integer) Namespace id associated with {fn}. Or count of all callbacks (integer) Namespace id associated with {fn}. Or count of all callbacks
if on_key() is called without arguments. if on_key() is called without arguments.
Note:
{fn} will be removed if an error occurs while calling.
paste({lines}, {phase}) *vim.paste()* paste({lines}, {phase}) *vim.paste()*
Paste handler, invoked by |nvim_paste()| when a conforming UI (such as the Paste handler, invoked by |nvim_paste()| when a conforming UI (such as the
|TUI|) pastes text into the editor. |TUI|) pastes text into the editor.
@@ -1543,22 +1542,26 @@ print({...}) *vim.print()*
• |:=| • |:=|
region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive}) *vim.region()* region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive}) *vim.region()*
Get a table of lines with start, end columns for a region marked by two Gets a dict of line segment ("chunk") positions for the region from `pos1`
points. Input and output positions are (0,0)-indexed and indicate byte to `pos2`.
positions.
Input and output positions are byte positions, (0,0)-indexed. "End of
line" column position (for example, |linewise| visual selection) is
returned as |v:maxcol| (big number).
Parameters: ~ Parameters: ~
• {bufnr} (integer) number of buffer • {bufnr} (integer) Buffer number, or 0 for current buffer
• {pos1} integer[]|string start of region as a (line, column) • {pos1} integer[]|string Start of region as a (line, column)
tuple or string accepted by |getpos()| tuple or |getpos()|-compatible string
• {pos2} integer[]|string end of region as a (line, column) tuple • {pos2} integer[]|string End of region as a (line, column) tuple
or string accepted by |getpos()| or |getpos()|-compatible string
• {regtype} (string) type of selection, see |setreg()| • {regtype} (string) |setreg()|-style selection type
• {inclusive} (boolean) indicating whether column of pos2 is inclusive • {inclusive} (boolean) Controls whether `pos2` column is inclusive
(see also 'selection').
Return: ~ Return: ~
(table) region Table of the form `{linenr = {startcol,endcol}}`. (table) region Dict of the form `{linenr = {startcol,endcol}}`.
`endcol` is exclusive, and whole lines are marked with `endcol` is exclusive, and whole lines are returned as
`{startcol,endcol} = {0,-1}`. `{startcol,endcol} = {0,-1}`.
schedule_wrap({cb}) *vim.schedule_wrap()* schedule_wrap({cb}) *vim.schedule_wrap()*

View File

@@ -536,12 +536,14 @@ Working directory (Vim implemented some of these after Nvim):
working directory. Use `getcwd(-1, -1)` to get the global working directory. working directory. Use `getcwd(-1, -1)` to get the global working directory.
============================================================================== ==============================================================================
Missing legacy features *nvim-missing* Missing features *nvim-missing*
These legacy Vim features are not yet implemented: These legacy Vim features are not yet implemented:
*:gui* - *:gui*
*:gvim* - *:gvim*
- *'completepopup'*
- *'previewpopup'*
============================================================================== ==============================================================================
Removed legacy features *nvim-removed* Removed legacy features *nvim-removed*
@@ -644,6 +646,7 @@ Options:
'highlight' (Names of builtin |highlight-groups| cannot be changed.) 'highlight' (Names of builtin |highlight-groups| cannot be changed.)
*'hkmap'* *'hk'* use `set keymap=hebrew` instead. *'hkmap'* *'hk'* use `set keymap=hebrew` instead.
*'hkmapp'* *'hkp'* use `set keymap=hebrewp` instead. *'hkmapp'* *'hkp'* use `set keymap=hebrewp` instead.
keyprotocol
*'pastetoggle'* *'pt'* Just Paste It.™ |paste| is handled automatically when *'pastetoggle'* *'pt'* Just Paste It.™ |paste| is handled automatically when
you paste text using your terminal's or GUI's paste feature (CTRL-SHIFT-v, you paste text using your terminal's or GUI's paste feature (CTRL-SHIFT-v,
@@ -687,6 +690,7 @@ Options:
Use |g8| or |ga|. See |mbyte-combining|. Use |g8| or |ga|. See |mbyte-combining|.
*'maxmem'* Nvim delegates memory-management to the OS. *'maxmem'* Nvim delegates memory-management to the OS.
*'maxmemtot'* Nvim delegates memory-management to the OS. *'maxmemtot'* Nvim delegates memory-management to the OS.
printoptions
*'printdevice'* *'printdevice'*
*'printencoding'* *'printencoding'*
*'printexpr'* *'printexpr'*

View File

@@ -460,17 +460,18 @@ do
vim.t = make_dict_accessor('t') vim.t = make_dict_accessor('t')
end end
--- Get a table of lines with start, end columns for a region marked by two points. --- Gets a dict of line segment ("chunk") positions for the region from `pos1` to `pos2`.
--- Input and output positions are (0,0)-indexed and indicate byte positions.
--- ---
---@param bufnr integer number of buffer --- Input and output positions are byte positions, (0,0)-indexed. "End of line" column
---@param pos1 integer[]|string start of region as a (line, column) tuple or string accepted by |getpos()| --- position (for example, |linewise| visual selection) is returned as |v:maxcol| (big number).
---@param pos2 integer[]|string end of region as a (line, column) tuple or string accepted by |getpos()| ---
---@param regtype string type of selection, see |setreg()| ---@param bufnr integer Buffer number, or 0 for current buffer
---@param inclusive boolean indicating whether column of pos2 is inclusive ---@param pos1 integer[]|string Start of region as a (line, column) tuple or |getpos()|-compatible string
---@return table region Table of the form `{linenr = {startcol,endcol}}`. ---@param pos2 integer[]|string End of region as a (line, column) tuple or |getpos()|-compatible string
--- `endcol` is exclusive, and whole lines are marked with ---@param regtype string \|setreg()|-style selection type
--- `{startcol,endcol} = {0,-1}`. ---@param inclusive boolean Controls whether `pos2` column is inclusive (see also 'selection').
---@return table region Dict of the form `{linenr = {startcol,endcol}}`. `endcol` is exclusive, and
---whole lines are returned as `{startcol,endcol} = {0,-1}`.
function vim.region(bufnr, pos1, pos2, regtype, inclusive) function vim.region(bufnr, pos1, pos2, regtype, inclusive)
if not vim.api.nvim_buf_is_loaded(bufnr) then if not vim.api.nvim_buf_is_loaded(bufnr) then
vim.fn.bufload(bufnr) vim.fn.bufload(bufnr)
@@ -610,18 +611,17 @@ local on_key_cbs = {}
--- The Nvim command-line option |-w| is related but does not support callbacks --- The Nvim command-line option |-w| is related but does not support callbacks
--- and cannot be toggled dynamically. --- and cannot be toggled dynamically.
--- ---
---@param fn function: Callback function. It should take one string argument. ---@note {fn} will be removed on error.
--- On each key press, Nvim passes the key char to fn(). |i_CTRL-V| ---@note {fn} will not be cleared by |nvim_buf_clear_namespace()|
--- If {fn} is nil, it removes the callback for the associated {ns_id} ---@note {fn} will receive the keys after mappings have been evaluated
---
---@param fn fun(key: string) Function invoked on every key press. |i_CTRL-V|
--- Returning nil removes the callback associated with namespace {ns_id}.
---@param ns_id integer? Namespace ID. If nil or 0, generates and returns a new ---@param ns_id integer? Namespace ID. If nil or 0, generates and returns a new
--- |nvim_create_namespace()| id. --- |nvim_create_namespace()| id.
--- ---
---@return integer Namespace id associated with {fn}. Or count of all callbacks ---@return integer Namespace id associated with {fn}. Or count of all callbacks
---if on_key() is called without arguments. ---if on_key() is called without arguments.
---
---@note {fn} will be removed if an error occurs while calling.
---@note {fn} will not be cleared by |nvim_buf_clear_namespace()|
---@note {fn} will receive the keys after mappings have been evaluated
function vim.on_key(fn, ns_id) function vim.on_key(fn, ns_id)
if fn == nil and ns_id == nil then if fn == nil and ns_id == nil then
return #on_key_cbs return #on_key_cbs
@@ -1049,10 +1049,10 @@ function vim._init_default_mappings()
map('i', '<C-W>', '<C-G>u<C-W>') map('i', '<C-W>', '<C-G>u<C-W>')
vim.keymap.set('x', '*', function() vim.keymap.set('x', '*', function()
_visual_search('/') _visual_search('/')
end, { desc = 'Nvim builtin', silent = true }) end, { desc = ':help v_star-default', silent = true })
vim.keymap.set('x', '#', function() vim.keymap.set('x', '#', function()
_visual_search('?') _visual_search('?')
end, { desc = 'Nvim builtin', silent = true }) end, { desc = ':help v_#-default', silent = true })
-- Use : instead of <Cmd> so that ranges are supported. #19365 -- Use : instead of <Cmd> so that ranges are supported. #19365
map('n', '&', ':&&<CR>') map('n', '&', ':&&<CR>')

View File

@@ -1192,8 +1192,9 @@ Boolean nvim_buf_set_mark(Buffer buffer, String name, Integer line, Integer col,
return res; return res;
} }
/// Returns a tuple (row,col) representing the position of the named mark. See /// Returns a `(row,col)` tuple representing the position of the named mark.
/// |mark-motions|. /// "End of line" column position is returned as |v:maxcol| (big number).
/// See |mark-motions|.
/// ///
/// Marks are (1,0)-indexed. |api-indexing| /// Marks are (1,0)-indexed. |api-indexing|
/// ///

View File

@@ -1980,12 +1980,13 @@ Boolean nvim_del_mark(String name, Error *err)
return res; return res;
} }
/// Return a tuple (row, col, buffer, buffername) representing the position of /// Returns a `(row, col, buffer, buffername)` tuple representing the position
/// the uppercase/file named mark. See |mark-motions|. /// of the uppercase/file named mark. "End of line" column position is returned
/// as |v:maxcol| (big number). See |mark-motions|.
/// ///
/// Marks are (1,0)-indexed. |api-indexing| /// Marks are (1,0)-indexed. |api-indexing|
/// ///
/// @note fails with error if a lowercase or buffer local named mark is used. /// @note Lowercase name (or other buffer-local mark) is an error.
/// @param name Mark name /// @param name Mark name
/// @param opts Optional parameters. Reserved for future use. /// @param opts Optional parameters. Reserved for future use.
/// @return 4-tuple (row, col, buffer, buffername), (0, 0, 0, '') if the mark is /// @return 4-tuple (row, col, buffer, buffername), (0, 0, 0, '') if the mark is