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

chore(bundle): update bundle dein.vim

This commit is contained in:
wsdjeg 2022-06-15 23:59:27 +08:00
parent 6b356e63ae
commit efbaf95575
17 changed files with 518 additions and 245 deletions

2
bundle/README.md vendored
View File

@ -29,7 +29,7 @@ In `bundle/` directory, there are two kinds of plugins: forked plugins without c
### No changed plugins
- [defx.nvim](https://github.com/Shougo/defx.nvim/tree/df5e6ea6734dc002919ea41786668069fa0b497d)
- [dein.vim](https://github.com/Shougo/dein.vim/tree/772ae08cef5e712b2b31b4aaee908fc853accd94)
- [dein.vim](https://github.com/Shougo/dein.vim/tree/452b4a8b70be924d581c2724e5e218bfd2bcea14)
- [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim/tree/045d9582094b27f5ae04d8b635c6da8e97e53f1d)
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig/tree/507f8a570ac2b8b8dabdd0f62da3b3194bf822f8)
- [deoplete-lsp](https://github.com/deoplete-plugins/deoplete-lsp/tree/c466c955e85d995984a8135e16da71463712e5e5)

View File

@ -1,19 +1,17 @@
**Warning: I will close the bug issue without the minimal init.vim and the reproduce ways.**
**Warning: I will close the bug issue without the minimal init.vim and the
reproduce ways.**
# Problems summary
## Expected
## Environment Information (Required!)
* dein.vim version(SHA1):
- dein.vim version(SHA1):
* OS:
* Vim/neovim version:
- OS:
- Vim/neovim version:
## Provide a minimal .vimrc with less than 50 lines (Required!)
@ -24,15 +22,12 @@ call dein#begin(path)
call dein#end()
```
## The reproduce ways from Vim starting (Required!)
1. foo
2. bar
3. baz
1. foo
2. bar
3. baz
## Screen shot (if possible)
## Upload the log messages by `:redir` and `:message` (if errored)

View File

@ -1,5 +1,6 @@
License: MIT license
AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
MIT license
Copyright (c) Shougo Matsushita <Shougo.Matsu at gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@ -19,3 +20,4 @@ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -16,7 +16,6 @@ Dein.vim is a dark powered Vim/Neovim plugin manager.
<!-- vim-markdown-toc -->
## Requirements
- Vim 8.2 or above or NeoVim(0.5.0+).
@ -29,16 +28,14 @@ instead.
If you need vim-plug like install UI, you can use dein-ui.vim.
https://github.com/wsdjeg/dein-ui.vim
## Quick start
**Note**: You must define the installation directory before to use dein. The
**Note**: You must define the installation directory before to use dein. The
directory that you will want to use depends on your usage.
For example, `~/.vim/bundles` or `~/.cache/dein` or `~/.local/share/dein`.
dein.vim does not define a default installation directory.
You must **not** set the installation directory as `~/.vim/plugin` or
`~/.config/nvim/plugin`.
dein.vim does not define a default installation directory. You must **not** set
the installation directory as `~/.vim/plugin` or `~/.config/nvim/plugin`.
1. Run below script.
@ -106,7 +103,6 @@ syntax enable
"endif
```
## Features
- Faster than NeoBundle
@ -129,14 +125,12 @@ syntax enable
- Merge the plugins directories automatically to avoid long 'runtimepath'
## Future works (TODO)
- Other types support (zip, svn, hg, ...)
- Metadata repository support
### Options
Please read `:help dein-options`

View File

@ -1,9 +1,3 @@
"=============================================================================
" FILE: dein.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
" License: MIT license
"=============================================================================
function! dein#load_cache_raw(vimrcs) abort
return dein#min#_load_cache_raw(a:vimrcs)
endfunction
@ -114,6 +108,9 @@ endfunction
function! dein#get_progress() abort
return dein#install#_get_progress()
endfunction
function! dein#get_failed_plugins() abort
return dein#install#_get_failed_plugins()
endfunction
function! dein#each(command, ...) abort
return dein#install#_each(a:command, (a:0 ? a:1 : []))
endfunction
@ -145,3 +142,13 @@ function! dein#clear_state() abort
\ 'call dein#recache_runtimepath() is needed for ftplugin feature')
endif
endfunction
function! dein#deno_cache(...) abort
call dein#install#_deno_cache(get(a:000, 0, []))
endfunction
function! dein#post_sync(plugins) abort
call dein#install#_post_sync(a:plugins)
endfunction
function! dein#get_updated_plugins(...) abort
return dein#install#_get_updated_plugins(
\ get(a:000, 0, []), dein#install#_is_async())
endfunction

View File

@ -1,9 +1,3 @@
"=============================================================================
" FILE: autoload.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
" License: MIT license
"=============================================================================
function! dein#autoload#_source(...) abort
let plugins = empty(a:000) ? values(g:dein#_plugins) :
\ dein#util#_convert2list(a:1)
@ -41,10 +35,9 @@ function! dein#autoload#_source(...) abort
\ { _, val -> isdirectory(plugin.rtp . '/' . val) }),
\ { _, val -> plugin.rtp . '/' . val })
if directory =~# 'ftdetect'
if get(plugin, 'merge_ftdetect')
continue
if !get(plugin, 'merge_ftdetect')
execute 'augroup filetypedetect'
endif
execute 'augroup filetypedetect'
endif
let files = glob(directory . '/**/*.vim', v:true, v:true)
if has('nvim')
@ -73,14 +66,17 @@ function! dein#autoload#_source(...) abort
" Register for lazy loaded denops plugin
if isdirectory(plugin.rtp . '/denops')
\ && exists('*denops#plugin#is_loaded')
for name in filter(map(globpath(plugin.rtp,
\ 'denops/*/main.ts', v:true, v:true),
\ { _, val -> fnamemodify(val, ':h:t')}),
\ { _, val -> !denops#plugin#is_loaded(val) })
" Note: denops#plugin#register() may be failed
silent! call denops#plugin#register(name, { 'mode': 'skip' })
if denops#server#status() ==# 'running'
" Note: denops#plugin#register() may be failed
silent! call denops#plugin#register(name, { 'mode': 'skip' })
endif
call denops#plugin#wait(name)
redraw
endfor
endif
endif
@ -174,7 +170,6 @@ function! dein#autoload#_on_func(name) abort
let function_prefix = substitute(a:name, '[^#]*$', '', '')
if function_prefix =~# '^dein#'
\ || function_prefix =~# '^vital#'
\ || has('vim_starting')
return
endif
@ -253,7 +248,7 @@ function! dein#autoload#_on_map(mapping, name, mode) abort
if a:mode ==# 'o' && v:operator ==# 'c'
" Note: This is the dirty hack.
execute matchstr(s:mapargrec(a:mapping . input, a:mode),
\ ':<C-U>\zs.*\ze<CR>')
\ ':<C-u>\zs.*\ze<CR>')
else
let mapping = a:mapping
while mapping =~# '<[[:alnum:]_-]\+>'
@ -281,11 +276,6 @@ function! dein#autoload#_dummy_complete(arglead, cmdline, cursorpos) abort
" Load plugins
call dein#autoload#_on_pre_cmd(tolower(command))
if exists(':'.command) == 2
" Print the candidates
call feedkeys("\<C-d>", 'n')
endif
return [a:arglead]
endfunction
@ -295,10 +285,18 @@ function! s:source_plugin(rtps, index, plugin, sourced) abort
return
endif
call add(a:sourced, a:plugin)
call insert(a:sourced, a:plugin)
let index = a:index
" Note: on_source must sourced after depends
for on_source in filter(dein#util#_get_lazy_plugins(),
\ { _, val -> index(get(val, 'on_source', []), a:plugin.name) >= 0 })
if s:source_plugin(a:rtps, index, on_source, a:sourced)
let index += 1
endif
endfor
" Load dependencies
for name in get(a:plugin, 'depends', [])
if !has_key(g:dein#_plugins, name)
@ -321,13 +319,6 @@ function! s:source_plugin(rtps, index, plugin, sourced) abort
let a:plugin.sourced = 1
for on_source in filter(dein#util#_get_lazy_plugins(),
\ { _, val -> index(get(val, 'on_source', []), a:plugin.name) >= 0 })
if s:source_plugin(a:rtps, index, on_source, a:sourced)
let index += 1
endif
endfor
if has_key(a:plugin, 'dummy_commands')
for command in a:plugin.dummy_commands
silent! execute 'delcommand' command[0]

View File

@ -1,14 +1,10 @@
"=============================================================================
" FILE: install.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
" License: MIT license
"=============================================================================
" Variables
let s:global_context = {}
let s:log = []
let s:updates_log = []
let s:progress = ''
let s:failed_plugins = []
let s:progress_winid = -1
" Global options definition.
let g:dein#install_max_processes =
@ -28,6 +24,11 @@ let g:dein#install_curl_command =
\ get(g:, 'dein#install_curl_command', 'curl')
let g:dein#install_check_diff =
\ get(g:, 'dein#install_check_diff', v:false)
let g:dein#install_check_remote_threshold =
\ get(g:, 'dein#install_check_remote_threshold', 0)
let g:dein#install_copy_vim =
\ get(g:, 'dein#install_copy_vim',
\ has('nvim') && !dein#util#_is_windows())
function! s:get_job() abort
if !exists('s:Job')
@ -105,26 +106,26 @@ function! s:update_loop(context) abort
return errored
endfunction
function! dein#install#_check_update(plugins, force, async) abort
function! dein#install#_get_updated_plugins(plugins, async) abort
if g:dein#install_github_api_token ==# ''
call s:error('You need to set g:dein#install_github_api_token' .
\ ' for the feature.')
return
return []
endif
if !executable(g:dein#install_curl_command)
call s:error('curl must be executable for the feature.')
return
return []
endif
let s:global_context.progress_type = 'echo'
let context = s:init_context(a:plugins, 'check_update', 0)
call s:init_variables(context)
let query_max = 100
let plugins = dein#util#_get_plugins(a:plugins)
let processes = []
for index in range(0, len(plugins) - 1, query_max)
redraw
call s:print_progress_message(
\s:get_progress_message('', index, len(plugins)))
\ s:get_progress_message('send query', index, len(plugins)))
let query = ''
for plug_index in range(index,
@ -205,32 +206,66 @@ function! dein#install#_check_update(plugins, force, async) abort
" Compare with .git directory updated time.
let updated = []
let index = 1
for plugin in plugins
if !has_key(check_pushed, plugin.repo)
let index += 1
continue
endif
call s:print_progress_message(
\ s:get_progress_message('compare plugin', index, len(plugins)))
let git_path = plugin.path . '/.git'
let repo_time = isdirectory(plugin.path) ? getftime(git_path) : -1
if min([repo_time, rollback_time]) < check_pushed[plugin.repo]
call s:log(printf('%s: pushed_time=%d, repo_time=%d, rollback_time=%d',
\ plugin.name, check_pushed[plugin.repo], repo_time, rollback_time))
let local_update = min([repo_time, rollback_time])
if local_update < check_pushed[plugin.repo]
call add(updated, plugin)
elseif abs(local_update - check_pushed[plugin.repo]) <
\ g:dein#install_check_remote_threshold
" Note: github Graph QL API may use cached value
" If the repository is updated recently, use "git ls-remote" instead.
let remote = matchstr(s:system_cd(
\ ['git', 'ls-remote', 'origin', 'HEAD'], plugin.path), '^\x\+')
let local = s:get_revision_number(plugin)
call s:log(printf('%s: remote=%s, local=%s',
\ plugin.name, remote, local))
if remote !=# '' && local !=# remote
call add(updated, plugin)
endif
endif
let index += 1
endfor
redraw | echo ''
if s:progress_winid > 0
call timer_start(1000, { -> s:close_progress_popup() })
endif
" Clear global context
let s:global_context = {}
return updated
endfunction
function! dein#install#_check_update(plugins, force, async) abort
let updated = dein#install#_get_updated_plugins(a:plugins, a:async)
if empty(updated)
call s:notify(strftime('Done: (%Y/%m/%d %H:%M:%S)'))
return
endif
" Note: Use echo to display it in confirm
call s:echo('Updated plugins: ' .
\ string(map(copy(updated), { _, val -> val.name })), 'echo')
let updated_msg = 'Updated plugins: ' .
\ string(map(copy(updated), { _, val -> val.name }))
call s:log(updated_msg)
" Note: Use echomsg to display it in confirm
call s:echo(updated_msg, 'echomsg')
if !a:force && confirm(
\ 'Updated plugins are exists. Update now?', "yes\nNo", 2) != 1
return
@ -353,7 +388,9 @@ function! dein#install#_recache_runtimepath() abort
call s:merge_files(merge_ftdetect_plugins, 'ftdetect')
call s:merge_files(merge_ftdetect_plugins, 'after/ftdetect')
silent call dein#remote_plugins()
if get(g:, 'dein#auto_remote_plugins', v:true)
silent call dein#remote_plugins()
endif
call dein#call_hook('post_source')
@ -390,7 +427,7 @@ function! s:helptags() abort
let tags = dein#util#_get_runtime_path() . '/doc'
call dein#util#_safe_mkdir(tags)
call s:copy_files(filter(values(dein#get()),
\ { _, val -> !val.merged }), 'doc')
\ { _, val -> !val.merged && !get(val, 'local', v:false) }), 'doc')
silent execute 'helptags' fnameescape(tags)
catch /^Vim(helptags):E151:/
" Ignore an error that occurs when there is no help file
@ -411,19 +448,28 @@ function! s:copy_files(plugins, directory) abort
endfor
endfunction
function! s:merge_files(plugins, directory) abort
let files = []
let vimfiles = []
let luafiles = []
for plugin in a:plugins
for file in filter(globpath(
\ plugin.rtp, a:directory.'/**', v:true, v:true),
\ plugin.rtp, a:directory.'/**/*', v:true, v:true),
\ { _, val -> !isdirectory(val) })
let files += readfile(file, ':t')
if fnamemodify(file, ':e') ==# 'vim'
let vimfiles += readfile(file, ':t')
elseif fnamemodify(file, ':e') ==# 'lua'
let luafiles += readfile(file, ':t')
endif
endfor
endfor
if !empty(files)
call dein#util#_cache_writefile(files,
if !empty(vimfiles)
call dein#util#_cache_writefile(vimfiles,
\ printf('.dein/%s/%s.vim', a:directory, a:directory))
endif
if !empty(luafiles)
call dein#util#_cache_writefile(luafiles,
\ printf('.dein/%s/%s.lua', a:directory, a:directory))
endif
endfunction
function! dein#install#_save_rollback(rollbackfile, plugins) abort
let revisions = {}
@ -475,12 +521,13 @@ endfunction
function! dein#install#_get_default_ftplugin() abort
return [
\ 'if exists("g:did_load_ftplugin")',
\ 'if exists("g:did_load_after_ftplugin")',
\ ' finish',
\ 'endif',
\ 'let g:did_load_ftplugin = 1',
\ 'let g:did_load_after_ftplugin = 1',
\ '',
\ 'augroup filetypeplugin',
\ ' autocmd!',
\ ' autocmd FileType * call s:ftplugin()',
\ 'augroup END',
\ '',
@ -542,7 +589,7 @@ function! s:generate_ftplugin() abort
\ dein#install#_get_default_ftplugin() + [
\ 'function! s:after_ftplugin()',
\ ] + get(ftplugin, '_', []) + ['endfunction'],
\ dein#util#_get_runtime_path() . '/ftplugin.vim')
\ dein#util#_get_runtime_path() . '/after/ftplugin.vim')
" Generate after/ftplugin
for [filetype, list] in filter(items(ftplugin),
@ -586,8 +633,13 @@ function! dein#install#_remote_plugins() abort
endif
" Load not loaded neovim remote plugins
let remote_plugins = filter(values(dein#get()),
\ { _, val -> isdirectory(val.rtp . '/rplugin') && !val.sourced })
let remote_plugins = filter(values(dein#get()), { _, val ->
\ isdirectory(val.rtp . '/rplugin') && !val.sourced &&
\ !empty(glob(val.rtp . '/rplugin/*/*/__init__.py', 1, 1))
\ })
if empty(remote_plugins)
return
endif
call dein#autoload#_source(remote_plugins)
@ -654,6 +706,9 @@ endfunction
function! dein#install#_get_progress() abort
return s:progress
endfunction
function! dein#install#_get_failed_plugins() abort
return s:failed_plugins
endfunction
function! s:get_progress_message(name, number, max) abort
return printf('(%'.len(a:max).'d/%'.len(a:max).'d) [%s%s] %s',
@ -766,9 +821,9 @@ function! s:lock_revision(process, context) abort
endif
endfunction
function! s:get_updated_message(context, plugins) abort
if empty(a:plugins)
return ''
endif
"if empty(a:plugins)
" return ''
"endif
" Diff check
if g:dein#install_check_diff
@ -801,6 +856,7 @@ function! s:get_errored_message(plugins) abort
return msg
endfunction
function! s:check_diff(plugins) abort
for plugin in a:plugins
let type = dein#util#_get_type(plugin.type)
@ -808,15 +864,38 @@ function! s:check_diff(plugins) abort
continue
endif
let diff = s:system_cd(
\ type.get_diff_command(plugin, plugin.old_rev, plugin.new_rev),
\ plugin.path)
if diff !=# ''
echo printf("%s: The documentation is updated\n%s\n\n",
\ plugin.name, diff)
endif
" Note: execute diff command in background
let cmd = type.get_diff_command(plugin, plugin.old_rev, plugin.new_rev)
let cwd = getcwd()
try
call dein#install#_cd(plugin.path)
call s:get_job().start(
\ s:convert_args(cmd), {
\ 'on_stdout': function('s:check_diff_on_out')
\ })
finally
call dein#install#_cd(cwd)
endtry
endfor
endfunction
function! s:check_diff_on_out(data) abort
let bufname = 'dein-diff'
if !bufexists(bufname)
let bufnr = bufadd(bufname)
else
let bufnr = bufnr(bufname)
endif
if bufwinnr(bufnr) < 0
let cmd = 'setlocal bufhidden=wipe filetype=diff buftype=nofile nolist'
\ . '| syntax enable'
execute printf('sbuffer +%s', escape(cmd, ' ')) bufnr
endif
let current = getbufline(bufnr, '$')[0]
call setbufline(bufnr, '$', current . a:data[0])
call appendbufline(bufnr, '$', a:data[1:])
endfunction
" Helper functions
@ -854,7 +933,6 @@ function! s:job_system.system(cmd) abort
let job = s:get_job().start(
\ s:convert_args(a:cmd),
\ {'on_stdout': self.on_out})
let s:job_system.status = job.wait(
\ g:dein#install_process_timeout * 1000)
return join(s:job_system.candidates, "\n")
@ -930,6 +1008,11 @@ function! dein#install#_copy_directories(srcs, dest) abort
return 0
endif
if g:dein#install_copy_vim
" Note: For neovim, vim.loop.fs_{sym}link is faster
return dein#install#_copy_directories_vim(a:srcs, a:dest)
endif
if dein#util#_is_windows() && has('python3')
\ && dein#install#_python_version_check()
" In Windows, copy directory is too slow!
@ -1048,6 +1131,82 @@ vim.vars['dein#_python_version_check'] = (
EOF
return get(g:, 'dein#_python_version_check', 0)
endfunction
function! dein#install#_copy_directories_vim(srcs, dest) abort
for src in a:srcs
for srcpath in glob(src . '/**/*', 1, 1)
let destpath = substitute(srcpath,
\ dein#util#escape_match(src),
\ dein#util#escape_match(a:dest), '')
let parent = fnamemodify(destpath, ':p:h')
if !isdirectory(parent)
call mkdir(parent, 'p')
endif
if isdirectory(srcpath)
call mkdir(destpath, 'p')
elseif srcpath !~# 'tags\%(-\w*\)\?$'
" Ignore tags
call dein#install#_copy_file_vim(srcpath, destpath)
endif
endfor
endfor
endfunction
function! dein#install#_copy_file_vim(src, dest) abort
" Note: In Windows, v:lua.vim.loop.fs_symlink does not work.
if has('nvim')
if dein#util#_is_windows()
call v:lua.vim.loop.fs_link(a:src, a:dest)
else
call v:lua.vim.loop.fs_symlink(a:src, a:dest)
endif
else
let raw = readfile(a:src, 'b')
call writefile(raw, a:dest, 'b')
endif
endfunction
function! dein#install#_deno_cache(...) abort
if !executable('deno')
return
endif
let plugins = dein#util#_get_plugins(get(a:000, 0, []))
for plugin in plugins
if !isdirectory(plugin.rtp . '/denops')
continue
endif
call dein#install#_system(
\ ['deno', 'cache', '--no-check'] +
\ glob(plugin.rtp . '/denops/**/*.ts', 1, 1))
endfor
endfunction
function! dein#install#_post_sync(plugins) abort
if empty(a:plugins)
return
endif
call dein#install#_recache_runtimepath()
call dein#install#_deno_cache(a:plugins)
call dein#source(a:plugins)
" Execute done_update hooks
let done_update_plugins = filter(dein#util#_get_plugins(a:plugins),
\ { _, val -> has_key(val, 'hook_done_update') })
if !empty(done_update_plugins)
if has('vim_starting')
let s:done_updated_plugins = done_update_plugins
autocmd dein VimEnter * call s:call_done_update_hooks(
\ s:done_updated_plugins)
else
call s:call_done_update_hooks(done_update_plugins)
endif
endif
endfunction
function! s:install_blocking(context) abort
try
@ -1159,44 +1318,40 @@ endfunction
function! s:start() abort
call s:notify(strftime('Update started: (%Y/%m/%d %H:%M:%S)'))
endfunction
function! s:close_progress_popup() abort
if winbufnr(s:progress_winid) < 0
return
endif
if has('nvim')
silent! call nvim_win_close(s:progress_winid, v:true)
else
silent! call popup_close(s:progress_winid)
endif
let s:progress_winid = -1
endfunction
function! s:done(context) abort
call s:restore_view(a:context)
let s:failed_plugins = map(copy(a:context.errored_plugins),
\ { _, val -> val.name })
if !empty(a:context.synced_plugins)
let names = map(copy(a:context.synced_plugins), { _, val -> val.name })
call dein#install#_post_sync(names)
endif
if !has('vim_starting')
call s:notify(s:get_updated_message(a:context, a:context.synced_plugins))
call s:notify(s:get_errored_message(a:context.errored_plugins))
endif
if !empty(a:context.synced_plugins)
call dein#install#_recache_runtimepath()
call dein#source(map(copy(a:context.synced_plugins),
\ { _, val -> val.name }))
" Execute done_update hooks
let done_update_plugins = filter(copy(a:context.synced_plugins),
\ { _, val -> has_key(val, 'hook_done_update') })
if !empty(done_update_plugins)
if has('vim_starting')
let s:done_updated_plugins = done_update_plugins
autocmd dein VimEnter * call s:call_done_update_hooks(
\ s:done_updated_plugins)
else
" Reload plugins to execute hooks
runtime! plugin/**/*.vim
if has('nvim')
" Neovim loads lua files at startup
runtime! plugin/**/*.lua
endif
call s:call_done_update_hooks(done_update_plugins)
endif
endif
endif
redraw | echo ''
if s:progress_winid > 0
call timer_start(1000, { -> s:close_progress_popup() })
endif
call s:notify(strftime('Done: (%Y/%m/%d %H:%M:%S)'))
" Disable installation handler
@ -1489,20 +1644,65 @@ function! s:print_progress_message(msg) abort
return
endif
redraw
let progress_type = context.progress_type
let lines = join(msg, "\n")
if progress_type ==# 'tabline'
set showtabline=2
let &g:tabline = join(msg, "\n")
let &g:tabline = lines
elseif progress_type ==# 'title'
set title
let &g:titlestring = join(msg, "\n")
let &g:titlestring = lines
elseif progress_type ==# 'floating'
if s:progress_winid <= 0
let s:progress_winid = s:new_progress_window()
endif
let bufnr = winbufnr(s:progress_winid)
if getbufline(bufnr, 1) ==# ['']
call setbufline(bufnr, 1, msg)
else
call appendbufline(bufnr, '$', msg)
endif
call win_execute(s:progress_winid, "call cursor('$', 0) | redraw")
elseif progress_type ==# 'echo'
call s:echo(msg, 'echo')
endif
call s:log(msg)
let s:progress = join(msg, "\n")
let s:progress = lines
endfunction
function! s:new_progress_window() abort
let winrow = 0
let wincol = &columns / 4
let winwidth = 80
let winheight = 20
if has('nvim')
let winid = nvim_open_win(nvim_create_buf(v:false, v:true), v:true, {
\ 'relative': 'editor',
\ 'row': winrow,
\ 'col': wincol,
\ 'focusable': v:false,
\ 'noautocmd': v:true,
\ 'style': 'minimal',
\ 'width': winwidth,
\ 'height': winheight,
\})
else
let winid = popup_create([], {
\ 'pos': 'topleft',
\ 'line': winrow + 1,
\ 'col': wincol + 1,
\ 'minwidth': winwidth,
\ 'minheight': winheight,
\ 'wrap': 0,
\ })
endif
return winid
endfunction
function! s:error(msg) abort
let msg = dein#util#_convert2list(a:msg)

View File

@ -15,6 +15,7 @@ function! dein#min#_init() abort
let g:dein#_vimrcs = []
let g:dein#_block_level = 0
let g:dein#_event_plugins = {}
let g:dein#_on_lua_plugins = {}
let g:dein#_is_sudo = $SUDO_USER !=# '' && $USER !=# $SUDO_USER
\ && $HOME !=# expand('~'.$USER)
\ && $HOME ==# expand('~'.$SUDO_USER)
@ -49,7 +50,7 @@ function! dein#min#_init() abort
lua <<END
table.insert(package.loaders, 1, (function()
return function(mod_name)
if string.find(mod_name, '^vim.') == nil then
if vim.g['dein#_on_lua_plugins'][mod_name] then
vim.fn['dein#autoload#_on_lua'](mod_name)
end
return nil

View File

@ -1,9 +1,3 @@
"=============================================================================
" FILE: parse.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
" License: MIT license
"=============================================================================
" Global options definition."
let g:dein#enable_name_conversion =
\ get(g:, 'dein#enable_name_conversion', v:false)
@ -88,7 +82,7 @@ function! dein#parse#_dict(plugin) abort
if !has_key(plugin, 'normalized_name')
let plugin.normalized_name = substitute(
\ fnamemodify(plugin.name, ':r'),
\ '\c^\%(n\?vim\|dps\)[_-]\|[_-]n\?vim$', '', 'g')
\ '\c^\%(n\?vim\|dps\|denops\)[_-]\|[_-]n\?vim$', '', 'g')
endif
if !has_key(a:plugin, 'name') && g:dein#enable_name_conversion
@ -331,6 +325,12 @@ function! s:parse_lazy(plugin) abort
if has_key(a:plugin, 'on_map')
call s:generate_dummy_mappings(a:plugin)
endif
if has_key(a:plugin, 'on_lua')
for mod in a:plugin.on_lua
let g:dein#_on_lua_plugins[mod] = v:true
endfor
endif
endfunction
function! s:generate_dummy_commands(plugin) abort
let a:plugin.dummy_commands = []

View File

@ -1,9 +1,3 @@
"=============================================================================
" FILE: raw.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
" License: MIT license
"=============================================================================
function! dein#types#raw#define() abort
return s:type
endfunction

View File

@ -1,9 +1,3 @@
"=============================================================================
" FILE: util.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
" License: MIT license
"=============================================================================
let s:is_windows = has('win32') || has('win64')
let s:merged_length = 3
@ -45,15 +39,16 @@ function! dein#util#_get_cache_path() abort
return g:dein#_cache_path
endif
let g:dein#_cache_path = get(g:,
\ 'dein#cache_directory', g:dein#_base_path)
\ . '/.cache/' . fnamemodify(dein#util#_get_myvimrc(), ':t')
let g:dein#_cache_path = dein#util#_substitute_path(
\ get(g:, 'dein#cache_directory', g:dein#_base_path)
\ . '/.cache/' . fnamemodify(dein#util#_get_myvimrc(), ':t'))
call dein#util#_safe_mkdir(g:dein#_cache_path)
return g:dein#_cache_path
endfunction
function! dein#util#_get_vimrcs(vimrcs) abort
return !empty(a:vimrcs) ?
\ map(dein#util#_convert2list(a:vimrcs), { _, val -> expand(val) }) :
\ map(dein#util#_convert2list(a:vimrcs),
\ { _, val -> dein#util#_substitute_path(expand(val)) }) :
\ [dein#util#_get_myvimrc()]
endfunction
function! dein#util#_get_myvimrc() abort
@ -74,7 +69,7 @@ function! dein#util#_notify(msg) abort
call dein#util#_set_default(
\ 'g:dein#notification_icon', '')
call dein#util#_set_default(
\ 'g:dein#notification_time', 2)
\ 'g:dein#notification_time', 2000)
if !g:dein#enable_notification || a:msg ==# ''
call dein#util#_error(a:msg)
@ -83,44 +78,31 @@ function! dein#util#_notify(msg) abort
let title = '[dein]'
if has('nvim') && dein#util#_luacheck('notify')
" Use nvim-notify plugin
call luaeval('require("notify")(_A.msg, "info", {'.
\ 'timeout=vim.g["dein#notification_time"] * 1000,'.
\ 'title=_A.title })',
\ { 'msg': a:msg, 'title': title })
return
endif
if has('vim_starting') && !has('gui_running')
call dein#util#_error(a:msg)
return
endif
let icon = dein#util#_expand(g:dein#notification_icon)
let cmd = []
if executable('notify-send')
let cmd = ['notify-send', '-t', g:dein#notification_time * 1000]
if icon !=# ''
let cmd += ['-i', icon]
endif
let cmd += [title, a:msg]
elseif dein#util#_is_mac()
let cmd = []
if executable('terminal-notifier')
let cmd += ['terminal-notifier', '-title', 'title', '-message', a:msg]
if icon !=# ''
let cmd += ['-appIcon', icon]
endif
if has('nvim')
if dein#util#_luacheck('notify')
" Use nvim-notify plugin
call luaeval('require("notify")(_A.msg, "info", {'.
\ 'timeout=vim.g["dein#notification_time"],'.
\ 'title=_A.title })',
\ { 'msg': a:msg, 'title': title })
else
let cmd += ['osascript', '-e', 'display notification '
\ . printf('"%s" with title "%s"', a:msg, title)]
call nvim_notify(a:msg, 1, {})
endif
else
if dein#is_available('vim-notification') ||
\ exists('g:loaded_notification')
" Use vim-notification plugin
call notification#show({
\ 'text': a:msg,
\ 'title': title,
\ 'wait': g:dein#notification_time,
\ })
else
call popup_notification(a:msg, {
\ 'title': title,
\ 'time': g:dein#notification_time,
\ })
endif
endif
if !empty(cmd)
call dein#install#_system_bg(cmd)
endif
endfunction
function! dein#util#_luacheck(module) abort
@ -284,14 +266,15 @@ function! dein#util#_save_state(is_starting) abort
\ 'if g:dein#_cache_version !=# ' . g:dein#_cache_version . ' || ' .
\ 'g:dein#_init_runtimepath !=# ' . string(g:dein#_init_runtimepath) .
\ ' | throw ''Cache loading error'' | endif',
\ 'let [plugins, ftplugin] = dein#min#_load_cache_raw('.
\ 'let [s:plugins, s:ftplugin] = dein#min#_load_cache_raw('.
\ string(g:dein#_vimrcs) .')',
\ "if empty(plugins) | throw 'Cache loading error' | endif",
\ 'let g:dein#_plugins = plugins',
\ 'let g:dein#_ftplugin = ftplugin',
\ "if empty(s:plugins) | throw 'Cache loading error' | endif",
\ 'let g:dein#_plugins = s:plugins',
\ 'let g:dein#_ftplugin = s:ftplugin',
\ 'let g:dein#_base_path = ' . string(g:dein#_base_path),
\ 'let g:dein#_runtime_path = ' . string(g:dein#_runtime_path),
\ 'let g:dein#_cache_path = ' . string(g:dein#_cache_path),
\ 'let g:dein#_on_lua_plugins = ' . string(g:dein#_on_lua_plugins),
\ 'let &runtimepath = ' . string(&runtimepath),
\ ]
@ -316,7 +299,10 @@ function! dein#util#_save_state(is_starting) abort
if !empty(g:dein#_hook_add)
let lines += s:skipempty(g:dein#_hook_add)
endif
for plugin in dein#util#_tsort(values(dein#get()))
for plugin in filter(dein#util#_tsort(values(dein#get())),
\ { _, val ->
\ isdirectory(val.path) && (!has_key(val, 'if') || eval(val.if))
\ })
if has_key(plugin, 'hook_add') && type(plugin.hook_add) == v:t_string
let lines += s:skipempty(plugin.hook_add)
endif
@ -383,7 +369,8 @@ function! dein#util#_begin(path, vimrcs) abort
if has('vim_starting')
" Filetype off
if exists('g:did_load_filetypes') || has('nvim')
if (!has('nvim') && get(g:, 'did_load_filetypes', v:false))
\ || (has('nvim') && !get(g:, 'do_filetype_lua', v:false))
let g:dein#_off1 = 'filetype off'
execute g:dein#_off1
endif
@ -398,7 +385,7 @@ function! dein#util#_begin(path, vimrcs) abort
" Insert dein runtimepath to the head in 'runtimepath'.
let rtps = dein#util#_split_rtp(&runtimepath)
let idx = index(rtps, $VIMRUNTIME)
let idx = index(rtps, dein#util#_substitute_path($VIMRUNTIME))
if idx < 0
call dein#util#_error('Invalid runtimepath.')
return 1
@ -516,7 +503,7 @@ function! dein#util#_call_hook(hook_name, ...) abort
\ ((a:hook_name !=# 'source'
\ && a:hook_name !=# 'post_source') || val.sourced)
\ && has_key(val, hook) && isdirectory(val.path)
\ && (!has_key(v:val, 'if') || eval(v:val.if))
\ && (!has_key(val, 'if') || eval(val.if))
\ })
for plugin in plugins
call dein#util#_execute_hook(plugin, plugin[hook])
@ -578,11 +565,13 @@ endfunction
function! dein#util#_split_rtp(runtimepath) abort
if stridx(a:runtimepath, '\,') < 0
return split(a:runtimepath, ',')
let rtps = split(a:runtimepath, ',')
else
let split = split(a:runtimepath, '\\\@<!\%(\\\\\)*\zs,')
let rtps = map(split,
\ { _, val -> substitute(val, '\\\([\\,]\)', '\1', 'g') })
endif
let split = split(a:runtimepath, '\\\@<!\%(\\\\\)*\zs,')
return map(split, { _, val -> substitute(val, '\\\([\\,]\)', '\1', 'g') })
return map(rtps, { _, val -> dein#util#_substitute_path(val) })
endfunction
function! dein#util#_join_rtp(list, runtimepath, rtp) abort
return (stridx(a:runtimepath, '\,') < 0 && stridx(a:rtp, ',') < 0) ?
@ -591,7 +580,7 @@ function! dein#util#_join_rtp(list, runtimepath, rtp) abort
endfunction
function! dein#util#_add_after(rtps, path) abort
let idx = index(a:rtps, $VIMRUNTIME)
let idx = index(a:rtps, dein#util#_substitute_path($VIMRUNTIME))
call insert(a:rtps, a:path, (idx <= 0 ? -1 : idx + 1))
endfunction
@ -740,6 +729,9 @@ function! s:escape(path) abort
" Escape a path for runtimepath.
return substitute(a:path, ',\|\\,\@=', '\\\0', 'g')
endfunction
function! dein#util#escape_match(str) abort
return escape(a:str, '~\.^$[]')
endfunction
function! s:execute(expr) abort
if exists('*execute')

View File

@ -1,9 +1,3 @@
"=============================================================================
" FILE: dein.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" License: MIT license
"=============================================================================
function! unite#kinds#dein#define() abort
return s:kind
endfunction

View File

@ -1,9 +1,3 @@
"=============================================================================
" FILE: dein.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
" License: MIT license
"=============================================================================
function! unite#sources#dein#define() abort
return s:source
endfunction

View File

@ -0,0 +1,46 @@
import {
BaseSource,
Item,
} from "https://deno.land/x/ddu_vim@v0.8.0/types.ts";
import { Denops } from "https://deno.land/x/ddu_vim@v0.8.0/deps.ts";
import { ActionData } from "https://deno.land/x/ddu_kind_file@v0.2.0/file.ts";
type Params = Record<string, never>;
type Dein = {
name: string;
path: string;
};
export class Source extends BaseSource<Params> {
kind = "file";
gather(args: {
denops: Denops;
sourceParams: Params;
}): ReadableStream<Item<ActionData>[]> {
return new ReadableStream({
async start(controller) {
const deins = Object.values(
await args.denops.call("dein#get") as Record<string, Dein>,
);
const items = deins.map((dein) => {
return {
word: dein.name,
action: {
path: dein.path,
},
};
});
controller.enqueue(items);
controller.close();
},
});
}
params(): Params {
return {};
}
}

View File

@ -101,8 +101,8 @@ Now configure your bundles. (Refer to |dein-examples|)
Call |dein#update()| function to install your plugins.
>
If you need vim-plug like install UI, you can use dein-ui.vim.
https://github.com/wsdjeg/dein-ui.vim
If you need vim-plug like install UI, you can use ddu-source-dein_update.
https://github.com/matsui54/ddu-source-dein_update
==============================================================================
@ -173,7 +173,7 @@ dein#check_lazy_plugins()
dein#check_update([{force}[, {plugins}]])
Check updated {plugins} by github GraphQL API.
https://docs.github.com/en/graphql
If {force} is |v:true|, it call |dein#update()|after updated
If {force} is |v:true|, it call |dein#update()| after updated
check.
{plugins} are the plugins name list or the plugin name to
check.
@ -186,6 +186,8 @@ dein#check_update([{force}[, {plugins}]])
solution. If "git" command change ".git" directory status(for
example: "git reset"), it cannot detect the update properly.
And github API cannot detect upstream changes immediately.
If you set |g:dein#install_check_remote_threshold|, the check
is more strict but slower.
*dein#check_clean()*
dein#check_clean()
@ -214,6 +216,13 @@ dein#config({options})
\ 'lazy' : 1, 'on_event' : 'InsertEnter',
\ })
<
*dein#deno_cache()*
dein#deno_cache({plugins})
Update {plugins} deno cache.
If you omit {plugins}, all plugins cache is updated.
It is executed automatically when plugins are updated.
Note: "deno" must be executable in your "$PATH".
*dein#direct_install()*
dein#direct_install({repo}[, {options}])
Direct install a plugin without editing the configuration.
@ -231,6 +240,9 @@ dein#disable({plugins})
{plugins} is the plugins name list.
Note: This command must be executed before dein loads
the plugins.
Note: The plugins must be disabled |dein-options-merged|.
Because merged plugins are moved to plugins directory and
loaded automatically.
Note: Disabled plugins are removed from dein's plugin list.
You cannot get disabled plugins from dein.
@ -259,6 +271,20 @@ dein#get([{plugin-name}])
dein#get_direct_plugins_path()
Get the direct installed plugins script path.
*dein#get_failed_plugins()*
dein#get_failed_plugins()
Get the previous installation failed plugins.
*dein#get_updated_plugins()*
dein#get_updated_plugins([, {plugins}])
Get updated {plugins} by github GraphQL API.
https://docs.github.com/en/graphql
{plugins} are the plugins name list or the plugin name to
check.
Note: You can use it for github plugins.
Note: You need to set |g:dein#install_github_api_token| to use
the feature.
*dein#get_log()*
dein#get_log()
Get all previous install logs.
@ -380,6 +406,12 @@ dein#plugins2toml({plugins})
Returns the toml configurations for {plugins}
{plugins} is the plugins dictionary from |dein#get()|.
*dein#post_sync()*
dein#post_sync({plugins})
Execute an process needed after the plugins are updated.
It can be used to create third-party dein upgrader.
{plugins} is the plugins name list that was updated.
*dein#reinstall()*
dein#reinstall({plugins})
Reinstall the plugins.
@ -451,12 +483,19 @@ VARIABLES *dein-variables*
*g:dein#auto_recache*
g:dein#auto_recache
If you set it to 1, call |dein#recache_runtimepath()|
If you set it to |v:true|, call |dein#recache_runtimepath()|
automatically in |dein#save_state()|.
Note: It is slow especially Windows.
Default: v:false
*g:dein#auto_remote_plugins*
g:dein#auto_remote_plugins
If you set it to |v:true|, call |dein#remote_plugins()|
automatically in |dein#recache_runtimepath()|.
Default: v:true
*g:dein#cache_directory*
g:dein#cache_directory
The cache directory to use.
@ -488,21 +527,12 @@ g:dein#enable_name_conversion
*g:dein#enable_notification*
g:dein#enable_notification
If you set it to 1, dein uses the notification feature.
You need the following commands to use it.
In neovim: "nvim-notify"
In neovim: Use "nvim-notify" or |nvim_notify()| API
https://github.com/rcarriga/nvim-notify
Note: This is experimental.
In Windows: "notify-send for Windows"
http://vaskovsky.net/notify-send/
https://github.com/vaskovsky/notify-send
In Mac: "terminal-notifier" or "osascript" command
https://github.com/julienXX/terminal-notifier
Note: "reattach-to-user-namespace" command is needed in tmux.
In Linux: "notify-send" command
In Vim: Use "vim-notification" or |popup_notification()| API
https://github.com/mattn/vim-notification
Defaults: v:false
@ -519,9 +549,28 @@ g:dein#inline_vimrcs
*g:dein#install_check_diff*
g:dein#install_check_diff
It checks plugins documentation diff when updated plugins.
Note: Dein outputs the diff to new buffer in the background.
Defaults: v:false
*g:dein#install_check_remote_threshold*
g:dein#install_check_remote_threshold
If the repository is updated newer than the threshold, use
strict "git ls-remote" check when |dein#check_update()|.
The unit is second.
Defaults: 0
>
" Strict check updated plugins yesterday
let g:dein#install_check_remote_threshold = 24 * 60 * 60
<
*g:dein#install_copy_vim*
g:dein#install_copy_vim
It use Vim script copy routine when
|dein#recache_runtimepath()|.
Defaults: v:true if neovim and not Windows
*g:dein#install_github_api_token*
g:dein#install_github_api_token
github API key to use |dein#check_update()|.
@ -547,7 +596,7 @@ g:dein#install_process_timeout
g:dein#install_progress_type
The output type of the progress bar in the installer.
Note: If you want to display the progress in the 'statusline',
you should use |dein#get_progress()| .
you should use |dein#get_progress()|.
"none":
Disabled.
@ -558,6 +607,8 @@ g:dein#install_progress_type
"title":
Displayed in the 'titlestring'.
Note: It is neovim only support
"floating":
Displayed in the floating/popup window.
Defaults: "echo"
@ -601,9 +652,9 @@ g:dein#notification_icon
*g:dein#notification_time*
g:dein#notification_time
This is the time the notification should be displayed in
seconds. For Linux and Windows only.
milli seconds.
Default: 2
Default: 2000
*g:dein#plugin*
g:dein#plugin
@ -715,6 +766,8 @@ merged (Bool)
If set to v:false, dein doesn't merge the plugin directory.
It is useful for the plugin files conflicts.
Default: See |dein-merge|.
*dein-options-merge_ftdetect*
merge_ftdetect (Bool)
If set to v:true, dein merge the plugin "ftdetect" directory.
@ -744,6 +797,8 @@ normalized_name (String)
denite.nvim denite
dein.vim dein
vim-quickrun quickrun
dps-dial dial
denops-foo foo
<
*dein-options-on_cmd*
on_cmd (List) or (String)
@ -783,7 +838,11 @@ on_lua (List) or (String)
If it is matched to the required lua module root, dein will
call |dein#source()|.
Note: It is for neovim only.
Note: It does not work for neovim standard modules.
Note: It does not work for neovim standard modules and require
in |vim.loop| modules.
Note: You cannot require on_lua plugins in
|dein-options-hook_add|. Because the plugins are not
initialized.
*dein-options-on_map*
on_map (Dictionary) or (List) or (String)
@ -953,9 +1012,7 @@ hook_add (String) or (Function)
<
*dein-options-hook_done_update*
hook_done_update (String) or (Function)
It is executed after are updated and before
|dein-options-build|.
Note: The plugin may not be sourced.
It is executed after plugins are sourced and updated.
*dein-options-hook_post_source*
hook_post_source (String) or (Function)
@ -968,7 +1025,9 @@ hook_post_source (String) or (Function)
<
*dein-options-hook_post_update*
hook_post_update (String) or (Function)
It is executed after plugins are sourced and updated.
It is executed after are updated and before
|dein-options-build|.
Note: The plugin may not be sourced.
*dein-options-hook_source*
hook_source (String) or (Function)
@ -1068,6 +1127,13 @@ TOML *dein-toml*
hook_add = ''
'''
==============================================================================
DDU SOURCES *dein-ddu-sources*
*dein-ddu-source-dein*
dein
Nominates dein plugins as candidates.
==============================================================================
UNITE SOURCES *dein-unite-sources*
@ -1411,6 +1477,9 @@ A: >
==============================================================================
COMPATIBILITY *dein-compatibility*
2022.04.20
* Use Vim/neovim standard API for notification instead of commands.
2021.09.20
* Remove "dein-options-on_i".
* Remove "dein-options-on_idle".

View File

@ -1,9 +1,3 @@
# ============================================================================
# FILE: dein.py
# AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
# License: MIT license
# ============================================================================
from .base import Base
import re
import os

View File

@ -702,7 +702,7 @@ function! s:suite.ftplugin() abort
call dein#recache_runtimepath()
call s:assert.equals(
\ readfile(dein#util#_get_runtime_path() . '/ftplugin.vim'),
\ readfile(dein#util#_get_runtime_path() . '/after/ftplugin.vim'),
\ dein#install#_get_default_ftplugin() + [
\ 'function! s:after_ftplugin()',
\ ] + split(get(g:dein#_ftplugin, '_', []), '\n') + ['endfunction'])