-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathupdate-plugins.py
executable file
·66 lines (55 loc) · 2.02 KB
/
update-plugins.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python3
import subprocess
from pathlib import Path
START = [
'https://github.com/airblade/vim-gitgutter',
'https://github.com/bronson/vim-trailing-whitespace',
'https://github.com/ctrlpvim/ctrlp.vim',
# 'https://github.com/davidhalter/jedi-vim',
'https://github.com/dense-analysis/ale',
'https://github.com/easymotion/vim-easymotion',
'https://github.com/ervandew/supertab',
'https://github.com/hashivim/vim-terraform',
'https://github.com/lilydjwg/colorizer',
'https://github.com/majutsushi/tagbar',
'https://github.com/mattn/emmet-vim',
'https://github.com/michaeljsmith/vim-indent-object',
'https://github.com/preservim/nerdtree',
'https://github.com/ruanyl/vim-gh-line',
'https://github.com/scrooloose/nerdcommenter',
'https://github.com/tell-k/vim-autopep8',
'https://github.com/tmhedberg/matchit',
'https://github.com/tpope/vim-fugitive',
'https://github.com/tpope/vim-repeat',
'https://github.com/tpope/vim-surround',
'https://github.com/vim-airline/vim-airline',
'https://github.com/vim-scripts/YankRing.vim',
'https://github.com/Yggdroot/indentLine',
]
OPT = [
'https://github.com/morhetz/gruvbox',
'https://github.com/sjl/badwolf',
'https://github.com/tomasr/molokai',
]
PACK = {
"start": START,
"opt": OPT,
}
def run_cmd(cmd, cwd='.'):
print('running cmd in {}: {}'.format(cwd, ' '.join(cmd)))
subprocess.run(cmd, cwd=cwd)
def clone_or_update_repo(root, url):
name = url.rsplit('/')[-1]
path = root / name
if path.exists():
print(f'updating {path}: {url}')
run_cmd(['git', 'pull', '--recurse-submodules'], cwd=path)
run_cmd(['git', 'submodule', 'update', '--init'], cwd=path)
else:
print(f'cloning {path}: {url}')
run_cmd(['git', 'clone', '--recursive', url, name], cwd=root)
for folder, urls in PACK.items():
root = Path(f'pack/plugins/{folder}')
root.mkdir(parents=True, exist_ok=True)
for url in urls:
clone_or_update_repo(root, url)