summaryrefslogtreecommitdiffstats
path: root/uninstall
diff options
context:
space:
mode:
authorAndreas Böttger <andy.boettger@gmail.com>2014-05-20 14:17:03 +0200
committerAndreas Böttger <andy.boettger@gmail.com>2014-05-20 14:17:03 +0200
commit153a87d84a0580ed81589c68dd6b818d408b33e4 (patch)
tree94cb8aa10fd4529afeaecbcb7b4796cbcd3941d0 /uninstall
parent05da892cd2ada76400a719ac8ed95d357871f759 (diff)
uninstall script
Diffstat (limited to 'uninstall')
-rwxr-xr-xuninstall33
1 files changed, 33 insertions, 0 deletions
diff --git a/uninstall b/uninstall
new file mode 100755
index 00000000..0dddc65d
--- /dev/null
+++ b/uninstall
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+remove_line() {
+ echo "Remove from $2:"
+ echo " - $1"
+ line=$(grep -nF "$1" "$2" | sed 's/:.*//')
+ if [ -n "$line" ]; then
+ echo " - Remove line (line #$line)"
+ awk -v n=$line 'NR == n {next} {print}' $2 > $2.bak; mv $2.bak $2
+ else
+ echo " - Nothing found"
+ fi
+ echo
+}
+
+for shell in bash zsh; do
+ if [ -f ~/.fzf.${shell} ]
+ then
+ rm ~/.fzf.${shell}
+ fi
+ remove_line "source ~/.fzf.${shell}" ~/.${shell}rc
+ bind_file="~/.config/fish/functions/fish_user_key_bindings.fish"
+ if [ -f $bind_file ]
+ then
+ remove_line "fzf_key_bindings" "$bind_file"
+ fi
+done
+
+if [ -f ~/.config/fish/functions/fzf.fish ]
+then
+ rm ~/.config/fish/functions/fzf.fish
+fi
+rmdir --ignore-fail-on-non-empty ~/.config/fish/functions