Home Explore Blog CI



neovim

20th chunk of `runtime/doc/api.txt`
67b652606d5419ed0320dd4c21be825990e10e190b7f5d4f0000000100000fe6
 name or "#RRGGBB", see note.
                 • sp: color name or "#RRGGBB"
                 • blend: integer between 0 and 100
                 • bold: boolean
                 • standout: boolean
                 • underline: boolean
                 • undercurl: boolean
                 • underdouble: boolean
                 • underdotted: boolean
                 • underdashed: boolean
                 • strikethrough: boolean
                 • italic: boolean
                 • reverse: boolean
                 • nocombine: boolean
                 • link: name of another highlight group to link to, see
                   |:hi-link|.
                 • default: Don't override existing definition |:hi-default|
                 • ctermfg: Sets foreground of cterm color |ctermfg|
                 • ctermbg: Sets background of cterm color |ctermbg|
                 • cterm: cterm attribute map, like |highlight-args|. If not
                   set, cterm attributes will match those from the attribute
                   map documented above.
                 • force: if true force update the highlight group when it
                   exists.

nvim_set_hl_ns({ns_id})                                     *nvim_set_hl_ns()*
    Set active namespace for highlights defined with |nvim_set_hl()|. This can
    be set for a single window, see |nvim_win_set_hl_ns()|.

    Attributes: ~
        Since: 0.8.0

    Parameters: ~
      • {ns_id}  the namespace to use

nvim_set_hl_ns_fast({ns_id})                           *nvim_set_hl_ns_fast()*
    Set active namespace for highlights defined with |nvim_set_hl()| while
    redrawing.

    This function meant to be called while redrawing, primarily from
    |nvim_set_decoration_provider()| on_win and on_line callbacks, which are
    allowed to change the namespace during a redraw cycle.

    Attributes: ~
        |api-fast|
        Since: 0.8.0

    Parameters: ~
      • {ns_id}  the namespace to activate

nvim_set_keymap({mode}, {lhs}, {rhs}, {opts})              *nvim_set_keymap()*
    Sets a global |mapping| for the given mode.

    To set a buffer-local mapping, use |nvim_buf_set_keymap()|.

    Unlike |:map|, leading/trailing whitespace is accepted as part of the
    {lhs} or {rhs}. Empty {rhs} is <Nop>. |keycodes| are replaced as usual.

    Example: >vim
        call nvim_set_keymap('n', ' <NL>', '', {'nowait': v:true})
<

    is equivalent to: >vim
        nmap <nowait> <Space><NL> <Nop>
<

    Attributes: ~
        Since: 0.4.0

    Parameters: ~
      • {mode}  Mode short-name (map command prefix: "n", "i", "v", "x", …)
                or "!" for |:map!|, or empty string for |:map|. "ia", "ca" or
                "!a" for abbreviation in Insert mode, Cmdline mode, or both,
                respectively
      • {lhs}   Left-hand-side |{lhs}| of the mapping.
      • {rhs}   Right-hand-side |{rhs}| of the mapping.
      • {opts}  Optional parameters map: Accepts all |:map-arguments| as keys
                except <buffer>, values are booleans (default false). Also:
                • "noremap" disables |recursive_mapping|, like |:noremap|
                • "desc" human-readable description.
                • "callback" Lua function called in place of {rhs}.
                • "replace_keycodes" (boolean) When "expr" is true, replace
                  keycodes in the resulting string (see
                  |nvim_replace_termcodes()|). Returning nil from the Lua
                  "callback" is equivalent to returning an empty string.

nvim_set_var({name}, {value})                                 *nvim_set_var()*
    Sets a global (g:) variable.

    Attributes: ~
        Since: 0.1.0

    Parameters: ~
      • {name}   Variable name
      • {value}  Variable value

nvim_set_vvar({name}, {value})                               *nvim_set_vvar()*
    Sets a v: variable, if it is not readonly.

    Attributes: ~
        Since: 0.4.0

    Parameters: ~
      • {name}   Variable name
      • {value}

Title: Nvim API: Highlight Namespaces, Keymaps, and Variables
Summary
This section of the Nvim API documentation covers setting highlight namespaces (`nvim_set_hl_ns()` and `nvim_set_hl_ns_fast()`), setting keymaps (`nvim_set_keymap()`), and setting global and v: variables (`nvim_set_var()` and `nvim_set_vvar()`). It details the parameters for each function, including mode, left-hand side (LHS), right-hand side (RHS), and options for keymaps, and variable names and values for setting variables.