1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-13 02:05:40 +08:00

Add doc for spacevim-api

This commit is contained in:
wsdjeg 2017-03-11 20:43:42 +08:00
parent de462512db
commit 816e319cf7
4 changed files with 46 additions and 2 deletions

View File

@ -10,7 +10,7 @@
" @section Introduction, intro
" @stylized spacevim
" @library
" @order intro version dicts functions exceptions layers faq
" @order intro version dicts functions exceptions layers api faq
" SpaceVim is a bundle of custom settings and plugins with a modular
" configuration for Vim. It was inspired by Spacemacs.
"

View File

@ -1,3 +1,14 @@
""
" @section API, api
" SpaceVim contains a variety of public apis. here is a list of all the apis.
" @subsection usage
" This is just an example, and it works well in old version vim.
" >
" let s:json = SpaceVim#api#import('data#json')
" let rst = s:json.json_encode(onject)
" let rst = s:json.json_decode(string)
" <
function! SpaceVim#api#import(name) abort
let p = {}
try

View File

@ -38,6 +38,16 @@ function! s:parseItems(items) abort
endfunction
" items should be a list of [name, funcrc or string]
""
" @section cmdlinemenu, api-cmdlinemenu
" @parentsection api
" menu({items})
"
" Create a cmdline selection menu from a list of {items}, each item should be a
" list of two value in it, first one is the description, and the next one
" should be a funcrc.
function! s:menu(items) abort
let saved_more = &more
set nomore

View File

@ -42,7 +42,9 @@ CONTENTS *SpaceVim-contents*
19. operator...................................|SpaceVim-layer-operator|
20. shell.........................................|SpaceVim-layer-shell|
21. tmux...........................................|SpaceVim-layer-tmux|
6. FAQ........................................................|SpaceVim-faq|
6. API........................................................|SpaceVim-api|
1. cmdlinemenu................................|SpaceVim-api-cmdlinemenu|
7. FAQ........................................................|SpaceVim-faq|
==============================================================================
INTRODUCTION *SpaceVim-intro*
@ -782,6 +784,27 @@ MAPPINGS
<C-l> normal Switch to vim/tmux pane in right direction
<
==============================================================================
API *SpaceVim-api*
SpaceVim contains a variety of public apis. here is a list of all the apis.
USAGE
This is just an example, and it works well in old version vim.
>
let s:json = SpaceVim#api#import('data#json')
let rst = s:json.json_encode(onject)
let rst = s:json.json_decode(string)
<
==============================================================================
CMDLINEMENU *SpaceVim-api-cmdlinemenu*
menu({items})
Create a cmdline selection menu from a list of {items}, each item should be a
list of two value in it, first one is the description, and the next one should
be a funcrc.
==============================================================================
FAQ *SpaceVim-faq*