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

x/ddc_vim/deps.ts>fn.hasmapto

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

The result is a Number, which is TRUE if there is a mapping that contains {what} in somewhere in the rhs (what it is mapped to) and this mapping exists in one of the modes indicated by {mode}. The arguments {what} and {mode} are strings. When {abbr} is there and it is TRUE use abbreviations instead of mappings. Don't forget to specify Insert and/or Command-line mode. Both the global mappings and the mappings local to the current buffer are checked for a match. If no matching mapping is found FALSE is returned. The following characters are recognized in {mode}: n Normal mode v Visual and Select mode x Visual mode s Select mode o Operator-pending mode i Insert mode l Language-Argument ("r", "f", "t", etc.) c Command-line mode When {mode} is omitted, "nvo" is used.

This function is useful to check if a mapping already exists to a function in a Vim script. Example:

:if !hasmapto('\ABCdoit')
:   map <Leader>d \ABCdoit
:endif

This installs the mapping to "\ABCdoit" only if there isn't already a mapping to "\ABCdoit".

Can also be used as a method:

GetRHS()->hasmapto()

Parameters

denops: Denops
what: unknown
optional
mode: unknown
optional
abbr: unknown

Returns

Promise<number>