Commit ad96cd85ef0e0b41e178ad42408cb8dc57420896
Exists in
master
and in
2 other branches
Merge commit 'ed37aae5b4821f1a2fc47001d888f889eda8e8ad' into dev
Showing 116 changed files Side-by-side Diff
- README.markdown
- lib/clipboard.zsh
- lib/compfix.zsh
- lib/completion.zsh
- lib/diagnostics.zsh
- lib/functions.zsh
- lib/git.zsh
- lib/grep.zsh
- lib/misc.zsh
- lib/termsupport.zsh
- lib/theme-and-appearance.zsh
- oh-my-zsh.sh
- plugins/atom/README.md
- plugins/atom/atom.plugin.zsh
- plugins/autoenv/autoenv.plugin.zsh
- plugins/autojump/autojump.plugin.zsh
- plugins/aws/aws.plugin.zsh
- plugins/bgnotify/bgnotify.plugin.zsh
- plugins/capistrano/_capistrano
- plugins/capistrano/capistrano.plugin.zsh
- plugins/chruby/chruby.plugin.zsh
- plugins/chucknorris/chucknorris.plugin.zsh
- plugins/chucknorris/fortunes/chucknorris
- plugins/codeclimate/_codeclimate
- plugins/coffee/README.md
- plugins/coffee/coffee.plugin.zsh
- plugins/colored-man-pages/colored-man-pages.plugin.zsh
- plugins/colored-man/colored-man.plugin.zsh
- plugins/copydir/copydir.plugin.zsh
- plugins/copyfile/copyfile.plugin.zsh
- plugins/docker/_docker
- plugins/ember-cli/README.md
- plugins/ember-cli/ember-cli.plugin.zsh
- plugins/emoji/emoji-char-definitions.zsh
- plugins/emoji/emoji.plugin.zsh
- plugins/emoji/update_emoji.pl
- plugins/emotty/emotty.plugin.zsh
- plugins/emotty/emotty_emoji_set.zsh
- plugins/emotty/emotty_floral_set.zsh
- plugins/emotty/emotty_love_set.zsh
- plugins/emotty/emotty_nature_set.zsh
- plugins/emotty/emotty_stellar_set.zsh
- plugins/emotty/emotty_zodiac_set.zsh
- plugins/encode64/encode64.plugin.zsh
- plugins/fancy-ctrl-z/README.md
- plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh
- plugins/fedora/README.md
- plugins/fedora/fedora.plugin.zsh
- plugins/frontend-search/README.md
- plugins/frontend-search/_frontend-search.sh
- plugins/frontend-search/frontend-search.plugin.zsh
- plugins/git-extras/README.md
- plugins/git-extras/git-extras.plugin.zsh
- plugins/git-flow/git-flow.plugin.zsh
- plugins/git-hubflow/git-hubflow.plugin.zsh
- plugins/git-prompt/git-prompt.plugin.zsh
- plugins/git-prompt/gitstatus.py
- plugins/git/git.plugin.zsh
- plugins/gnu-utils/gnu-utils.plugin.zsh
- plugins/golang/golang.plugin.zsh
- plugins/golang/templates/package.txt
- plugins/golang/templates/search.txt
- plugins/gradle/gradle.plugin.zsh
- plugins/gulp/gulp.plugin.zsh
- plugins/heroku/_heroku
- plugins/jira/README.md
- plugins/jira/_jira
- plugins/jira/jira.plugin.zsh
- plugins/man/man.zsh
- plugins/nmap/README.md
- plugins/nmap/nmap.plugin.zsh
- plugins/npm/npm.plugin.zsh
- plugins/osx/osx.plugin.zsh
- plugins/pyenv/pyenv.plugin.zsh
- plugins/rails/rails.plugin.zsh
- plugins/rand-quote/rand-quote.plugin.zsh
- plugins/rbenv/rbenv.plugin.zsh
- plugins/rvm/rvm.plugin.zsh
- plugins/scw/README.md
- plugins/scw/_scw
- plugins/spring/README.md
- plugins/spring/_spring
- plugins/stack/stack.plugin.zsh
- plugins/sublime/sublime.plugin.zsh
- plugins/sudo/sudo.plugin.zsh
- plugins/svn/svn.plugin.zsh
- plugins/symfony2/symfony2.plugin.zsh
- plugins/systemadmin/systemadmin.plugin.zsh
- plugins/systemd/systemd.plugin.zsh
- plugins/taskwarrior/README.md
- plugins/taskwarrior/_task
- plugins/taskwarrior/taskwarrior.plugin.zsh
- plugins/terminalapp/terminalapp.plugin.zsh
- plugins/textmate/textmate.plugin.zsh
- plugins/thefuck/README.md
- plugins/thefuck/thefuck.plugin.zsh
- plugins/ubuntu/ubuntu.plugin.zsh
- plugins/vagrant/_vagrant
- plugins/vi-mode/README.md
- plugins/vim-interaction/vim-interaction.plugin.zsh
- plugins/vundle/vundle.plugin.zsh
- plugins/xcode/README.md
- plugins/xcode/_xcselv
- plugins/xcode/xcode.plugin.zsh
- themes/agnoster.zsh-theme
- themes/amuse.zsh-theme
- themes/cypher.zsh-theme
- themes/dogenpunk.zsh-theme
- themes/emotty.zsh-theme
- themes/gnzh.zsh-theme
- themes/michelebologna.zsh-theme
- themes/steeef.zsh-theme
- tools/check_for_upgrade.sh
- tools/install.sh
- tools/uninstall.sh
- tools/upgrade.sh
tools/install.sh
1 | +function main() { | |
2 | +# Use colors, but only if connected to a terminal, and that terminal | |
3 | +# supports them. | |
4 | +if which tput >/dev/null 2>&1; then | |
5 | + ncolors=$(tput colors) | |
6 | +fi | |
7 | +if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then | |
8 | + RED="$(tput setaf 1)" | |
9 | + GREEN="$(tput setaf 2)" | |
10 | + YELLOW="$(tput setaf 3)" | |
11 | + BLUE="$(tput setaf 4)" | |
12 | + BOLD="$(tput bold)" | |
13 | + NORMAL="$(tput sgr0)" | |
14 | +else | |
15 | + RED="" | |
16 | + GREEN="" | |
17 | + YELLOW="" | |
18 | + BLUE="" | |
19 | + BOLD="" | |
20 | + NORMAL="" | |
21 | +fi | |
22 | + | |
23 | +# Only enable exit-on-error after the non-critical colorization stuff, | |
24 | +# which may fail on systems lacking tput or terminfo | |
1 | 25 | set -e |
2 | 26 | |
27 | +CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l) | |
28 | +if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then | |
29 | + printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n" | |
30 | + exit | |
31 | +fi | |
32 | +unset CHECK_ZSH_INSTALLED | |
33 | + | |
3 | 34 | if [ ! -n "$ZSH" ]; then |
4 | 35 | ZSH=~/.oh-my-zsh |
5 | 36 | fi |
6 | 37 | |
7 | 38 | if [ -d "$ZSH" ]; then |
8 | - echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove $ZSH if you want to install" | |
39 | + printf "${YELLOW}You already have Oh My Zsh installed.${NORMAL}\n" | |
40 | + printf "You'll need to remove $ZSH if you want to re-install.\n" | |
9 | 41 | exit |
10 | 42 | fi |
11 | 43 | |
12 | -echo "\033[0;34mCloning Oh My Zsh...\033[0m" | |
13 | -hash git >/dev/null 2>&1 && env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { | |
14 | - echo "git not installed" | |
15 | - exit | |
44 | +# Prevent the cloned repository from having insecure permissions. Failing to do | |
45 | +# so causes compinit() calls to fail with "command not found: compdef" errors | |
46 | +# for users with insecure umasks (e.g., "002", allowing group writability). Note | |
47 | +# that this will be ignored under Cygwin by default, as Windows ACLs take | |
48 | +# precedence over umasks except for filesystems mounted with option "noacl". | |
49 | +umask g-w,o-w | |
50 | + | |
51 | +printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n" | |
52 | +hash git >/dev/null 2>&1 || { | |
53 | + echo "Error: git is not installed" | |
54 | + exit 1 | |
55 | +} | |
56 | +env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { | |
57 | + printf "Error: git clone of oh-my-zsh repo failed\n" | |
58 | + exit 1 | |
16 | 59 | } |
17 | 60 | |
18 | -echo "\033[0;34mLooking for an existing zsh config...\033[0m" | |
61 | +# The Windows (MSYS) Git is not compatible with normal use on cygwin | |
62 | +if [ "$OSTYPE" = cygwin ]; then | |
63 | + if git --version | grep msysgit > /dev/null; then | |
64 | + echo "Error: Windows/MSYS Git is not supported on Cygwin" | |
65 | + echo "Error: Make sure the Cygwin git package is installed and is first on the path" | |
66 | + exit 1 | |
67 | + fi | |
68 | +fi | |
69 | + | |
70 | +printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n" | |
19 | 71 | if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then |
20 | - echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32mBacking up to ~/.zshrc.pre-oh-my-zsh\033[0m"; | |
72 | + printf "${YELLOW}Found ~/.zshrc.${NORMAL} ${GREEN}Backing up to ~/.zshrc.pre-oh-my-zsh${NORMAL}\n"; | |
21 | 73 | mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh; |
22 | 74 | fi |
23 | 75 | |
24 | -echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m" | |
76 | +printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n" | |
25 | 77 | cp $ZSH/templates/zshrc.zsh-template ~/.zshrc |
26 | -sed -i -e "/^export ZSH=/ c\ | |
78 | +sed "/^export ZSH=/ c\ | |
27 | 79 | export ZSH=$ZSH |
28 | -" ~/.zshrc | |
80 | +" ~/.zshrc > ~/.zshrc-omztemp | |
81 | +mv -f ~/.zshrc-omztemp ~/.zshrc | |
29 | 82 | |
30 | -echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" | |
31 | -sed -i -e "/export PATH=/ c\\ | |
83 | +printf "${BLUE}Copying your current PATH and adding it to the end of ~/.zshrc for you.${NORMAL}\n" | |
84 | +sed "/export PATH=/ c\\ | |
32 | 85 | export PATH=\"$PATH\" |
33 | -" ~/.zshrc | |
86 | +" ~/.zshrc > ~/.zshrc-omztemp | |
87 | +mv -f ~/.zshrc-omztemp ~/.zshrc | |
34 | 88 | |
89 | +# If this user's login shell is not already "zsh", attempt to switch. | |
35 | 90 | TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') |
36 | 91 | if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then |
37 | - echo "\033[0;34mTime to change your default shell to zsh!\033[0m" | |
92 | + # If this platform provides a "chsh" command (not Cygwin), do it, man! | |
93 | + if hash chsh >/dev/null 2>&1; then | |
94 | + printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n" | |
38 | 95 | chsh -s $(grep /zsh$ /etc/shells | tail -1) |
96 | + # Else, suggest the user do so manually. | |
97 | + else | |
98 | + printf "I can't change your shell automatically because this system does not have chsh.\n" | |
99 | + printf "${BLUE}Please manually change your default shell to zsh!${NORMAL}\n" | |
100 | + fi | |
39 | 101 | fi |
40 | -unset TEST_CURRENT_SHELL | |
41 | - | |
42 | -echo "\033[0;32m"' __ __ '"\033[0m" | |
43 | -echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" | |
44 | -echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" | |
45 | -echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" | |
46 | -echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" | |
47 | -echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m" | |
48 | -echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m" | |
49 | -echo "\n\n \033[0;32mp.s. Follow us at http://twitter.com/ohmyzsh.\033[0m" | |
50 | -echo "\n\n \033[0;32mp.p.s. Get stickers and t-shirts at http://shop.planetargon.com.\033[0m" | |
102 | + | |
103 | +printf "${GREEN}" | |
104 | +echo ' __ __ ' | |
105 | +echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' | |
106 | +echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' | |
107 | +echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' | |
108 | +echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' | |
109 | +echo ' /____/ ....is now installed!' | |
110 | +echo '' | |
111 | +echo '' | |
112 | +echo 'Please look over the ~/.zshrc file to select plugins, themes, and options.' | |
113 | +echo '' | |
114 | +echo 'p.s. Follow us at https://twitter.com/ohmyzsh.' | |
115 | +echo '' | |
116 | +echo 'p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.' | |
117 | +echo '' | |
118 | +printf "${NORMAL}" | |
51 | 119 | env zsh |
52 | -. ~/.zshrc | |
120 | +} | |
121 | + | |
122 | +main |