Skip to main content
Module

x/denops_std/function/mod.ts>getcompletion

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

Return a list of command-line completion matches. The String {type} argument specifies what for. The following completion types are supported:

arglist file names in argument list augroup autocmd groups buffer buffer names behave :behave suboptions breakpoint :breakadd and :breakdel suboptions color color schemes command Ex command cmdline cmdline-completion result compiler compilers cscope :cscope suboptions custom,{func} custom completion, defined via {func} customlist,{func} custom completion, defined via {func} diff_buffer :diffget and :diffput completion dir directory names environment environment variable names event autocommand events expression Vim expression file file and directory names file_in_path file and directory names in 'path' filetype filetype names 'filetype' function function name help help subjects highlight highlight groups history :history suboptions locale locale names (as output of locale -a) mapclear buffer argument mapping mapping name menu menus messages :messages suboptions option options packadd optional package pack-add names runtime :runtime completion scriptnames sourced script names :scriptnames shellcmd Shell command sign :sign suboptions syntax syntax file names 'syntax' syntime :syntime suboptions tag tags tag_listfiles tags, file names user user names var user variables

If {pat} is an empty string, then all the matches are returned. Otherwise only items matching {pat} are returned. See wildcards for the use of special characters in {pat}.

If the optional {filtered} flag is set to 1, then 'wildignore' is applied to filter the results. Otherwise all the matches are returned. The 'wildignorecase' option always applies.

If the 'wildoptions' option contains 'fuzzy', then fuzzy matching is used to get the completion matches. Otherwise regular expression matching is used. Thus this function follows the user preference, what happens on the command line. If you do not want this you can make 'wildoptions' empty before calling getcompletion() and restore it afterwards.

If {type} is "cmdline", then the cmdline-completion result is returned. For example, to complete the possible values after a ":call" command:

echo getcompletion('call ', 'cmdline')

If there are no matches, an empty list is returned. An invalid value for {type} produces an error.

Can also be used as a method:

GetPattern()->getcompletion('color')

Parameters

denops: Denops
pat: unknown
type: unknown
optional
filtered: unknown

Returns

Promise<unknown[]>