Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/denops_std/function/vim/mod.ts>prop_add

๐Ÿ“š Standard module for denops.vim
Go to Latest
function prop_add
import { prop_add } from "https://deno.land/x/denops_std@v4.1.4/function/vim/mod.ts";

Attach a text property at position {lnum}, {col}. {col} is counted in bytes, use one for the first column. If {lnum} is invalid an error is given. If {col} is invalid an error is given. {props} is a dictionary with these fields: type name of the text property type length length of text in bytes, can only be used for a property that does not continue in another line; can be zero end_lnum line number for the end of text (inclusive) end_col column just after the text; not used when "length" is present; when {col} and "end_col" are equal, and "end_lnum" is omitted or equal to {lnum}, this is a zero-width text property bufnr buffer to add the property to; when omitted the current buffer is used id user defined ID for the property; must be a number, should be positive; when using "text" then "id" must not be present and will be set automatically to a negative number; otherwise zero is used text text to be displayed before {col}, or after the line if {col} is zero; prepend and/or append spaces for padding with highlighting text_align when "text" is present and {col} is zero; specifies where to display the text: after after the end of the line right right aligned in the window (unless the text wraps to the next screen line) below in the next screen line above just above the line When omitted "after" is used. Only one "right" property can fit in each line, if there are two ore more these will go in a separate line (still right aligned). text_padding_left used when "text" is present and {col} is zero; padding between the end of the text line (leftmost column for "below") and the virtual text, not highlighted text_wrap when "text" is present and {col} is zero, specifies what happens if the text doesn't fit: wrap wrap the text to the next line truncate truncate the text to make it fit When omitted "truncate" is used. All fields except "type" are optional. It is an error when both "length" and "end_lnum" or "end_col" are given. Either use "length" or "end_col" for a property within one line, or use "end_lnum" and "end_col" for a property that spans more than one line. When neither "length" nor "end_col" are given the property will be zero-width. That means it will move with the text, as a kind of mark. One character will be highlighted, if the type specifies highlighting. The property can end exactly at the last character of the text, or just after it. In the last case, if text is appended to the line, the text property size will increase, also when the property type does not have "end_incl" set. "type" will first be looked up in the buffer the property is added to. When not found, the global property types are used. If not found an error is given. When "text" is used and the column is non-zero then this text will be displayed at the start location of the text property after the text. The text of the buffer line will be shifted to make room. This is called "virtual text". When the column is zero the virtual text will appear after the buffer text. The "text_align" and "text_wrap" arguments determine how it is displayed. The text will be displayed but it is not part of the actual buffer line, the cursor cannot be placed on it. A mouse click in the text will move the cursor to the first character after the text, or the last character of the line. Any Tab and other control character in the text will be changed to a space (Rationale: otherwise the size of the text is difficult to compute). A negative "id" will be chosen and is returned. Once a property with "text" has been added for a buffer then using a negative "id" for any other property will give an error: Make sure to use a highlight that makes clear to the user that this is virtual text, otherwise it will be very confusing that the text cannot be edited. To separate the virtual text from the buffer text prepend and/or append spaces to the "text" field. Can also be used as a |method|: GetLnum()->prop_add(col, props)

Parameters

denops: Denops
lnum: unknown
col: unknown
props: unknown

Returns

Promise<unknown>