-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnivim.sh
executable file
·74 lines (59 loc) · 1.51 KB
/
nivim.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
#!/bin/bash
# List of binaries
binaries=("rg" "make" "node")
is_continue=true
# Loop through the list
for binary in "${binaries[@]}"
do
# Check if binary is installed
if ! which $binary &> /dev/null
then
echo "$binary is not installed."
is_continue=false
fi
done
if [ "$is_continue" = false ]; then
echo "please install missing binaries"
exit 1
fi
echo starting...
dest_dir=$HOME/.local/bin
mkdir -p $HOME/.config/nvim
cp init.lua $HOME/.config/nvim
cp cheatsheet.md $HOME/.config/nvim
chmod u+x lazygit
chmod u+x lazydocker
chmod u+x nvim.appimage
mkdir -p $dest_dir
cp lazygit $dest_dir
cp lazydocker $dest_dir
if [ ! -d "$dest_dir/squashfs-root" ]; then
echo extracting squashfs...
./nvim.appimage --appimage-extract &>/dev/null
mv squashfs-root $dest_dir
fi
# check if the shell is zsh or bash
if [ $SHELL = "/bin/zsh" ]
then
rc_file=~/.zshrc
else
rc_file=~/.bashrc
fi
grep -i $dest_dir $rc_file &>/dev/null
if [ $? -ne 0 ]; then
echo adding $dest_dir to .bashrc...
echo "export PATH=\$PATH:$dest_dir" >> $rc_file
fi
grep -i $dest_dir/squashfs-root/usr/bin $rc_file &>/dev/null
if [ $? -ne 0 ]; then
echo adding squashfs to .bashrc...
echo "export PATH=\$PATH:$dest_dir/squashfs-root/usr/bin" >> $rc_file
fi
grep nivim $rc_file &>/dev/null
if [ $? -ne 0 ]; then
echo adding nivim alias to .bashrc...
echo "alias nivim=nvim" >> $rc_file
fi
pip freeze | grep pyright== &> /dev/null || pip install pyright
pip freeze | grep black== &> /dev/null || pip install black
echo done