# HG changeset patch # User Ludovic Chabant # Date 1522684906 25200 # Node ID 06a551d3fbb2d57cde44cd2a651c95fdd43a93f3 # Parent e0bb52007402402244aef81d91be66b8ea6e4251 Move vim plugin subrepos to a separate config section, support cleaning up. diff -r e0bb52007402 -r 06a551d3fbb2 install.cfg --- a/install.cfg Sun Apr 01 22:57:57 2018 -0700 +++ b/install.cfg Mon Apr 02 09:01:46 2018 -0700 @@ -1,40 +1,4 @@ [subrepos] -vim/bundle/ack = [git]https://github.com/mileszs/ack.vim.git -vim/bundle/badwolf = https://bitbucket.org/sjl/badwolf -vim/bundle/colorschemes = [git]https://github.com/ludovicchabant/vim-colorschemes.git -vim/bundle/commentary = [git]https://github.com/tpope/vim-commentary.git -vim/bundle/ctrlp = [git]https://github.com/ludovicchabant/ctrlp.vim.git -vim/bundle/ctrlp-py-matcher = [git]https://github.com/ludovicchabant/ctrlp-py-matcher.git -vim/bundle/easymotion = [git]https://github.com/Lokaltog/vim-easymotion.git -vim/bundle/fish = [git]https://github.com/dag/vim-fish.git -vim/bundle/fugitive = [git]https://github.com/tpope/vim-fugitive.git -vim/bundle/goyo = [git]https://github.com/junegunn/goyo.vim.git -vim/bundle/gundo = https://bitbucket.org/sjl/gundo.vim -vim/bundle/gutentags = https://bitbucket.org/ludovicchabant/vim-gutentags -vim/bundle/interestingwords = [git]https://github.com/vasconcelloslf/vim-interestingwords.git -vim/bundle/jinja = [git]https://github.com/mitsuhiko/vim-jinja.git -vim/bundle/lawrencium = https://bitbucket.org/ludovicchabant/vim-lawrencium -vim/bundle/less = [git]https://github.com/groenewege/vim-less.git -vim/bundle/lightline = [git]https://github.com/itchyny/lightline.vim.git -vim/bundle/linediff = [git]https://github.com/AndrewRadev/linediff.vim.git -vim/bundle/markdown = [git]https://github.com/tpope/vim-markdown.git -vim/bundle/nerdtree = [git]https://github.com/scrooloose/nerdtree.git -vim/bundle/pathogen = [git]https://github.com/tpope/vim-pathogen.git -vim/bundle/piecrust = https://bitbucket.org/ludovicchabant/vim-piecrust -vim/bundle/projectroot = [git]https://github.com/dbakker/vim-projectroot.git -vim/bundle/python-pep8-indent = [git]https://github.com/hynek/vim-python-pep8-indent.git -vim/bundle/pythonmode = [git]https://github.com/klen/python-mode.git -vim/bundle/repeat = [git]https://github.com/tpope/vim-repeat.git -vim/bundle/scratch = [git]https://github.com/mtth/scratch.vim.git -vim/bundle/sleuth = [git]https://github.com/tpope/vim-sleuth.git -vim/bundle/solarized = [git]https://github.com/altercation/vim-colors-solarized.git -vim/bundle/supertab = [git]https://github.com/ervandew/supertab.git -vim/bundle/surround = [git]https://github.com/tpope/vim-surround.git -vim/bundle/syntastic = [git]https://github.com/scrooloose/syntastic.git -vim/bundle/tagbar = [git]https://github.com/majutsushi/tagbar.git -vim/bundle/todo.txt = [git]https://github.com/freitass/todo.txt-vim.git -vim/bundle/yankring = [git]https://github.com/vim-scripts/YankRing.vim.git - lib/fish/virtualfish = [git]https://github.com/adambrenecki/virtualfish.git lib/hg/allpaths = https://bitbucket.org/ludovicchabant/allpaths @@ -53,6 +17,44 @@ lib/mutt/mutt-colors-solarized = [git]https://github.com/altercation/mutt-colors-solarized +[vimbundles] +ack = [git]https://github.com/mileszs/ack.vim.git +badwolf = https://bitbucket.org/sjl/badwolf +colorschemes = [git]https://github.com/ludovicchabant/vim-colorschemes.git +commentary = [git]https://github.com/tpope/vim-commentary.git +ctrlp = [git]https://github.com/ludovicchabant/ctrlp.vim.git +ctrlp-py-matcher = [git]https://github.com/ludovicchabant/ctrlp-py-matcher.git +easymotion = [git]https://github.com/Lokaltog/vim-easymotion.git +fish = [git]https://github.com/dag/vim-fish.git +fugitive = [git]https://github.com/tpope/vim-fugitive.git +goyo = [git]https://github.com/junegunn/goyo.vim.git +gundo = https://bitbucket.org/sjl/gundo.vim +gutentags = https://bitbucket.org/ludovicchabant/vim-gutentags +interestingwords = [git]https://github.com/vasconcelloslf/vim-interestingwords.git +jinja = [git]https://github.com/mitsuhiko/vim-jinja.git +lawrencium = https://bitbucket.org/ludovicchabant/vim-lawrencium +less = [git]https://github.com/groenewege/vim-less.git +lightline = [git]https://github.com/itchyny/lightline.vim.git +linediff = [git]https://github.com/AndrewRadev/linediff.vim.git +markdown = [git]https://github.com/tpope/vim-markdown.git +nerdtree = [git]https://github.com/scrooloose/nerdtree.git +pathogen = [git]https://github.com/tpope/vim-pathogen.git +piecrust = https://bitbucket.org/ludovicchabant/vim-piecrust +projectroot = [git]https://github.com/dbakker/vim-projectroot.git +python-pep8-indent = [git]https://github.com/hynek/vim-python-pep8-indent.git +pythonmode = [git]https://github.com/klen/python-mode.git +repeat = [git]https://github.com/tpope/vim-repeat.git +scratch = [git]https://github.com/mtth/scratch.vim.git +sleuth = [git]https://github.com/tpope/vim-sleuth.git +solarized = [git]https://github.com/altercation/vim-colors-solarized.git +supertab = [git]https://github.com/ervandew/supertab.git +surround = [git]https://github.com/tpope/vim-surround.git +syntastic = [git]https://github.com/scrooloose/syntastic.git +tagbar = [git]https://github.com/majutsushi/tagbar.git +todo.txt = [git]https://github.com/freitass/todo.txt-vim.git +yankring = [git]https://github.com/vim-scripts/YankRing.vim.git + + [mactools] asciinema = ccat = diff -r e0bb52007402 -r 06a551d3fbb2 install.py --- a/install.py Sun Apr 01 22:57:57 2018 -0700 +++ b/install.py Mon Apr 02 09:01:46 2018 -0700 @@ -65,6 +65,15 @@ fp.write('\n') +def _on_rmtree_err(func, name, excinfo): + os.chmod(name, stat.S_IWUSR | stat.S_IWGRP) + os.remove(name) + + +def rmtree(dirpath): + shutil.rmtree(dirpath, onerror=_on_rmtree_err) + + def only_on_nix(f): @functools.wraps(f) def decorator(*args, **kwargs): @@ -119,7 +128,9 @@ ['source %s' % _p('fish', 'config.fish')]) -def install_vim(): +@needs_config +@supports_forcing +def install_vim(cfg, force=False): vimrc_path = '~/.vimrc' if is_windows: vimrc_path = '~/_vimrc' @@ -128,6 +139,25 @@ 'source %s' % nixslash(_p('vim', 'vimrc')) ]) + if cfg.has_section('vimbundles'): + bundle_dir = _p('vim', 'bundle') + os.makedirs(bundle_dir, exist_ok=True) + existing_plugins = set(os.listdir(bundle_dir)) + + for name, url in cfg.items('vimbundles'): + path = os.path.join(bundle_dir, name) + if url.startswith('[git]'): + clone_git(url[len('[git]'):], path, force=force) + else: + clone_hg(url, path, force=force) + + existing_plugins.discard(name) + + for name in existing_plugins: + print("Removing plugin %s" % name) + path = os.path.join(bundle_dir, name) + rmtree(path) + @run_priority(2) # Needs to run before `fish`. def install_mercurial():