Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/denops_std/function/nvim/mod.ts>nvim_buf_set_extmark

📚 Standard module for denops.vim
Go to Latest
function nvim_buf_set_extmark
import { nvim_buf_set_extmark } from "https://deno.land/x/denops_std@v4.1.4/function/nvim/mod.ts";

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 an existing mark by passing in its id. The caller must then keep track of existing and unused ids itself. (Useful over RPC, to avoid waiting for the return value.) Using the optional arguments, it is possible to use this to highlight a range of text, and also to associate virtual text to the mark. Parameters: ~ {buffer} Buffer handle, or 0 for current buffer {ns_id} Namespace id from |nvim_create_namespace()| {line} Line where to place the mark, 0-based. |api-indexing| {col} Column where to place the mark, 0-based. |api-indexing| {opts} Optional parameters. • id : id of the extmark to edit. • end_row : ending line of the mark, 0-based inclusive. • end_col : ending col of the mark, 0-based exclusive. • hl_group : name of the highlight group used to highlight this mark. • hl_eol : when true, for a multiline highlight covering the EOL of a line, continue the highlight for the rest of the screen line (just like for diff and cursorline highlight). • virt_text : virtual text to link to this mark. A list of [text, highlight] tuples, each representing a text chunk with specified highlight. highlight element can either be a single highlight group, or an array of multiple highlight groups that will be stacked (highest priority last). A highlight group can be supplied either as a string or as an integer, the latter which can be obtained using |nvim_get_hl_id_by_name()|. • virt_text_pos : position of virtual text. Possible values: • "eol": right after eol character (default) • "overlay": display over the specified column, without shifting the underlying text. • "right_align": display right aligned in the window. • virt_text_win_col : position the virtual text at a fixed window column (starting from the first text column) • virt_text_hide : hide the virtual text when the background text is selected or hidden due to horizontal scroll 'nowrap' • hl_mode : control how highlights are combined with the highlights of the text. Currently only affects virt_text highlights, but might affect hl_group in later versions. • "replace": only show the virt_text color. This is the default • "combine": combine with background text color • "blend": blend with background text color. • virt_lines : virtual lines to add next to this mark This should be an array over lines, where each line in turn is an array over [text, highlight] tuples. In general, buffer and window options do not affect the display of the text. In particular 'wrap' and 'linebreak' options do not take effect, so the number of extra screen lines will always match the size of the array. However the 'tabstop' buffer option is still used for hard tabs. By default lines are placed below the buffer line containing the mark. • virt_lines_above: place virtual lines above instead. • virt_lines_leftcol: Place extmarks in the leftmost column of the window, bypassing sign and number columns. • ephemeral : for use with |nvim_set_decoration_provider()| callbacks. The mark will only be used for the current redraw cycle, and not be permantently stored in the buffer. • right_gravity : boolean that indicates the direction the extmark will be shifted in when new text is inserted (true for right, false for left). defaults to true. • end_right_gravity : boolean that indicates the direction the extmark end position (if it exists) will be shifted in when new text is inserted (true for right, false for left). Defaults to false. • priority: a priority value for the highlight group or sign attribute. For example treesitter highlighting uses a value of 100. • strict: boolean that indicates extmark should not be placed if the line or column value is past the end of the buffer or end of the line respectively. Defaults to true. • sign_text: string of length 1-2 used to display in the sign column. Note: ranges are unsupported and decorations are only applied to start_row • sign_hl_group: name of the highlight group used to highlight the sign column text. Note: ranges are unsupported and decorations are only applied to start_row • number_hl_group: name of the highlight group used to highlight the number column. Note: ranges are unsupported and decorations are only applied to start_row • line_hl_group: name of the highlight group used to highlight the whole line. Note: ranges are unsupported and decorations are only applied to start_row • cursorline_hl_group: name of the highlight group used to highlight the line when the cursor is on the same line as the mark and 'cursorline' is enabled. Note: ranges are unsupported and decorations are only applied to start_row • conceal: string which should be either empty or a single character. Enable concealing similar to |:syn-conceal|. When a character is supplied it is used as |:syn-cchar|. "hl_group" is used as highlight for the cchar if provided, otherwise it defaults to |hl-Conceal|. • spell: boolean indicating that spell checking should be performed within this extmark • ui_watched: boolean that indicates the mark should be drawn by a UI. When set, the UI will receive win_extmark events. Note: the mark is positioned by virt_text attributes. Can be used together with virt_text. Return: ~ Id of the created/updated extmark

Parameters

denops: Denops
buffer: unknown
ns_id: unknown
line: unknown
col: unknown
opts: unknown

Returns

Promise<unknown>