Created
September 4, 2018 07:38
-
-
Save fbiville/bb7a496d1c2dbb43466036485ba5a607 to your computer and use it in GitHub Desktop.
Zsh custom config in workstation-setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo | |
echo "Configuring zsh" | |
brew install grc | |
brew install coreutils | |
brew install watch | |
brew install z | |
touch ~/.z | |
brew install zsh zsh-completions | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | |
cp files/dircolors.ansi-dark ~/.dircolors | |
cp files/.inputrc ~/.inputrc | |
echo | |
echo "Customizing oh-my-zsh configuration" | |
/usr/bin/env ruby <<-EORUBY | |
def append_if_missing(subject, substring) | |
if !subject.include? substring | |
subject += "\n" + substring + "\n" | |
end | |
return subject | |
end | |
filepath = ENV['HOME'] + '/.zshrc' | |
config = File.read(filepath) | |
config = config.gsub(/plugins=\(\R\s+git\R/, "plugins=(\n\tgit mvn\n") | |
config = append_if_missing(config, "eval \"\$(direnv hook zsh)\"") | |
config = append_if_missing(config, ". /usr/local/etc/profile.d/z.sh") | |
File.open(filepath, "w") {|file| file.puts config} | |
EORUBY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment