From 7d9bdc2469f418f84abc9518b01162989c894ece Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Mon, 30 Apr 2012 23:03:48 -0500 Subject: [PATCH] Updated Rakefile, added reload! alias --- Rakefile | 16 +++++----------- zsh/zshrc.symlink | 5 ++++- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Rakefile b/Rakefile index 318fdca..911a055 100644 --- a/Rakefile +++ b/Rakefile @@ -7,13 +7,13 @@ def linkables linkables.each do |linkable| file = linkable.split('/').last.split('.symlink').last target = "#{ENV["HOME"]}/.#{file}" - yield file, target if block_given? + yield linkable, file, target if block_given? end end desc "make a backup of all files that will be replaced (if they exist)" task :backup do - linkables do |file, target| + linkables do |linkable, file, target| if File.exists?(target) || File.symlink?(target) `mv "$HOME/.#{file}" "$HOME/.#{file}.backup"` end @@ -22,7 +22,7 @@ end desc "restore the backups" task :restore do - linkables do |file, target| + linkables do |linkable, file, target| if File.exists?("#{ENV['HOME']}/.#{file}.backup") `mv "$HOME/.#{file}.backup" "$HOME/.#{file}"` end @@ -31,20 +31,14 @@ end desc "create all the symlinks" task :install do - linkables = Dir.glob('*/**{.symlink}') - - linkables.each do |linkable| - file = linkable.split('/').last.split('.symlink').last - target = "#{ENV["HOME"]}/.#{file}" + linkables do |linkable, file, target| `ln -s "$PWD/#{linkable}" "#{target}"` end end desc "remove all files added" task :uninstall do - Dir.glob('**/*.symlink').each do |linkable| - file = linkable.split('/').last.split('.symlink').last - target = "#{ENV["HOME"]}/.#{file}" + linkable do |linkable, file, target| if File.symlink?(target) FileUtils.rm(target) end diff --git a/zsh/zshrc.symlink b/zsh/zshrc.symlink index 1bfc548..bec02f5 100644 --- a/zsh/zshrc.symlink +++ b/zsh/zshrc.symlink @@ -13,11 +13,14 @@ if [[ -a ~/.localrc ]]; then source ~/.localrc fi +# reload zsh config +alias reload!='source ~/.zshrc' + # initialize autocomplete autoload -U compinit compinit -for config ($ZSH/**/completion.sh) source $config +# for config ($ZSH/**/completion.sh) source $config export EDITOR='vim'