Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ddc_vim/deps.ts>fn.has

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

Returns 1 if {feature} is supported, 0 otherwise. The {feature} argument is a feature name like "nvim-0.2.1" or "win32", see below. See also exists().

If the code has a syntax error, then Nvim may skip the rest of the line and miss :endif.

if has('feature') | let x = this->breaks->without->the->feature | endif

Put :if and :endif on separate lines to avoid the syntax error.

if has('feature')
  let x = this->breaks->without->the->feature
endif

Vim's compile-time feature-names (prefixed with "+") are not recognized because Nvim is always compiled with all possible features. feature-compile

Feature names can be:

  1. Nvim version. For example the "nvim-0.2.1" feature means that Nvim is version 0.2.1 or later:

    :if has("nvim-0.2.1")
    
  2. Runtime condition or other pseudo-feature. For example the "win32" feature checks if the current system is Windows:

    :if has("win32")
    

    List of supported pseudo-feature names: acl ACL support. bsd BSD system (not macOS, use "mac" for that). clipboard clipboard provider is available. fname_case Case in file names matters (for Darwin and MS-Windows this is not present). iconv Can use iconv() for conversion. linux Linux system. mac MacOS system. nvim This is Nvim. python3 Legacy Vim python3 interface. has-python pythonx Legacy Vim python_x interface. has-pythonx sun SunOS system. ttyin input is a terminal (tty). ttyout output is a terminal (tty). unix Unix system. vim_starting True during startup. win32 Windows system (32 or 64 bit). win64 Windows system (64 bit). wsl WSL (Windows Subsystem for Linux) system.

  3. Vim patch. For example the "patch123" feature means that Vim patch 123 at the current v:version was included:

    :if v:version > 602 || v:version == 602 && has("patch148")
    
  4. Vim version. For example the "patch-7.4.237" feature means that Nvim is Vim-compatible to version 7.4.237 or later.

    :if has("patch-7.4.237")
    

Parameters

denops: Denops
feature: string
optional
check: boolean

Returns

Promise<boolean>