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

x/denops_std/function/mod.ts>getmatches

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

Returns a List with all matches previously defined for the current window by matchadd() and the :match commands. getmatches() is useful in combination with setmatches(), as setmatches() can restore a list of matches saved by getmatches(). If {win} is specified, use the window with this number or window ID instead of the current window. If {win} is invalid, an empty list is returned. Example:

:echo getmatches()

    [{'group': 'MyGroup1', 'pattern': 'TODO',
    'priority': 10, 'id': 1}, {'group': 'MyGroup2',
    'pattern': 'FIXME', 'priority': 10, 'id': 2}]

        :let m = getmatches()
        :call clearmatches()
        :echo getmatches()

    []

        :call setmatches(m)
        :echo getmatches()

    [{'group': 'MyGroup1', 'pattern': 'TODO',
    'priority': 10, 'id': 1}, {'group': 'MyGroup2',
    'pattern': 'FIXME', 'priority': 10, 'id': 2}]

        :unlet m

Parameters

denops: Denops
optional
win: unknown

Returns

Promise<unknown[]>