mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2025-01-09 09:50:26 +00:00
Some improvements
This commit is contained in:
parent
153a87d84a
commit
459c332351
38
uninstall
38
uninstall
@ -3,13 +3,25 @@
|
|||||||
remove_line() {
|
remove_line() {
|
||||||
echo "Remove from $2:"
|
echo "Remove from $2:"
|
||||||
echo " - $1"
|
echo " - $1"
|
||||||
line=$(grep -nF "$1" "$2" | sed 's/:.*//')
|
|
||||||
if [ -n "$line" ]; then
|
i=$(grep -c "$1" "$2")
|
||||||
echo " - Remove line (line #$line)"
|
if [ $i -eq 0 ]
|
||||||
awk -v n=$line 'NR == n {next} {print}' $2 > $2.bak; mv $2.bak $2
|
then
|
||||||
else
|
|
||||||
echo " - Nothing found"
|
echo " - Nothing found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
while [ $i -gt 0 ]
|
||||||
|
do
|
||||||
|
line=$(grep -m1 -nF "$1" "$2")
|
||||||
|
lineNumber=$(grep -m1 -nF "$1" "$2" | sed 's/:.*//')
|
||||||
|
if [ -n "$lineNumber" ]; then
|
||||||
|
echo " - Remove line ($line)"
|
||||||
|
awk -v n=$lineNumber 'NR == n {next} {print}' $2 > $2.bak && mv $2.bak $2
|
||||||
|
else
|
||||||
|
echo " - Nothing found"
|
||||||
|
fi
|
||||||
|
i=`expr $i - 1`
|
||||||
|
done
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,8 +38,18 @@ for shell in bash zsh; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -f ~/.config/fish/functions/fzf.fish ]
|
if [ -d ~/.config/fish/functions ]
|
||||||
then
|
then
|
||||||
rm ~/.config/fish/functions/fzf.fish
|
if [ -f ~/.config/fish/functions/fzf.fish ]
|
||||||
|
then
|
||||||
|
rm ~/.config/fish/functions/fzf.fish
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(ls -A ~/.config/fish/functions)" ]
|
||||||
|
then
|
||||||
|
echo "Can't delete non-empty directory: \"~/.config/fish/functions\""
|
||||||
|
else
|
||||||
|
rmdir ~/.config/fish/functions
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
rmdir --ignore-fail-on-non-empty ~/.config/fish/functions
|
|
||||||
|
Loading…
Reference in New Issue
Block a user