Skip to main content
Module

x/denops_std/function/mod.ts>searchdecl

📚 Standard module for denops.vim
Go to Latest
function searchdecl
import { searchdecl } from "https://deno.land/x/denops_std@v6.4.0/function/mod.ts";

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()

Parameters

denops: Denops
name: unknown
optional
global: unknown
optional
thisblock: unknown

Returns

Promise<number>