Home Explore Blog CI



neovim

12th chunk of `runtime/doc/api.txt`
d6e9f0d1818d613c7e3bbafae27592dbdd78665fb179bcab0000000100000fc5
 • {name}  Color name or "#rrggbb" string

    Return: ~
        24-bit RGB value, or -1 for invalid argument.

nvim_get_color_map()                                    *nvim_get_color_map()*
    Returns a map of color names and RGB values.

    Keys are color names (e.g. "Aqua") and values are 24-bit RGB color values
    (e.g. 65535).

    Attributes: ~
        Since: 0.1.0

    Return: ~
        Map of color names and RGB values.

nvim_get_context({opts})                                  *nvim_get_context()*
    Gets a map of the current editor state.

    Attributes: ~
        Since: 0.4.0

    Parameters: ~
      • {opts}  Optional parameters.
                • types: List of |context-types| ("regs", "jumps", "bufs",
                  "gvars", …) to gather, or empty for "all".

    Return: ~
        map of global |context|.

nvim_get_current_buf()                                *nvim_get_current_buf()*
    Gets the current buffer.

    Attributes: ~
        Since: 0.1.0

    Return: ~
        Buffer id

nvim_get_current_line()                              *nvim_get_current_line()*
    Gets the current line.

    Attributes: ~
        Since: 0.1.0

    Return: ~
        Current line string

nvim_get_current_tabpage()                        *nvim_get_current_tabpage()*
    Gets the current tabpage.

    Attributes: ~
        Since: 0.1.0

    Return: ~
        |tab-ID|

nvim_get_current_win()                                *nvim_get_current_win()*
    Gets the current window.

    Attributes: ~
        Since: 0.1.0

    Return: ~
        |window-ID|

nvim_get_hl({ns_id}, {opts})                                   *nvim_get_hl()*
    Gets all or specific highlight groups in a namespace.

    Note: ~
      • When the `link` attribute is defined in the highlight definition map,
        other attributes will not be taking effect (see |:hi-link|).

    Attributes: ~
        Since: 0.9.0

    Parameters: ~
      • {ns_id}  Get highlight groups for namespace ns_id
                 |nvim_get_namespaces()|. Use 0 to get global highlight groups
                 |:highlight|.
      • {opts}   Options dict:
                 • name: (string) Get a highlight definition by name.
                 • id: (integer) Get a highlight definition by id.
                 • link: (boolean, default true) Show linked group name
                   instead of effective definition |:hi-link|.
                 • create: (boolean, default true) When highlight group
                   doesn't exist create it.

    Return: ~
        Highlight groups as a map from group name to a highlight definition
        map as in |nvim_set_hl()|, or only a single highlight definition map
        if requested by name or id.

nvim_get_hl_id_by_name({name})                      *nvim_get_hl_id_by_name()*
    Gets a highlight group by name

    similar to |hlID()|, but allocates a new ID if not present.

    Attributes: ~
        Since: 0.5.0

nvim_get_hl_ns({opts})                                      *nvim_get_hl_ns()*
    Gets the active highlight namespace.

    Attributes: ~
        Since: 0.10.0

    Parameters: ~
      • {opts}  Optional parameters
                • winid: (number) |window-ID| for retrieving a window's
                  highlight namespace. A value of -1 is returned when
                  |nvim_win_set_hl_ns()| has not been called for the window
                  (or was called with a namespace of -1).

    Return: ~
        Namespace id, or -1

nvim_get_keymap({mode})                                    *nvim_get_keymap()*
    Gets a list of global (non-buffer-local) |mapping| definitions.

    Attributes: ~
        Since: 0.2.1

    Parameters: ~
      • {mode}  Mode short-name ("n", "i", "v", ...)

    Return: ~
        Array of |maparg()|-like dictionaries describing mappings. The
        "buffer" key is always zero.

nvim_get_mark({name}, {opts})                                *nvim_get_mark()*
    Returns a `(row, col, buffer, buffername)` tuple representing

Title: Nvim API: Global Functions - Colors, Context, Buffer, Line, Tabpage, Window, Highlighting, Keymaps, and Marks
Summary
This section details global functions in the Nvim API for managing editor state. It covers getting color information (`nvim_get_color_by_name()`, `nvim_get_color_map()`), context (`nvim_get_context()`), the current buffer and line (`nvim_get_current_buf()`, `nvim_get_current_line()`), current tabpage and window (`nvim_get_current_tabpage()`, `nvim_get_current_win()`), highlighting (`nvim_get_hl()`, `nvim_get_hl_id_by_name()`, `nvim_get_hl_ns()`), keymaps (`nvim_get_keymap()`), and marks (`nvim_get_mark()`).