mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 02:20:05 +08:00
Add vim support
This commit is contained in:
parent
976b22f679
commit
6ddc416214
@ -42,7 +42,7 @@ function! s:warp(argv, opts) abort
|
|||||||
|
|
||||||
function! obj._exit_cb(job_id, data) abort
|
function! obj._exit_cb(job_id, data) abort
|
||||||
if has_key(self._opts, 'on_exit')
|
if has_key(self._opts, 'on_exit')
|
||||||
call self._opts.on_exit(a:job_id, [a:data], 'exit')
|
call self._opts.on_exit(a:job_id, a:data, 'exit')
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -117,8 +117,13 @@ function! SpaceVim#plugins#manager#update() abort
|
|||||||
let s:plugins = keys(dein#get())
|
let s:plugins = keys(dein#get())
|
||||||
let s:total = len(s:plugins)
|
let s:total = len(s:plugins)
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 1, 'Updating plugins (' . s:pct . '/' . s:total . ')')
|
call s:set_buf_line(s:plugin_manager_buffer, 1, 'Updating plugins (' . s:pct . '/' . s:total . ')')
|
||||||
|
if has('nvim')
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 2, s:status_bar())
|
call s:set_buf_line(s:plugin_manager_buffer, 2, s:status_bar())
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 3, '')
|
call s:set_buf_line(s:plugin_manager_buffer, 3, '')
|
||||||
|
else
|
||||||
|
call s:append_buf_line(s:plugin_manager_buffer, 2, s:status_bar())
|
||||||
|
call s:append_buf_line(s:plugin_manager_buffer, 3, '')
|
||||||
|
endif
|
||||||
for i in range(g:spacevim_plugin_manager_max_processes)
|
for i in range(g:spacevim_plugin_manager_max_processes)
|
||||||
call s:pull(dein#get(s:LIST.shift(s:plugins)))
|
call s:pull(dein#get(s:LIST.shift(s:plugins)))
|
||||||
endfor
|
endfor
|
||||||
@ -136,6 +141,7 @@ endfunction
|
|||||||
|
|
||||||
" here if a:data == 0, git pull succeed
|
" here if a:data == 0, git pull succeed
|
||||||
function! s:on_pull_exit(id, data, event) abort
|
function! s:on_pull_exit(id, data, event) abort
|
||||||
|
let g:wsd = a:data
|
||||||
if a:data == 0 && a:event ==# 'exit'
|
if a:data == 0 && a:event ==# 'exit'
|
||||||
call s:msg_on_updated_done(s:pulling_repos[a:id].name)
|
call s:msg_on_updated_done(s:pulling_repos[a:id].name)
|
||||||
else
|
else
|
||||||
@ -167,9 +173,15 @@ function! s:pull(repo) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
" + foo.vim: Updating...
|
" + foo.vim: Updating...
|
||||||
function! s:msg_on_start(name) abort
|
if has('nvim')
|
||||||
|
function! s:msg_on_start(name) abort
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '+ ' . a:name . ': Updating...')
|
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '+ ' . a:name . ': Updating...')
|
||||||
endfunction
|
endfunction
|
||||||
|
else
|
||||||
|
function! s:msg_on_start(name) abort
|
||||||
|
call s:append_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '+ ' . a:name . ': Updating...')
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
" - foo.vim: Updating done.
|
" - foo.vim: Updating done.
|
||||||
function! s:msg_on_updated_done(name) abort
|
function! s:msg_on_updated_done(name) abort
|
||||||
@ -238,12 +250,30 @@ function! s:syntax() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" change modifiable before setline
|
" change modifiable before setline
|
||||||
function! s:set_buf_line(bufnr, nr, line) abort
|
if has('nvim')
|
||||||
if has('nvim')
|
function! s:set_buf_line(bufnr, nr, line) abort
|
||||||
call setbufvar(s:plugin_manager_buffer,'&ma', 1)
|
call setbufvar(s:plugin_manager_buffer,'&ma', 1)
|
||||||
call nvim_buf_set_lines(a:bufnr, a:nr - 1, a:nr, 0, [a:line])
|
call nvim_buf_set_lines(a:bufnr, a:nr - 1, a:nr, 0, [a:line])
|
||||||
call setbufvar(s:plugin_manager_buffer,'&ma', 0)
|
call setbufvar(s:plugin_manager_buffer,'&ma', 0)
|
||||||
else
|
endfunction
|
||||||
echom 'try to set bufer ' . a:bufnr . "'s " . a:nr . 'line to ' . a:line
|
else
|
||||||
endif
|
py import vim
|
||||||
endfunction
|
py import string
|
||||||
|
function! s:set_buf_line(bufnr, nr, line) abort
|
||||||
|
call setbufvar(s:plugin_manager_buffer,'&ma', 1)
|
||||||
|
py bufnr = string.atoi(vim.eval("a:bufnr"))
|
||||||
|
py linr = string.atoi(vim.eval("a:nr")) - 1
|
||||||
|
py str = vim.eval("a:line")
|
||||||
|
py vim.buffers[bufnr][linr] = str
|
||||||
|
call setbufvar(s:plugin_manager_buffer,'&ma', 0)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:append_buf_line(bufnr, nr, line) abort
|
||||||
|
call setbufvar(s:plugin_manager_buffer,'&ma', 1)
|
||||||
|
py bufnr = string.atoi(vim.eval("a:bufnr"))
|
||||||
|
py linr = string.atoi(vim.eval("a:nr")) - 1
|
||||||
|
py str = vim.eval("a:line")
|
||||||
|
py vim.buffers[bufnr].append(str)
|
||||||
|
call setbufvar(s:plugin_manager_buffer,'&ma', 0)
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user