-
Notifications
You must be signed in to change notification settings - Fork 3
/
install-fzf
31 lines (26 loc) · 1.12 KB
/
install-fzf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# install-fzf
# Utilties - Install fzf – CLI fuzzy finder
# Install fzf – CLI fuzzy finder. Git clone installation – run as user which will be using script
echo -e "Running: Utilties - Install fzf – CLI fuzzy finder - ./scripts/install-fzf"
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf &&
~/.fzf/install --all &&
# Install silversearch - more powerfull searcher
sudo apt-get install -y silversearcher-ag &&
# Add fzf-ag support in .bashrc file
echo -e "export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -g \"\"'
export FZF_CTRL_T_COMMAND='ag --hidden --ignore .git -g \"\"'
export FZF_ALT_C_COMMAND='find . -type d -iname \"*\"'" >> ~/.bashrc &&
source ~/.bashrc &&
# Create upgrade command in .git_upgrades directory
mkdir -p ~/.git_upgrades &&
echo "cd ~/.fzf && git pull && ./install" > ~/.git_upgrades/fzf.upgrade &&
chmod +x ~/.git_upgrades/fzf.upgrade &&
# Add crontab job to auto upgrade once a week - "At 00:00 on Monday."
crontab -l | { cat; echo "0 0 * * 1 bash ~/.git_upgrades/fzf.upgrade"; } | crontab -
if [ $? -eq 0 ]; then
echo -e "\\nOK\\n"
exit 0
else
echo -e "\\nFAIL\\n"
exit 1
fi