mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 23:10:04 +08:00
feat(layer): use notify api in lang#vim
layer
Problem: no info about doc generation. Solution: 1. run notify api on job exit. 2. add `:h SpaceVim-layers-lang-vim`
This commit is contained in:
parent
e33aeb1b00
commit
553749f5f0
@ -6,6 +6,34 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
|
||||
""
|
||||
" @section lang#vim, layers-lang-vim
|
||||
" @parentsection layers
|
||||
" This layer is for vim script development, disabled by default, to enable this
|
||||
" layer, add following snippet to your SpaceVim configuration file.
|
||||
" >
|
||||
" [[layers]]
|
||||
" name = 'lang#vim'
|
||||
" <
|
||||
"
|
||||
" The `checkers` layer provides syntax linter for vim. you need to install the
|
||||
" `vint` command:
|
||||
" >
|
||||
" pip install vim-vint
|
||||
" <
|
||||
"
|
||||
" @subsection key bindings
|
||||
"
|
||||
" The following key bindings will be added when this layer is loaded:
|
||||
" >
|
||||
" key binding Description
|
||||
" SPC l e eval cursor expr
|
||||
" SPC l v run HelpfulVersion cword
|
||||
" SPC l f open exception trace
|
||||
" g d jump to definition
|
||||
" <
|
||||
|
||||
if exists('s:auto_generate_doc')
|
||||
finish
|
||||
endif
|
||||
@ -19,6 +47,7 @@ let s:SID = SpaceVim#api#import('vim#sid')
|
||||
let s:JOB = SpaceVim#api#import('job')
|
||||
let s:SYS = SpaceVim#api#import('system')
|
||||
let s:FILE = SpaceVim#api#import('file')
|
||||
let s:NOTI = SpaceVim#api#import('notify')
|
||||
|
||||
function! SpaceVim#layers#lang#vim#plugins() abort
|
||||
let plugins = [
|
||||
@ -58,6 +87,15 @@ function! SpaceVim#layers#lang#vim#config() abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:on_exit(...) abort
|
||||
let data = get(a:000, 2)
|
||||
if data != 0
|
||||
call s:NOTI.notify('failed to generate doc!', 'WarningMsg')
|
||||
else
|
||||
call s:NOTI.notify('vim doc generated!', 'Normal')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:generate_doc() abort
|
||||
" neovim in windows executable function is broken
|
||||
" https://github.com/neovim/neovim/issues/9391
|
||||
@ -66,9 +104,17 @@ function! s:generate_doc() abort
|
||||
if !empty(addon_info)
|
||||
let dir = s:FILE.unify_path(addon_info, ':h')
|
||||
if executable('vimdoc') && !s:SYS.isWindows
|
||||
call s:JOB.start(['vimdoc', dir])
|
||||
call s:JOB.start(['vimdoc', dir],
|
||||
\ {
|
||||
\ 'on_exit' : function('s:on_exit'),
|
||||
\ }
|
||||
\ )
|
||||
elseif executable('python')
|
||||
call s:JOB.start(['python', '-m', 'vimdoc', dir])
|
||||
call s:JOB.start(['python', '-m', 'vimdoc', dir],
|
||||
\ {
|
||||
\ 'on_exit' : function('s:on_exit'),
|
||||
\ }
|
||||
\ )
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
@ -17,7 +17,7 @@
|
||||
" name = 'lang#vue'
|
||||
" <
|
||||
"
|
||||
" The |checkers| layer provides syntax linter for vue. you need to install the
|
||||
" The `checkers` layer provides syntax linter for vue. you need to install the
|
||||
" `eslint` and `eslint-plugin-vue`:
|
||||
" >
|
||||
" npm install -g eslint eslint-plugin-vue
|
||||
|
@ -181,21 +181,22 @@ CONTENTS *SpaceVim-contents*
|
||||
95. lang#typescript....................|SpaceVim-layers-lang-typescript|
|
||||
96. lang#v......................................|SpaceVim-layers-lang-v|
|
||||
97. lang#vbnet..............................|SpaceVim-layers-lang-vbnet|
|
||||
98. lang#vue..................................|SpaceVim-layers-lang-vue|
|
||||
99. lang#wolfram..........................|SpaceVim-layers-lang-wolfram|
|
||||
100. lang#xml.................................|SpaceVim-layers-lang-xml|
|
||||
101. lang#xquery...........................|SpaceVim-layers-lang-xquery|
|
||||
102. lang#zig.................................|SpaceVim-layers-lang-zig|
|
||||
103. language server protocol......................|SpaceVim-layers-lsp|
|
||||
104. leaderf...................................|SpaceVim-layers-leaderf|
|
||||
105. operator.................................|SpaceVim-layers-operator|
|
||||
106. shell.......................................|SpaceVim-layers-shell|
|
||||
107. test.........................................|SpaceVim-layers-test|
|
||||
108. tmux.........................................|SpaceVim-layers-tmux|
|
||||
109. tools#dash.............................|SpaceVim-layers-tools-dash|
|
||||
110. tools#zeal.............................|SpaceVim-layers-tools-zeal|
|
||||
111. ui.............................................|SpaceVim-layers-ui|
|
||||
112. unite.......................................|SpaceVim-layers-unite|
|
||||
98. lang#vim..................................|SpaceVim-layers-lang-vim|
|
||||
99. lang#vue..................................|SpaceVim-layers-lang-vue|
|
||||
100. lang#wolfram.........................|SpaceVim-layers-lang-wolfram|
|
||||
101. lang#xml.................................|SpaceVim-layers-lang-xml|
|
||||
102. lang#xquery...........................|SpaceVim-layers-lang-xquery|
|
||||
103. lang#zig.................................|SpaceVim-layers-lang-zig|
|
||||
104. language server protocol......................|SpaceVim-layers-lsp|
|
||||
105. leaderf...................................|SpaceVim-layers-leaderf|
|
||||
106. operator.................................|SpaceVim-layers-operator|
|
||||
107. shell.......................................|SpaceVim-layers-shell|
|
||||
108. test.........................................|SpaceVim-layers-test|
|
||||
109. tmux.........................................|SpaceVim-layers-tmux|
|
||||
110. tools#dash.............................|SpaceVim-layers-tools-dash|
|
||||
111. tools#zeal.............................|SpaceVim-layers-tools-zeal|
|
||||
112. ui.............................................|SpaceVim-layers-ui|
|
||||
113. unite.......................................|SpaceVim-layers-unite|
|
||||
7. Usage....................................................|SpaceVim-usage|
|
||||
1. buffers-and-files..................|SpaceVim-usage-buffers-and-files|
|
||||
2. custom_plugins........................|SpaceVim-usage-custom_plugins|
|
||||
@ -4193,6 +4194,33 @@ KEY BINDINGS
|
||||
<
|
||||
|
||||
|
||||
==============================================================================
|
||||
LANG#VIM *SpaceVim-layers-lang-vim*
|
||||
|
||||
This layer is for vim script development, disabled by default, to enable this
|
||||
layer, add following snippet to your SpaceVim configuration file.
|
||||
>
|
||||
[[layers]]
|
||||
name = 'lang#vim'
|
||||
<
|
||||
|
||||
The `checkers` layer provides syntax linter for vim. you need to install the
|
||||
`vint` command:
|
||||
>
|
||||
pip install vim-vint
|
||||
<
|
||||
|
||||
KEY BINDINGS
|
||||
|
||||
The following key bindings will be added when this layer is loaded:
|
||||
>
|
||||
key binding Description
|
||||
SPC l e eval cursor expr
|
||||
SPC l v run HelpfulVersion cword
|
||||
SPC l f open exception trace
|
||||
g d jump to definition
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
LANG#VUE *SpaceVim-layers-lang-vue*
|
||||
|
||||
@ -4203,7 +4231,7 @@ add following snippet to your SpaceVim configuration file.
|
||||
name = 'lang#vue'
|
||||
<
|
||||
|
||||
The |checkers| layer provides syntax linter for vue. you need to install the
|
||||
The `checkers` layer provides syntax linter for vue. you need to install the
|
||||
`eslint` and `eslint-plugin-vue`:
|
||||
>
|
||||
npm install -g eslint eslint-plugin-vue
|
||||
|
Loading…
Reference in New Issue
Block a user