install.sh 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. #!/bin/sh
  2. #Set Variable to master is not set differently
  3. LVBRANCH="${LVBRANCH:-master}"
  4. set -o nounset # error when referencing undefined variable
  5. set -o errexit # exit when command fails
  6. installnodemac() {
  7. brew install lua
  8. brew install node
  9. brew install yarn
  10. }
  11. installnodeubuntu() {
  12. sudo apt install nodejs
  13. sudo apt install npm
  14. }
  15. moveoldnvim() {
  16. echo "Not installing LunarVim"
  17. echo "Please move your ~/.config/nvim folder before installing"
  18. exit
  19. }
  20. installnodearch() {
  21. sudo pacman -S nodejs
  22. sudo pacman -S npm
  23. }
  24. installnodefedora() {
  25. sudo dnf install -y nodejs
  26. sudo dnf install -y npm
  27. }
  28. installnodegentoo() {
  29. echo "Printing current node status..."
  30. emerge -pqv net-libs/nodejs
  31. echo "Make sure the npm USE flag is enabled for net-libs/nodejs"
  32. echo "If it isn't enabled, would you like to enable it with flaggie? (Y/N)"
  33. read answer
  34. [ "$answer" != "${answer#[Yy]}" ] && sudo flaggie net-libs/nodejs +npm
  35. sudo emerge -avnN net-libs/nodejs
  36. }
  37. installnode() {
  38. echo "Installing node..."
  39. [ "$(uname)" == "Darwin" ] && installnodemac
  40. [ -n "$(cat /etc/os-release | grep Ubuntu)" ] && installnodeubuntu
  41. [ -f "/etc/arch-release" ] && installnodearch
  42. [ -f "/etc/artix-release" ] && installnodearch
  43. [ -f "/etc/fedora-release" ] && installnodefedora
  44. [ -f "/etc/gentoo-release" ] && installnodegentoo
  45. [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
  46. sudo npm i -g neovim
  47. }
  48. installpiponmac() {
  49. sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  50. python3 get-pip.py
  51. rm get-pip.py
  52. }
  53. installpiponubuntu() {
  54. sudo apt install python3-pip >/dev/null
  55. }
  56. installpiponarch() {
  57. sudo pacman -S python-pip
  58. }
  59. installpiponfedora() {
  60. sudo dnf install -y pip >/dev/nul
  61. }
  62. installpipongentoo() {
  63. sudo emerge -avn dev-python/pip
  64. }
  65. installpip() {
  66. echo "Installing pip..."
  67. [ "$(uname)" == "Darwin" ] && installpiponmac
  68. [ -n "$(cat /etc/os-release | grep Ubuntu)" ] && installpiponubuntu
  69. [ -f "/etc/arch-release" ] && installpiponarch
  70. [ -f "/etc/fedora-release" ] && installpiponfedora
  71. [ -f "/etc/gentoo-release" ] && installpipongentoo
  72. [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
  73. }
  74. installpynvim() {
  75. echo "Installing pynvim..."
  76. if [ -f "/etc/gentoo-release" ]; then
  77. echo "Installing using Portage"
  78. sudo emerge -avn dev-python/pynvim
  79. else
  80. pip3 install pynvim --user
  81. fi
  82. }
  83. installpacker() {
  84. git clone https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
  85. }
  86. cloneconfig() {
  87. echo "Cloning LunarVim configuration"
  88. git clone --branch $LVBRANCH https://github.com/ChristianChiarulli/lunarvim.git ~/.config/nvim
  89. cp $HOME/.config/nvim/utils/installer/lv-config.example-no-ts.lua $HOME/.config/nvim/lv-config.lua
  90. nvim --headless \
  91. +'autocmd User PackerComplete sleep 100m | qall' \
  92. +PackerInstall
  93. nvim --headless \
  94. +'autocmd User PackerComplete sleep 100m | qall' \
  95. +PackerSync
  96. echo -e "\nCompile Complete"
  97. rm $HOME/.config/nvim/lv-config.lua
  98. cp $HOME/.config/nvim/utils/installer/lv-config.example.lua $HOME/.config/nvim/lv-config.lua
  99. # nvim --headless -cq ':silent TSUpdate' -cq ':qall' >/dev/null 2>&1
  100. }
  101. asktoinstallnode() {
  102. echo "node not found"
  103. echo -n "Would you like to install node now (y/n)? "
  104. read answer
  105. [ "$answer" != "${answer#[Yy]}" ] && installnode
  106. }
  107. asktoinstallpip() {
  108. # echo "pip not found"
  109. # echo -n "Would you like to install pip now (y/n)? "
  110. # read answer
  111. # [ "$answer" != "${answer#[Yy]}" ] && installpip
  112. echo "Please install pip3 before continuing with install"
  113. exit
  114. }
  115. installonmac() {
  116. brew install ripgrep fzf ranger
  117. npm install -g tree-sitter-cli
  118. }
  119. pipinstallueberzug() {
  120. which pip3 >/dev/null && pip3 install ueberzug || echo "Not installing ueberzug pip not found"
  121. }
  122. installonubuntu() {
  123. sudo apt install ripgrep fzf ranger
  124. sudo apt install libjpeg8-dev zlib1g-dev python-dev python3-dev libxtst-dev
  125. pip3 install ueberzug
  126. pip3 install neovim-remote
  127. npm install -g tree-sitter-cli
  128. }
  129. installonarch() {
  130. sudo pacman -S ripgrep fzf ranger
  131. which yay >/dev/null && yay -S python-ueberzug-git || pipinstallueberzug
  132. pip3 install neovim-remote
  133. npm install -g tree-sitter-cli
  134. }
  135. installonfedora() {
  136. sudo dnf groupinstall "X Software Development"
  137. sudo dnf install -y fzf ripgrep ranger
  138. pip3 install wheel ueberzug
  139. }
  140. installongentoo() {
  141. sudo emerge -avn sys-apps/ripgrep app-shells/fzf app-misc/ranger dev-python/neovim-remote virtual/jpeg sys-libs/zlib
  142. pipinstallueberzug
  143. npm install -g tree-sitter-cli
  144. }
  145. installextrapackages() {
  146. [ "$(uname)" == "Darwin" ] && installonmac
  147. [ -n "$(cat /etc/os-release | grep Ubuntu)" ] && installonubuntu
  148. [ -f "/etc/arch-release" ] && installonarch
  149. [ -f "/etc/artix-release" ] && installonarch
  150. [ -f "/etc/fedora-release" ] && installonfedora
  151. [ -f "/etc/gentoo-release" ] && installongentoo
  152. [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
  153. }
  154. # Welcome
  155. echo 'Installing LunarVim'
  156. if [[ $* == *--overwrite* ]]; then
  157. echo '!!Warning!! -> Removing all nvim related config because of the --overwrite flag'
  158. rm -rf "$HOME/.config/nvim"
  159. rm -rf "$HOME/.cache/nvim"
  160. rm -rf "$HOME/.local/share/nvim/site/pack/packer"
  161. fi
  162. # move old nvim directory if it exists
  163. [ -d "$HOME/.config/nvim" ] && moveoldnvim
  164. # install pip
  165. which pip3 >/dev/null && echo "pip installed, moving on..." || asktoinstallpip
  166. # install node and neovim support
  167. which node >/dev/null && echo "node installed, moving on..." || asktoinstallnode
  168. # install pynvim
  169. pip3 list | grep pynvim >/dev/null && echo "pynvim installed, moving on..." || installpynvim
  170. if [ -e "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" ]; then
  171. echo 'packer already installed'
  172. else
  173. installpacker
  174. fi
  175. if [ -e "$HOME/.config/nvim/init.lua" ]; then
  176. echo 'LunarVim already installed'
  177. else
  178. # clone config down
  179. cloneconfig
  180. # echo 'export PATH=$HOME/.config/nvim/utils/bin:$PATH' >>~/.zshrc
  181. # echo 'export PATH=$HOME/.config/lunarvim/utils/bin:$PATH' >>~/.bashrc
  182. fi
  183. echo "I recommend you also install and activate a font from here: https://github.com/ryanoasis/nerd-fonts"
  184. # echo "I also recommend you add 'set preview_images_method ueberzug' to ~/.config/ranger/rc.conf"
  185. # echo 'export PATH=/home/$USER/.config/lunarvim/utils/bin:$PATH appending to zshrc/bashrc'