Skip to main content
Module

x/ddc_vim/deps.ts>fn.matchend

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

Same as match(), but return the index of first character after the match. Example:

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

results in "7".

Vim doesn't have a strspn() or strcspn() function, but you can do it with matchend():

:let span = matchend(line, '[a-zA-Z]')
:let span = matchend(line, '[^a-zA-Z]')

Except that -1 is returned when there are no matches.

The {start}, if given, has the same meaning as for match().

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

results in "7".

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

result is "-1". When {expr} is a List the result is equal to match().

Can also be used as a method:

GetText()->matchend('word')

Parameters

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

Returns

Promise<number>