install.sh 6.1 KB

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