Skip to content

Commit

Permalink
docs: add links to extmarks and namespaces (neovim#21378)
Browse files Browse the repository at this point in the history
Co-authored-by: ii14 <ii14@users.noreply.github.com>
  • Loading branch information
2 people authored and Nero-F committed Dec 16, 2022
1 parent 988eab4 commit e76438f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions runtime/doc/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ Example: create a float with scratch buffer: >vim
<

==============================================================================
Extended marks *api-extended-marks* *extmarks*
Extended marks *api-extended-marks* *extmarks* *extmark*

Extended marks (extmarks) represent buffer annotations that track text changes
in the buffer. They can represent cursors, folds, misspelled words, anything
Expand Down Expand Up @@ -2485,7 +2485,7 @@ nvim_buf_add_highlight({buffer}, {ns_id}, {hl_group}, {line}, {col_start},

*nvim_buf_clear_namespace()*
nvim_buf_clear_namespace({buffer}, {ns_id}, {line_start}, {line_end})
Clears namespaced objects (highlights, extmarks, virtual text) from a
Clears |namespace|d objects (highlights, |extmarks|, virtual text) from a
region.

Lines are 0-indexed. |api-indexing| To clear the namespace in the entire
Expand All @@ -2499,7 +2499,7 @@ nvim_buf_clear_namespace({buffer}, {ns_id}, {line_start}, {line_end})
clear to end of buffer.

nvim_buf_del_extmark({buffer}, {ns_id}, {id}) *nvim_buf_del_extmark()*
Removes an extmark.
Removes an |extmark|.

Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
Expand All @@ -2511,7 +2511,7 @@ nvim_buf_del_extmark({buffer}, {ns_id}, {id}) *nvim_buf_del_extmark()*

*nvim_buf_get_extmark_by_id()*
nvim_buf_get_extmark_by_id({buffer}, {ns_id}, {id}, {opts})
Gets the position (0-indexed) of an extmark.
Gets the position (0-indexed) of an |extmark|.

Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
Expand All @@ -2525,7 +2525,7 @@ nvim_buf_get_extmark_by_id({buffer}, {ns_id}, {id}, {opts})

*nvim_buf_get_extmarks()*
nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})
Gets extmarks in "traversal order" from a |charwise| region defined by
Gets |extmarks| in "traversal order" from a |charwise| region defined by
buffer positions (inclusive, 0-indexed |api-indexing|).

Region can be given as (row,col) tuples, or valid extmark ids (whose
Expand Down Expand Up @@ -2570,7 +2570,7 @@ nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})

*nvim_buf_set_extmark()*
nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
Creates or updates an extmark.
Creates or updates an |extmark|.

By default a new extmark is created when no id is passed in, but it is
also possible to create a new mark by passing in a previously unused id or
Expand Down Expand Up @@ -2699,19 +2699,19 @@ nvim_create_namespace({name}) *nvim_create_namespace()*
Namespace id

nvim_get_namespaces() *nvim_get_namespaces()*
Gets existing, non-anonymous namespaces.
Gets existing, non-anonymous |namespace|s.

Return: ~
dict that maps from names to namespace ids.

*nvim_set_decoration_provider()*
nvim_set_decoration_provider({ns_id}, {*opts})
Set or change decoration provider for a namespace
Set or change decoration provider for a |namespace|

This is a very general purpose interface for having lua callbacks being
triggered during the redraw code.

The expected usage is to set extmarks for the currently redrawn buffer.
The expected usage is to set |extmarks| for the currently redrawn buffer.
|nvim_buf_set_extmark()| can be called to add marks on a per-window or
per-lines basis. Use the `ephemeral` key to only use the mark for the
current screen redraw (the callback will be called again for the next
Expand Down
18 changes: 9 additions & 9 deletions src/nvim/api/extmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Integer nvim_create_namespace(String name)
return (Integer)id;
}

/// Gets existing, non-anonymous namespaces.
/// Gets existing, non-anonymous |namespace|s.
///
/// @return dict that maps from names to namespace ids.
Dictionary nvim_get_namespaces(void)
Expand Down Expand Up @@ -195,7 +195,7 @@ static Array extmark_to_array(const ExtmarkInfo *extmark, bool id, bool add_dict
return rv;
}

/// Gets the position (0-indexed) of an extmark.
/// Gets the position (0-indexed) of an |extmark|.
///
/// @param buffer Buffer handle, or 0 for current buffer
/// @param ns_id Namespace id from |nvim_create_namespace()|
Expand Down Expand Up @@ -249,7 +249,7 @@ ArrayOf(Integer) nvim_buf_get_extmark_by_id(Buffer buffer, Integer ns_id,
return extmark_to_array(&extmark, false, details);
}

/// Gets extmarks in "traversal order" from a |charwise| region defined by
/// Gets |extmarks| in "traversal order" from a |charwise| region defined by
/// buffer positions (inclusive, 0-indexed |api-indexing|).
///
/// Region can be given as (row,col) tuples, or valid extmark ids (whose
Expand Down Expand Up @@ -368,7 +368,7 @@ Array nvim_buf_get_extmarks(Buffer buffer, Integer ns_id, Object start, Object e
return rv;
}

/// Creates or updates an extmark.
/// Creates or updates an |extmark|.
///
/// By default a new extmark is created when no id is passed in, but it is also
/// possible to create a new mark by passing in a previously unused id or move
Expand Down Expand Up @@ -814,7 +814,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
return 0;
}

/// Removes an extmark.
/// Removes an |extmark|.
///
/// @param buffer Buffer handle, or 0 for current buffer
/// @param ns_id Namespace id from |nvim_create_namespace()|
Expand Down Expand Up @@ -929,7 +929,7 @@ Integer nvim_buf_add_highlight(Buffer buffer, Integer ns_id, String hl_group, In
return ns_id;
}

/// Clears namespaced objects (highlights, extmarks, virtual text) from
/// Clears |namespace|d objects (highlights, |extmarks|, virtual text) from
/// a region.
///
/// Lines are 0-indexed. |api-indexing| To clear the namespace in the entire
Expand Down Expand Up @@ -962,12 +962,12 @@ void nvim_buf_clear_namespace(Buffer buffer, Integer ns_id, Integer line_start,
(int)line_end - 1, MAXCOL);
}

/// Set or change decoration provider for a namespace
/// Set or change decoration provider for a |namespace|
///
/// This is a very general purpose interface for having lua callbacks
/// being triggered during the redraw code.
///
/// The expected usage is to set extmarks for the currently
/// The expected usage is to set |extmarks| for the currently
/// redrawn buffer. |nvim_buf_set_extmark()| can be called to add marks
/// on a per-window or per-lines basis. Use the `ephemeral` key to only
/// use the mark for the current screen redraw (the callback will be called
Expand Down Expand Up @@ -1051,7 +1051,7 @@ void nvim_set_decoration_provider(Integer ns_id, Dict(set_decoration_provider) *
decor_provider_clear(p);
}

/// Gets the line and column of an extmark.
/// Gets the line and column of an |extmark|.
///
/// Extmarks may be queried by position, name or even special names
/// in the future such as "cursor".
Expand Down

0 comments on commit e76438f

Please sign in to comment.
  NODES
COMMUNITY 1
Note 1
Project 3
USERS 2