import { fn } from "https://deno.land/x/ddc_vim@v4.1.0/deps.ts";
const { searchpos } = fn;
Same as search()
, but returns a List
with the line and
column position of the match. The first element of the List
is the line number and the second element is the byte index of
the column position of the match. If no match is found,
returns [0, 0].
Example:
:let [lnum, col] = searchpos('mypattern', 'n')
When the 'p' flag is given then there is an extra item with
the sub-pattern match number search()-sub-match
. Example:
:let [lnum, col, submatch] = searchpos('\(\l\)\|\(\u\)', 'np')
In this example "submatch" is 2 when a lowercase letter is
found /\l
, 3 when an uppercase letter is found /\u
.
Can also be used as a method
:
GetPattern()->searchpos()
Parameters
denops: Denops