Skip to content

Commit f13692c

Browse files
authored
Feat dpp support (#6)
* Add: autoload/readme_viewer/dpp.vim I created the code for `dpp.vim` based on `dein.vim`. * Update: dpp.vim support Added branch for `dpp.vim`. * Update: DppReadme command * docs: Added `dpp.vim` description. * Add: test/dpp Implemented up to downloading the plugin manager * Add: config.ts for dpp.vim * Update: Added processing up to dpp make_state * fixed: wrong config file * Update: configuration for dpp.vim * Update: Now specifies the branch you are working on. * docs: README * fix: help tag * docs: README.md
1 parent fa98ec8 commit f13692c

File tree

7 files changed

+140
-1
lines changed

7 files changed

+140
-1
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Please read [help](doc/readme_viewer.txt) for details.
1313
* [Features](#features)
1414
* [Installation](#installation)
1515
* [<a href="https://github.com/Shougo/dein.vim">dein.vim</a>](#deinvim)
16+
* [<a href="https://github.com/Shougo/dpp.vim">dpp.vim</a>](#dppvim)
1617
* [<a href="https://github.com/junegunn/vim-plug">vim-plug</a>](#vim-plug)
1718
* [<a href="https://github.com/k-takata/minpac">minpac</a>](#minpac)
1819
* [<a href="https://github.com/wbthomason/packer.nvim">packer.nvim</a>](#packernvim)
@@ -45,6 +46,7 @@ easily like vim help file. Viewing vim help file is very easy. Only
4546
If you are using other plugin managers, please try:
4647

4748
```vim
49+
:DppReadme vim-readme-viewer
4850
:PlugReadme vim-readme-viewer " for vim-plug
4951
:PackReadme vim-readme-viewer " for minpac
5052
:PackerReadme vim-readme-viewer " for packer.nvim
@@ -64,6 +66,7 @@ it outside vim.
6466

6567
- Support many plugin managers
6668
- [dein.vim](https://github.com/Shougo/dein.vim)
69+
- [dpp.vim](https://github.com/Shougo/dpp.vim)
6770
- [vim-plug](https://github.com/junegunn/vim-plug)
6871
- [minpac](https://github.com/k-takata/minpac)
6972
- [packer.nvim](https://github.com/wbthomason/packer.nvim)
@@ -93,6 +96,10 @@ let g:readme_viewer#plugin_manager = 'dein.vim'
9396
'''
9497
```
9598

99+
### [dpp.vim](https://github.com/Shougo/dpp.vim)
100+
101+
Depends on your liking configuration.
102+
96103
### [vim-plug](https://github.com/junegunn/vim-plug)
97104

98105
```vim
@@ -180,6 +187,7 @@ call ddu#start({'sources': [{'name': 'readme_viewer'}]})
180187
- [ ] runtimepath based plugin manager
181188
- [ ] buildin package system based plugin manager
182189
- [x] [dein.vim](https://github.com/Shougo/dein.vim)
190+
- [ ] [dpp.vim](https://github.com/Shougo/dpp.vim)
183191
- [x] [vim-plug](https://github.com/junegunn/vim-plug)
184192
- [x] [minpac](https://github.com/k-takata/minpac)
185193
- [x] [packer.nvim](https://github.com/wbthomason/packer.nvim)

autoload/readme_viewer.vim

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
let s:plugin_managers = {
22
\ 'dein.vim': 'dein',
3+
\ 'dpp.vim': 'dpp',
34
\ 'vim-plug': 'plug',
45
\ 'minpac': 'mimpac',
56
\ 'packer.nvim': 'packer',
@@ -11,6 +12,8 @@ let s:plugin_manager = s:plugin_managers[g:readme_viewer#plugin_manager]
1112
function! readme_viewer#open(args, mods) abort
1213
if g:readme_viewer#plugin_manager ==# 'dein.vim' || exists('*dein#begin')
1314
let funcname = 'readme_viewer#dein#open'
15+
elseif g:readme_viewer#plugin_manager ==# 'dpp.vim' || exists('*dpp#make_state')
16+
let funcname = 'readme_viewer#dpp#open'
1417
elseif g:readme_viewer#plugin_manager ==# 'vim-plug' || exists('*plug#begin')
1518
let funcname = 'readme_viewer#plug#open'
1619
elseif g:readme_viewer#plugin_manager ==# 'minpac' || exists('*minpac#init')
@@ -28,6 +31,8 @@ endfunction
2831
function! readme_viewer#completion(ArgLead, CmdLine, CursorPos) abort
2932
if g:readme_viewer#plugin_manager ==# 'dein.vim' || exists('*dein#begin')
3033
let funcname = 'readme_viewer#dein#completion'
34+
elseif g:readme_viewer#plugin_manager ==# 'dpp.vim' || exists('*dpp#make_state')
35+
let funcname = 'readme_viewer#dpp#completion'
3136
elseif g:readme_viewer#plugin_manager ==# 'vim-plug' || exists('*plug#begin')
3237
let funcname = 'readme_viewer#plug#completion'
3338
elseif g:readme_viewer#plugin_manager ==# 'minpac' || exists('*minpac#init')

autoload/readme_viewer/dpp.vim

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
function! readme_viewer#dpp#open(plugin, mods) abort
3+
let plugin = readme_viewer#dpp#get(a:plugin)
4+
if empty(plugin)
5+
call readme_viewer#error('Cannot find plugin name:', a:plugin)
6+
return
7+
endif
8+
call readme_viewer#open_buffer(plugin.path, plugin.name, a:mods)
9+
endfunction
10+
11+
function! readme_viewer#dpp#get(...) abort
12+
let plugins = a:0 > 0 ? dpp#get(a:1) : dpp#get()
13+
if empty(plugins)
14+
return {}
15+
endif
16+
if a:0 > 0
17+
return {'path': plugins.path, 'name': plugins.name}
18+
else
19+
return map(plugins, { _, val -> {'path': val.path, 'name': val.name} })
20+
endif
21+
endfunction
22+
23+
function! readme_viewer#dpp#completion(ArgLead, CmdLine, CursorPos) abort
24+
if exists('*matchfuzzy')
25+
if empty(a:ArgLead)
26+
return sort(keys(dpp#get()))
27+
else
28+
return matchfuzzy(sort(keys(dpp#get())), a:ArgLead)
29+
endif
30+
else
31+
return filter(sort(keys(dpp#get())), {_, val -> val =~? a:ArgLead})
32+
endif
33+
endfunction
34+

doc/readme_viewer.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ manager. However, it sometimes may fail. I recommend that you set manually
4040

4141
>
4242
let g:readme_viewer#plugin_manager = 'dein.vim' " for dein.vim
43+
let g:readme_viewer#plugin_manager = 'dpp.vim' " for dpp.vim
4344
let g:readme_viewer#plugin_manager = 'vim-plug' " for vim-plug
4445
let g:readme_viewer#plugin_manager = 'minpac' " for minpac
4546
let g:readme_viewer#plugin_manager = 'packer.nvim' " for packer.nvim
@@ -51,7 +52,7 @@ vim-plug's README.md, you register vim-plug as a plugin.
5152
>
5253
Plug 'junegunn/vim-plug'
5354
54-
Note: This plugin is working with |dein.vim|, |vim-plug|, |minpac|,
55+
Note: This plugin is working with |dein.vim|, |dpp|, |vim-plug|, |minpac|,
5556
|jetpack| and |packer.nvim| now.
5657

5758
==============================================================================
@@ -65,6 +66,7 @@ COMMANDS *readme-viewer-commands*
6566
automatically.
6667

6768
:DeinReadme {plugin} *:DeinReadme*
69+
:DppReadme {plugin} *:DppReadme*
6870
:PlugReadme {plugin} *:PlugReadme*
6971
:PackReadme {plugin} *:PackReadme*
7072
:PackerReadme {plugin} *:PackerReadme*
@@ -84,6 +86,7 @@ COMMANDS *readme-viewer-commands*
8486
FUNCTIONS *readme-viewer-functions*
8587

8688
*readme_viewer#dein#get()*
89+
*readme_viewer#dpp#get()*
8790
*readme_viewer#plug#get()*
8891
*readme_viewer#minpac#get()*
8992
*readme_viewer#jetpack#get()*
@@ -97,6 +100,7 @@ readme_viewer#get([{plugin-name}]) *readme_viewer#get()*
97100
manager's `get` function. Please see above.
98101

99102
*readme_viewer#dein#open()*
103+
*readme_viewer#dpp#open()*
100104
*readme_viewer#plug#open()*
101105
*readme_viewer#minpac#open()*
102106
*readme_viewer#jetpack#open()*
@@ -124,6 +128,7 @@ g:readme_viewer#plugin_manager *g:readme_viewer#plugin_manager*
124128
plugin manager. I recommend that you set it manually.
125129
value command~
126130
"|dein.vim|" |:DeinReadme|
131+
"|dpp|.vim" |:DppReadme|
127132
"|vim-plug|" |:PlugReadme|
128133
"|minpac|" |:PackReadme|
129134
"|packer.nvim|" |:PackerReadme|

plugin/readme_viewer.vim

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ let g:readme_viewer#plugin_manager = get(g:,
1313
if g:readme_viewer#plugin_manager ==# 'dein.vim' || exists('*dein#begin')
1414
command! -nargs=1 -bar -complete=customlist,readme_viewer#dein#completion
1515
\ DeinReadme call readme_viewer#dein#open(<q-args>, <q-mods>)
16+
elseif g:readme_viewer#plugin_manager ==# 'dpp.vim' || exists('*dpp#make_state')
17+
command! -nargs=1 -bar -complete=customlist,readme_viewer#plug#completion
18+
\ DppReadme call readme_viewer#dpp#open(<q-args>, <q-mods>)
1619
elseif g:readme_viewer#plugin_manager ==# 'vim-plug' || exists('*plug#begin')
1720
command! -nargs=1 -bar -complete=customlist,readme_viewer#plug#completion
1821
\ PlugReadme call readme_viewer#plug#open(<q-args>, <q-mods>)

test/dpp/config.ts

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import {
2+
BaseConfig,
3+
ConfigReturn,
4+
ContextBuilder,
5+
Dpp,
6+
Plugin,
7+
} from "https://deno.land/x/[email protected]/types.ts";
8+
import { Denops } from "https://deno.land/x/[email protected]/deps.ts";
9+
10+
export class Config extends BaseConfig {
11+
override async config(args: {
12+
denops: Denops;
13+
contextBuilder: ContextBuilder;
14+
basePath: string;
15+
dpp: Dpp;
16+
}): Promise<ConfigReturn> {
17+
args.contextBuilder.setGlobal({
18+
protocols: ["git"],
19+
});
20+
21+
const pluginList = [
22+
{
23+
lazy: false,
24+
repo: "Shougo/dpp.vim",
25+
name: "dpp.vim",
26+
},
27+
{
28+
lazy: false,
29+
repo: "Shougo/dpp-ext-installer",
30+
name: "dpp-ext-installer",
31+
},
32+
{
33+
lazy: false,
34+
repo: "Shougo/dpp-protocol-git",
35+
name: "dpp-protocol-git",
36+
},
37+
{
38+
lazy: false,
39+
repo: "vim-denops/denops.vim",
40+
name: "denops.vim",
41+
},
42+
{
43+
lazy: false,
44+
repo: "yasunori0418/vim-readme-viewer",
45+
name: "vim-readme-viewer",
46+
rev: "feat-dpp_support"
47+
},
48+
] as Plugin[];
49+
50+
return {
51+
plugins: pluginList,
52+
};
53+
}
54+
}

test/dpp/test.vimrc

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
set nocompatible
2+
3+
let s:cache = expand('<sfile>:p:h') . '/cache/dpp'
4+
let s:config = expand('<sfile>:p:h') . '/config.ts'
5+
let s:repos = [
6+
\ 'Shougo/dpp.vim',
7+
\ 'Shougo/dpp-ext-installer',
8+
\ 'Shougo/dpp-protocol-git',
9+
\ 'vim-denops/denops.vim',
10+
\ ]
11+
let g:readme_viewer#plugin_manager = 'dpp.vim'
12+
13+
if &runtimepath !~# s:cache
14+
for repo in s:repos
15+
let repo_path = s:cache . '/repos/github.com/' . repo
16+
if !isdirectory(repo_path)
17+
execute '!git clone https://github.com/' . repo
18+
\ '--depth 1 ' . repo_path
19+
endif
20+
execute 'set runtimepath^=' . repo_path
21+
endfor
22+
endif
23+
24+
if dpp#min#load_state(s:cache)
25+
call dpp#make_state(s:cache, s:config)
26+
augroup dpp_init
27+
autocmd!
28+
autocmd User Dpp:makeStatePost echomsg 'dpp make_state() is done'
29+
augroup END
30+
endif

0 commit comments

Comments
 (0)