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:
-
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")
-
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). clipboardclipboard
provider is available. fname_case Case in file names matters (for Darwin and MS-Windows this is not present). iconv Can useiconv()
for conversion. linux Linux system. mac MacOS system. nvim This is Nvim. python3 Legacy Vimpython3
interface.has-python
pythonx Legacy Vimpython_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 duringstartup
. win32 Windows system (32 or 64 bit). win64 Windows system (64 bit). wsl WSL (Windows Subsystem for Linux) system. -
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")
-
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")