Diff
1diff --git a/README.textile b/README.textile
2index f09feec0e1e0412bdff9da4d240c6353de3c10f3..d7169c39468c50c71495e7e8cf14652abcec5f65 100644
3--- a/README.textile
4+++ b/README.textile
5@@ -41,6 +41,10 @@ TODO: Update this..
6 * Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@.
7 * much much more..
8
9+h3. Uninstalling
10+
11+If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command line and it'll remove itself and revert you to bash (or your previous zsh config).
12+
13 h2. Thanks
14
15 * Rick Olsen (technoweenie) might remember some of the configuration, which I took from a pastie a few years ago.
16diff --git a/functions.zsh b/functions.zsh
17index 1f2a2023c4cbe33a4c2c1cb3230ab7ad0254a715..2ce91c964bf40e59e844916c9a54c7bf56a797b0 100644
18--- a/functions.zsh
19+++ b/functions.zsh
20@@ -26,4 +26,8 @@ function remote_console() {
21
22 function zsh_stats() {
23 history | awk '{print $2}' | sort | uniq -c | sort -rn | head
24+}
25+
26+function uninstall_oh_my_zsh() {
27+ /bin/sh $ZSH/tools/uninstall.sh
28 }
29diff --git a/tools/uninstall.sh b/tools/uninstall.sh
30new file mode 100644
31index 0000000000000000000000000000000000000000..8ff58332272b2410e3fb25beb18f638771391ffe
32--- /dev/null
33+++ b/tools/uninstall.sh
34@@ -0,0 +1,20 @@
35+echo "Removing ~/.oh-my-zsh"
36+if [[ -d ~/.oh-my-zsh ]]
37+then
38+ rm -rf ~/.oh-my-zsh
39+fi
40+
41+echo "Looking for an existing zsh config..."
42+if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]
43+then
44+ echo "Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh";
45+ rm ~/.zshrc;
46+ cp ~/.zshrc.pre-oh-my-zsh ~/.zshrc;
47+ source ~/.zshrc;
48+else
49+ echo "Switching back to bash"
50+ chsh -s /bin/bash
51+ source /etc/profile
52+fi
53+
54+echo "Thanks for trying out Oh My Zsh. It's been uninstalled."