Skip to main content
Module

x/ddc_vim/deps.ts>fn.matchstrpos

Dark deno-powered completion framework for neovim/Vim
Latest
function fn.matchstrpos
import { fn } from "https://deno.land/x/ddc_vim@v4.3.1/deps.ts";
const { matchstrpos } = fn;

Same as matchstr(), but return the matched string, the start position and the end position of the match. Example:

:echo matchstrpos("testing", "ing")

results in ["ing", 4, 7]. When there is no match ["", -1, -1] is returned. The {start}, if given, has the same meaning as for match().

:echo matchstrpos("testing", "ing", 2)

results in ["ing", 4, 7].

:echo matchstrpos("testing", "ing", 5)

result is ["", -1, -1]. When {expr} is a List then the matching item, the index of first item where {pat} matches, the start position and the end position of the match are returned.

:echo matchstrpos([1, '__x'], '\a')

result is ["x", 1, 2, 3]. The type isn't changed, it's not necessarily a String.

Can also be used as a method:

GetText()->matchstrpos('word')

Parameters

denops: Denops
expr: unknown
pat: unknown
optional
start: unknown
optional
count: unknown

Returns

Promise<unknown[]>