import { fn } from "https://deno.land/x/ddc_vim@v3.8.0/deps.ts";
const { searchdecl } = fn;
Search for the declaration of {name}.
With a non-zero {global} argument it works like gD
, find
first match in the file. Otherwise it works like gd
, find
first match in the function.
With a non-zero {thisblock} argument matches in a {} block that ends before the cursor position are ignored. Avoids finding variable declarations only valid in another scope.
Moves the cursor to the found match. Returns zero for success, non-zero for failure. Example:
if searchdecl('myvar') == 0
echo getline('.')
endif
Can also be used as a method
:
GetName()->searchdecl()