vimenv

configure vim environment
git clone git://git.unixkoans.com/vimenv.git
Log | Files | Refs | Submodules

commit 58b6b583ce1eb969e380d4ce9aab18fb859c2210
parent 150879ca771f8fdbef1af3a3df90503f2ecbb516
Author: Xiaodong Xu <[email protected]>
Date:   Sun Apr 15 10:30:18 +0800

New features: edit Vim configuration and remove Vim plugins

Diffstat:
.gitmodules | 3+++
README.md | 1+
_vim/bundle/tabular | 1+
vimenv | 25+++++++++++++++++++++++--
4 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/.gitmodules b/.gitmodules @@ -22,3 +22,6 @@ [submodule "_vim/bundle/tagbar"] path = _vim/bundle/tagbar url = git://github.com/majutsushi/tagbar.git +[submodule "_vim/bundle/tabular"] + path = _vim/bundle/tabular + url = git://github.com/godlygeek/tabular.git diff --git a/README.md b/README.md @@ -0,0 +1 @@ +Configure Vim environment. diff --git a/_vim/bundle/tabular b/_vim/bundle/tabular @@ -0,0 +1 @@ +Subproject commit b7b4d8791a50013b56c2d68b6c5708c808203b54 diff --git a/vimenv b/vimenv @@ -22,8 +22,13 @@ def init end end +def edit + puts "Editing Vim configuration file" + system "vim _vimrc" +end + def add(author_slash_name) - name = author_slash_name.gsub(/^.*\/(?:vim-)?(.*)(?:\.vim)?$/, '\1') + name = author_slash_name.gsub(/^.*\/(?:vim-)?(.*?)(?:\.vim)?$/, '\1') src = 'git://github.com/' + author_slash_name + '.git' desc = '_vim/bundle/' + name @@ -37,6 +42,20 @@ def add(author_slash_name) end end +def remove(name) + path = '_vim/bundle/' + name + files = [".git/config", ".gitmodules"] + + puts "Removing #{path}" + system "git rm --cached #{path} >/dev/null" + + files.each do |file| + system "git config -f #{file} --remove-section submodule.#{path}" + end + + FileUtils.rmtree(path) +end + def update puts "Updating Vim plugins" system "git submodule foreach git pull" @@ -44,7 +63,9 @@ end opts = OptionParser.new opts.on("-i", "--init", "Initialize Vim environment") { init } -opts.on("-a", "--add NAME", "Add Vim plugins") { |val| add(val) } +opts.on("-e", "--edit", "Edit Vim configuration file") { edit } +opts.on("-a", "--add NAME", "Add Vim plugins") { |name| add(name) } +opts.on("-r", "--remove NAME", "Remove Vim plugins") { |name| remove(name) } opts.on("-u", "--update", "Update Vim plugins") { update } if ARGV.empty?