docs(api): improve section on nvim_set_hl (#17692)

This commit is contained in:
adrian5 2022-03-13 13:42:12 +01:00 committed by GitHub
parent c9b94188d5
commit 9e6bc228ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 31 deletions

View File

@ -1544,23 +1544,21 @@ nvim_set_current_win({window}) *nvim_set_current_win()*
{window} Window handle {window} Window handle
nvim_set_hl({ns_id}, {name}, {*val}) *nvim_set_hl()* nvim_set_hl({ns_id}, {name}, {*val}) *nvim_set_hl()*
Set a highlight group. Sets a highlight group.
Parameters: ~ Parameters: ~
{ns_id} number of namespace for this highlight. Use value {ns_id} Namespace id for this highlight |nvim_create_namespace()|.
0 to set a highlight group in the global ( Use 0 to set a highlight group globally |:highlight|.
`:highlight` ) namespace. {name} Highlight group name, e.g. "ErrorMsg"
{name} highlight group name, like ErrorMsg {val} Highlight definition map, like |synIDattr()|. In
{val} highlight definition map, like addition, the following keys are recognized:
|nvim_get_hl_by_name|. in addition the following • default: Don't override existing definition |:hi-default|
keys are also recognized: `default` : don't • ctermfg: Sets foreground of cterm color |highlight-ctermfg|
override existing definition, like `hi default` • ctermbg: Sets background of cterm color |highlight-ctermbg|
`ctermfg` : sets foreground of cterm color • cterm: cterm attribute map, like
`ctermbg` : sets background of cterm color |highlight-args|.
`cterm` : cterm attribute map. sets attributed Note: Attributes default to those set for `gui`
for cterm colors. similer to `hi cterm` Note: by if not set.
default cterm attributes are same as attributes
of gui color
nvim_set_keymap({mode}, {lhs}, {rhs}, {*opts}) *nvim_set_keymap()* nvim_set_keymap({mode}, {lhs}, {rhs}, {*opts}) *nvim_set_keymap()*
Sets a global |mapping| for the given mode. Sets a global |mapping| for the given mode.

View File

@ -123,26 +123,24 @@ Dictionary nvim__get_hl_defs(Integer ns_id, Error *err)
abort(); abort();
} }
/// Set a highlight group. /// Sets a highlight group.
/// ///
/// Note: unlike the `:highlight` command which can update a highlight group, /// Note: Unlike the `:highlight` command which can update a highlight group,
/// this function completely replaces the definition. For example: /// this function completely replaces the definition. For example:
/// `nvim_set_hl(0, 'Visual', {})` will clear the highlight group 'Visual'. /// `nvim_set_hl(0, 'Visual', {})` will clear the highlight group 'Visual'.
/// ///
/// @param ns_id number of namespace for this highlight. Use value 0 /// @param ns_id Namespace id for this highlight |nvim_create_namespace()|.
/// to set a highlight group in the global (`:highlight`) /// Use 0 to set a highlight group globally |:highlight|.
/// namespace. /// @param name Highlight group name, e.g. "ErrorMsg"
/// @param name highlight group name, like ErrorMsg /// @param val Highlight definition map, like |synIDattr()|. In
/// @param val highlight definition map, like |nvim_get_hl_by_name|. /// addition, the following keys are recognized:
/// in addition the following keys are also recognized: /// - default: Don't override existing definition |:hi-default|
/// `default`: don't override existing definition, /// - ctermfg: Sets foreground of cterm color |highlight-ctermfg|
/// like `hi default` /// - ctermbg: Sets background of cterm color |highlight-ctermbg|
/// `ctermfg`: sets foreground of cterm color /// - cterm: cterm attribute map, like
/// `ctermbg`: sets background of cterm color /// |highlight-args|.
/// `cterm` : cterm attribute map. sets attributed for /// Note: Attributes default to those set for `gui`
/// cterm colors. similer to `hi cterm` /// if not set.
/// Note: by default cterm attributes are
/// same as attributes of gui color
/// @param[out] err Error details, if any /// @param[out] err Error details, if any
/// ///
// TODO(bfredl): val should take update vs reset flag // TODO(bfredl): val should take update vs reset flag