spacevim/docs/cn/api.md
JIe 2bb7059579
Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
init
2024-08-21 14:17:26 +08:00

3.3 KiB
Raw Permalink Blame History

title description lang
可用接口 SpaceVim 接口函数库提供了一套开发插件的公共接口,以及 Neovim 和 Vim 的兼容组件。 zh

主页 >> 可用接口

简介

为了兼容不同版本的 Vim避免使用重复的兼容函数SpaceVim 提供了一套兼容的公共 API。开发插件时 可以在你的插件中使用这些公共 API这一思想主要借鉴于 vital.vim

使用方法

可以通过 SpaceVim#api#import() 函数导入相关 API参考以下示例

" 导入 file API并赋值给变量 s:file
let s:file = SpaceVim#api#import('file')
" 导入 system API并赋值给变量 s:system
let s:system = SpaceVim#api#import('system')

" 调用 system API 的 isWindows 成员变量
if s:system.isWindows
    echom "OS is Windows"
endif
echom s:file.separator
echom s:file.pathSeparator

可用 APIs

名称 描述
cmdlinemenu cmdlinemenu 接口函数提供了一套通过命令行进行选择的快捷接口。
data#dict data#dict 接口提供了一些处理字典变量的常用方法,包括基础的增删改查。
data#list data#list 函数库主要提供一些操作列表的常用函数。
data#number data#number 函数库主要提供一些操作数字的常用函数。
data#string data#string 函数库主要提供一些操作字符串的常用函数。
file 文件函数提供了基础的文件读写相关函数,兼容不同系统平台。
job 兼容 neovim 和 vim 的异步协同接口,对于旧版 vim 采用非异步机制
notify notify 接口提供了一个弹出通知消息的接口函数
system system 函数提供了系统相关函数,包括判断当前系统平台,文件格式等函数。
unicode#spinners unicode#spinners API 可启用一个定时器,根据指定的名称定时更新进度条符号
vim#command vim#command 接口提供一些设置和获取 Vim 命令的基础函数。
vim#highlight vim#highlight API 提供一些设置和获取 Vim 高亮信息的基础函数。
vim#message vim#message API 提供一些设置和获取 Vim 提示消息的函数。
vim#signatures vim#signatures API 提供一些设置和获取 Vim 提示消息的函数。