mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-13 12:49:10 +08:00
Add doc for notify api (#4357)
This commit is contained in:
parent
2d6bfd39a9
commit
dd46a88bd0
@ -61,7 +61,7 @@ endfunction
|
||||
|
||||
function! s:self.increase_window(...) abort
|
||||
" let self.notification_width = self.__floating.get_width(self.winid)
|
||||
if self.notification_width <= &columns * 0.3
|
||||
if self.notification_width <= &columns * 0.3 && self.win_is_open
|
||||
let self.notification_width += min([float2nr((&columns * 0.3 - self.notification_width) * 1 / 10), float2nr(&columns * 0.3)])
|
||||
call self.__buffer.buf_set_lines(self.border.bufnr, 0 , -1, 0,
|
||||
\ self.draw_border(self.title, self.notification_width, len(self.message)))
|
||||
|
55
docs/api.md
55
docs/api.md
@ -38,31 +38,34 @@ echom s:file.pathSeparator
|
||||
|
||||
Here is the list of all available APIs, and welcome to contribute to SpaceVim.
|
||||
|
||||
| Name | Description |
|
||||
| ------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
||||
| [cmdlinemenu](cmdlinemenu/) | cmdlinemenu API provides an interface for making choices in a command line. |
|
||||
| [data#base64](data/base64/) | data#base64 API provides base64 encoding and decoding functions |
|
||||
| [data#dict](data/dict/) | data#dict API provides some basic functions and values for dict. |
|
||||
| [data#list](data/list/) | data#list API provides some basic functions and values for list. |
|
||||
| [data#number](data/number/) | data#number API provides some basic functions for number generation. |
|
||||
| [data#string](data/string/) | data#string API provides some basic functions and values for string. |
|
||||
| [data#toml](data/toml/) | data#toml API provides some basic functions and values for toml. |
|
||||
| [file](file/) | file API provides some basic functions and values for interacting with the OS. |
|
||||
| [job](job/) | job API provides some basic functions for running a jobs |
|
||||
| [logger](logger/) | logger API provides some basic functions for logging messages when creating plugins |
|
||||
| [messletters](messletters/) | messletters API provides some basic functions for generating messletters |
|
||||
| [password](password/) | password API provides some basic functions for generating passwords |
|
||||
| [system](system/) | system API provides some basic functions and values for interacting with the OS. |
|
||||
| [transient-state](transient-state/) | transient state API provides some basic functions and values for interacting with the OS. |
|
||||
| [unicode#spinners](unicode/spinners/) | unicode#spinners API provides some basic functions for starting spinners timer |
|
||||
| [vim#buffer](vim/buffer/) | vim#buffer API provides some basic functions for setting and getting the configurations of vim buffers. |
|
||||
| [vim#command](vim/command/) | vim#command API provides some basic functions and values for creatting vim custom commands. |
|
||||
| [vim#highlight](vim/highlight/) | vim#highlight API provides some basic functions and values for getting and setting highlighting info. |
|
||||
| [vim#signatures](vim/signatures/) | vim#signatures API provides some basic functions for showing signatures info. |
|
||||
| [vim#window](vim/window/) | vim#window API provides some basic functions for setting and getting the configurations of vim windows. |
|
||||
| [vim](vim/) | vim API provides general vim functions. |
|
||||
| [web#html](web/html/) | web#html API provides some basic functions and values for parsing HTML files. |
|
||||
| [web#http](web/http/) | web#http API provides some basic functions and values for HTTP requests |
|
||||
| [web#xml](web/xml/) | web#xml API provides some basic functions and values for parsing XML files. |
|
||||
| Name | Description |
|
||||
| ------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
||||
| [cmdlinemenu](cmdlinemenu/) | cmdlinemenu API provides interface for making choices in a command line. |
|
||||
| [data#base64](data/base64/) | data#base64 API provides base64 encode and decode functions |
|
||||
| [data#dict](data/dict/) | data#dict API provides some basic functions and values for dict. |
|
||||
| [data#list](data/list/) | data#list API provides some basic functions and values for list. |
|
||||
| [data#number](data/number/) | data#number API provides some basic functions to generate number. |
|
||||
| [data#string](data/string/) | data#string API provides some basic functions and values for string. |
|
||||
| [data#toml](data/toml/) | data#toml API provides some basic functions and values for toml. |
|
||||
| [file](file/) | file API provides some basic functions and values for current os. |
|
||||
| [job](job/) | job API provides some basic functions for running a job |
|
||||
| [logger](logger/) | logger API provides some basic functions for log message when create plugins |
|
||||
| [messletters](messletters/) | messletters API provides some basic functions for generating messletters |
|
||||
| [notify](notify/) | notify API provides some basic functions for generating notifications |
|
||||
| [password](password/) | password API provides some basic functions for generating password |
|
||||
| [system](system/) | system API provides some basic functions and values for current os. |
|
||||
| [transient-state](transient-state/) | transient state API provides some basic functions and values for current os. |
|
||||
| [unicode#box](unicode/box/) | unicode#box API provides some basic functions for drawing box. |
|
||||
| [unicode#spinners](unicode/spinners/) | unicode#spinners API provides some basic functions for starting spinners timer |
|
||||
| [vim#buffer](vim/buffer/) | vim#buffer API provides some basic functions for setting and getting config of vim buffer. |
|
||||
| [vim#command](vim/command/) | vim#command API provides some basic functions and values for creatting vim custom command. |
|
||||
| [vim#highlight](vim/highlight/) | vim#highlight API provides some basic functions and values for getting and setting highlight info. |
|
||||
| [vim#message](vim/message/) | vim#message API provides some basic functions to generate colored messages. |
|
||||
| [vim#signatures](vim/signatures/) | vim#signatures API provides some basic functions for showing signatures info. |
|
||||
| [vim#window](vim/window/) | vim#window API provides some basic functions for setting and getting config of vim window. |
|
||||
| [vim](vim/) | vim API provides general vim functions. |
|
||||
| [web#html](web/html/) | web#html API provides some basic functions and values for parser html file. |
|
||||
| [web#http](web/http/) | web#http API provides some basic functions and values for http request |
|
||||
| [web#xml](web/xml/) | web#xml API provides some basic functions and values for parser xml file. |
|
||||
|
||||
<!-- SpaceVim api list end -->
|
||||
|
@ -45,16 +45,17 @@ echom s:file.pathSeparator
|
||||
|
||||
| 名称 | 描述 |
|
||||
| ------------------------------------- | ----------------------------------------------------------------------- |
|
||||
| [cmdlinemenu](cmdlinemenu/) | cmdlinemenu 函数提供了一套通过命令行进行选择的快捷接口。 |
|
||||
| [data#dict](data/dict/) | data#dict API 提供了一些处理字典变量的常用方法,包括基础的增删改查。 |
|
||||
| [cmdlinemenu](cmdlinemenu/) | cmdlinemenu 接口函数提供了一套通过命令行进行选择的快捷接口。 |
|
||||
| [data#dict](data/dict/) | data#dict 接口提供了一些处理字典变量的常用方法,包括基础的增删改查。 |
|
||||
| [data#list](data/list/) | data#list 函数库主要提供一些操作列表的常用函数。 |
|
||||
| [data#number](data/number/) | data#number 函数库主要提供一些操作数字的常用函数。 |
|
||||
| [data#string](data/string/) | data#string 函数库主要提供一些操作字符串的常用函数。 |
|
||||
| [file](file/) | 文件函数提供了基础的文件读写相关函数,兼容不同系统平台。 |
|
||||
| [job](job/) | 兼容 neovim 和 vim 的异步协同 API,对于旧版 vim 采用非异步机制 |
|
||||
| [job](job/) | 兼容 neovim 和 vim 的异步协同接口,对于旧版 vim 采用非异步机制 |
|
||||
| [notify](notify/) | notify 接口提供了一个弹出通知消息的接口函数 |
|
||||
| [system](system/) | system 函数提供了系统相关函数,包括判断当前系统平台,文件格式等函数。 |
|
||||
| [unicode#spinners](unicode/spinners/) | unicode#spinners API 可启用一个定时器,根据指定的名称定时更新进度条符号 |
|
||||
| [vim#command](vim/command/) | vim#command API 提供一些设置和获取 Vim 命令的基础函数。 |
|
||||
| [vim#command](vim/command/) | vim#command 接口提供一些设置和获取 Vim 命令的基础函数。 |
|
||||
| [vim#highlight](vim/highlight/) | vim#highlight API 提供一些设置和获取 Vim 高亮信息的基础函数。 |
|
||||
| [vim#message](vim/message/) | vim#message API 提供一些设置和获取 Vim 提示消息的函数。 |
|
||||
| [vim#signatures](vim/signatures/) | vim#signatures API 提供一些设置和获取 Vim 提示消息的函数。 |
|
||||
|
@ -14,11 +14,11 @@ lang: zh
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
#### 简介
|
||||
## 简介
|
||||
|
||||
`job` 接口提供了一套可以兼容 neovim 和 vim 的异步控制机制,具体实现模型是参考的 neovim 的模型。
|
||||
|
||||
#### 函数及变量
|
||||
## 函数及变量
|
||||
|
||||
| 名称 | 描述 |
|
||||
| ------------------ | ---------------------------- |
|
||||
@ -30,7 +30,7 @@ lang: zh
|
||||
|
||||
以上这个 api 仅提供了基础的 job 函数,当你的脚本需要用到 job 高级功能时,建议直接使用 neovim 或 vim 内置函数。
|
||||
|
||||
#### 使用示例
|
||||
## 使用示例
|
||||
|
||||
以下为通过该 API 异步执行命令 `python test.py`,并设置相关的回调函数:
|
||||
|
||||
|
35
docs/cn/api/notify.md
Normal file
35
docs/cn/api/notify.md
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
title: "notify 接口"
|
||||
description: "notify 接口提供了一个弹出通知消息的接口函数"
|
||||
lang: zh
|
||||
---
|
||||
|
||||
# [可用接口](../) >> notify
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
- [简介](#简介)
|
||||
- [函数及变量](#函数及变量)
|
||||
- [使用示例](#使用示例)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
## 简介
|
||||
|
||||
`notify` 接口提供了一个可以弹出自定义通知消息的接口函数。
|
||||
|
||||
## 函数及变量
|
||||
|
||||
| 名称 | 描述 |
|
||||
| --------------------------- | ---------------------------- |
|
||||
| `notify(string)` | 使用默认的颜色弹出通知消息 |
|
||||
| `notify(string, highlight)` | 使用自定义的颜色弹出通知消息 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
使用示例如下:
|
||||
|
||||
```vim
|
||||
let s:NOTIFY = SpaceVim#api#import('notify')
|
||||
call s:NOTIFY.notify('This is a simple notification!')
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user