-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
setup.sh
executable file
·75 lines (65 loc) · 2.66 KB
/
setup.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
#!/bin/bash
RC='\e[0m'
RED='\e[31m'
YELLOW='\e[33m'
GREEN='\e[32m'
# Check if the home directory and linuxtoolbox folder exist, create them if they don't
LINUXTOOLBOXDIR="$HOME/linuxtoolbox"
if [[ ! -d "$LINUXTOOLBOXDIR" ]]; then
echo -e "${YELLOW}Creating linuxtoolbox directory: $LINUXTOOLBOXDIR${RC}"
mkdir -p "$LINUXTOOLBOXDIR"
echo -e "${GREEN}linuxtoolbox directory created: $LINUXTOOLBOXDIR${RC}"
fi
if [[ ! -d "$LINUXTOOLBOXDIR/neovim" ]]; then
echo -e "${YELLOW}Cloning neovim repository into: $LINUXTOOLBOXDIR/neovim${RC}"
git clone https://github.com/ChrisTitusTech/neovim "$LINUXTOOLBOXDIR/neovim"
if [[ $? -eq 0 ]]; then
echo -e "${GREEN}Successfully cloned neovim repository${RC}"
else
echo -e "${RED}Failed to clone neovim repository${RC}"
exit 1
fi
fi
cd "$LINUXTOOLBOXDIR/neovim"
# Initial Setup file for new systems
gitpath=$(pwd)
# Backup existing neovim config and install new one
mkdir -p "$LINUXTOOLBOXDIR/backup/nvim"
[ -d ~/.config/nvim ] && cp -r ~/.config/nvim "$LINUXTOOLBOXDIR/backup/nvim/config"
[ -d ~/.local/share/nvim ] && cp -r ~/.local/share/nvim "$LINUXTOOLBOXDIR/backup/nvim/local_share"
[ -d ~/.cache/nvim ] && cp -r ~/.cache/nvim "$LINUXTOOLBOXDIR/backup/nvim/cache"
rm -rf ~/.config/nvim ~/.local/share/nvim ~/.cache/nvim
# Setup Neovim config and link to linuxtoolbox
mkdir -p "$HOME/.vim/undodir"
mkdir -p "$HOME/.scripts"
ln -s "$gitpath/titus-kickstart" "$HOME/.config/nvim"
# Share system clipboard with unnamedplus
if [ -f /etc/os-release ]; then
. /etc/os-release
# Determine if Wayland or Xorg is being used
if [[ $XDG_SESSION_TYPE == "wayland" ]]; then
CLIPBOARD_PKG="wl-clipboard"
else
CLIPBOARD_PKG="xclip"
fi
case "${ID_LIKE:-$ID}" in
debian|ubuntu)
sudo apt install ripgrep fd-find $CLIPBOARD_PKG python3-venv luarocks golang-go shellcheck -y
;;
fedora)
sudo dnf install ripgrep fzf $CLIPBOARD_PKG neovim python3-virtualenv luarocks golang ShellCheck -y
;;
arch|manjaro)
sudo pacman -S ripgrep fzf $CLIPBOARD_PKG neovim python-virtualenv luarocks go shellcheck --noconfirm
;;
opensuse)
sudo zypper install ripgrep fzf $CLIPBOARD_PKG neovim python3-virtualenv luarocks go ShellCheck -y
;;
*)
echo -e "${YELLOW}Unsupported OS. Please install the following packages manually:${RC}"
echo "ripgrep, fzf, $CLIPBOARD_PKG, neovim, python3-virtualenv (or equivalent), luarocks, go, shellcheck"
;;
esac
else
echo -e "${RED}Unable to determine OS. Please install required packages manually.${RC}"
fi