-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautocfg.sh
executable file
·121 lines (104 loc) · 3.26 KB
/
autocfg.sh
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
echo "################################################################"
echo "# ⚠ WARNING ⚠ - this script is not maintained!!! #"
echo "# This script configures 'TMUX', 'ZSH', and 'NeoVIM' for Linux #"
echo "################################################################"
echo ""
echo "More info available at https://github.com/mdmfernandes/dotfiles"
echo ""
read -n 1 -s -r -p "Press any key to continue..."
# Read input flags
while test $# -gt 0; do
case "$1" in
-r | --remote)
remote=true
shift
;;
*)
break
;;
esac
done
# Config
apps=true
tmux=true
zsh=true
neovim=true
lang=true
# Helpers
exists() { # Check if a command exists
command -v "$1" >/dev/null 2>&1
}
# Applications
if [[ "$apps" = true ]]; then
echo "[+] Installing applications [git, jq, colordiff, xclip, fzf, ripgrep, bat, tree, fd pip3]..."
sudo apt install --yes --quiet git jq colordiff xclip fzf ripgrep tree fd python3-pip
sudo apt install --yes --quiet bat
# Configure git
git config --global branch.autoSetupRebase always
git config --global core.pager "less -F -X"
fi
# TMUX
if [[ "$tmux" = true ]]; then
echo ""
echo "[+] Configuring TMUX..."
if ! exists tmux; then
echo " [+] Installing TMUX..."
sudo apt install tmux --yes --quiet
fi
echo " [+] Copying TMUX configuration files..."
cp "./tmux/tmux.conf" "$HOME/.tmux.conf"
if [[ "$remote" = true ]]; then
cp "./tmux/tmux.conf.remote" "$HOME/.tmux.conf.local"
fi
echo " [+] Installing tpm..."
git clone https://github.com/tmux-plugins/tpm "$HOME/.tmux/plugins/tpm"
tmux source "$HOME/.tmux.conf"
"$HOME/.tmux/plugins/tpm/bindings/install_plugins"
fi
# ZSH
if [[ "$zsh" = true ]]; then
echo ""
echo "[+] Configuring ZSH..."
if ! exists zsh; then
echo " [+] Installing ZSH..."
sudo apt install zsh --yes --quiet
chsh -s "$(which zsh)"
fi
echo " [+] Copying ZSH configuration files..."
mkdir -p "$HOME/.config/zsh"
# shellcheck source=/dev/null
echo "ZDOTDIR=$HOME/.config/zsh" >"$HOME/.zshenv" && . "$HOME/.zshenv"
cp "./zsh/zshrc" "$ZDOTDIR/.zshrc"
cp "./zsh/aliases.zsh" "$ZDOTDIR/.aliases.zsh"
cp "./zsh/functions.zsh" "$ZDOTDIR/.functions.zsh"
cp "./zsh/custom.zsh" "$ZDOTDIR/.custom.zsh"
cp "./zsh/p10k.zsh" "$ZDOTDIR/.p10k.zsh"
# shellcheck source=/dev/null
source "$ZDOTDIR/.zshrc" 2>/dev/null
echo " [+] Installing custom plugins..."
ZSH_SHARE="$HOME/.local/share/zsh"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_SHARE}/themes/powerlevel10k"
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "${ZSH_SHARE}/plugins/zsh-syntax-highlighting"
git clone https://github.com/zsh-users/zsh-autosuggestions "${ZSH_SHARE}/plugins/zsh-autosuggestions"
curl curl -sS https://webinstall.dev/zoxide | bash
fi
# NeoVim
if [[ "$neovim" = true ]]; then
echo ""
echo "[+] Configuring NeoVim..."
if ! exists nvim; then
echo " [+] Installing NeoVim..."
sudo apt install neovim --yes --quiet
fi
echo " [+] Copying NeoVIM configuration files..."
cp -r ./nvim "$HOME/.config"
fi
if [[ "$lang" = true ]]; then
echo ""
echo "[+] Configuring linters, formatters, and type checkers..."
pip3 install pylint flake8 black mypy
cp -r ./lang/python/ "$HOME/.config"
cp ./lang/stylua.toml "$HOME/.config"
cp ./lang/markdownlint.yaml "$HOME/.config"
fi