Skip to main content
Module

x/ddc_vim/deps.ts>fn.matchaddpos

Dark deno-powered completion framework for neovim/Vim8
Go to Latest
function fn.matchaddpos
import { fn } from "https://deno.land/x/ddc_vim@v2.3.0/deps.ts";
const { matchaddpos } = fn;

Same as |matchadd()|, but requires a list of positions {pos} instead of a pattern. This command is faster than |matchadd()| because it does not require to handle regular expressions and sets buffer line boundaries to redraw screen. It is supposed to be used when fast match additions and deletions are required, for example to highlight matching parentheses. {pos} is a list of positions. Each position can be one of these:

  • A number. This whole line will be highlighted. The first line has number 1.
  • A list with one number, e.g., [23]. The whole line with this number will be highlighted.
  • A list with two numbers, e.g., [23, 11]. The first number is the line number, the second one is the column number (first column is 1, the value must correspond to the byte index as |col()| would return). The character at this position will be highlighted.
  • A list with three numbers, e.g., [23, 11, 3]. As above, but the third number gives the length of the highlight in bytes. The maximum number of positions in {pos} is 8. Example: :highlight MyGroup ctermbg=green guibg=green :let m = matchaddpos("MyGroup", [[23, 24], 34]) Deletion of the pattern: :call matchdelete(m) Matches added by |matchaddpos()| are returned by |getmatches()|. Can also be used as a |method|: GetGroup()->matchaddpos([23, 11])

Parameters

denops: Denops
group: unknown
pos: unknown
optional
priority: unknown
optional
id: unknown
optional
dict: unknown

Returns

Promise<unknown>