install.sh 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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 rolling https://github.com/ChristianChiarulli/lunarvim.git ~/.config/nvim
  87. mv $HOME/.config/nvim/utils/installer/lv-config.example.lua $HOME/.config/nvim/lv-config.lua
  88. # mv $HOME/.config/nvim/utils/init.lua $HOME/.config/nvim/init.lua
  89. # nvim -u $HOME/.config/nvim/init.lua +PackerCompile +PackerInstall
  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. # nvim --headless \
  97. # +'autocmd User PackerComplete sleep 100m | qall' \
  98. # +PackerCompile
  99. # nvim --headless +PackerCompile
  100. echo "Compile Complete"
  101. # cat ~/.config/nvim/packer.install.result | rg -v 'Press'
  102. # nvim --headless \
  103. # +'autocmd User PackerComplete sleep 100m | write ~/.config/nvim/packer.compile.result | qall' \
  104. # +PackerCompile \
  105. # cat ~/.config/nvim/packer.compile.result | rg -v 'Press'
  106. # nvim --headless +PackerInstall
  107. # nvim +PackerCompile +PackerInstall
  108. # rm $HOME/.config/nvim/init.lua
  109. # mv $HOME/.config/nvim/init.lua.tmp $HOME/.config/nvim/init.lua
  110. }
  111. asktoinstallnode() {
  112. echo "node not found"
  113. echo -n "Would you like to install node now (y/n)? "
  114. read answer
  115. [ "$answer" != "${answer#[Yy]}" ] && installnode
  116. }
  117. asktoinstallpip() {
  118. # echo "pip not found"
  119. # echo -n "Would you like to install pip now (y/n)? "
  120. # read answer
  121. # [ "$answer" != "${answer#[Yy]}" ] && installpip
  122. echo "Please install pip3 before continuing with install"
  123. exit
  124. }
  125. installonmac() {
  126. brew install ripgrep fzf ranger
  127. npm install -g tree-sitter-cli
  128. }
  129. pipinstallueberzug() {
  130. which pip3 >/dev/null && pip3 install ueberzug || echo "Not installing ueberzug pip not found"
  131. }
  132. installonubuntu() {
  133. sudo apt install ripgrep fzf ranger
  134. sudo apt install libjpeg8-dev zlib1g-dev python-dev python3-dev libxtst-dev
  135. pip3 install ueberzug
  136. pip3 install neovim-remote
  137. npm install -g tree-sitter-cli
  138. }
  139. installonarch() {
  140. sudo pacman -S ripgrep fzf ranger
  141. which yay >/dev/null && yay -S python-ueberzug-git || pipinstallueberzug
  142. pip3 install neovim-remote
  143. npm install -g tree-sitter-cli
  144. }
  145. installonfedora() {
  146. sudo dnf groupinstall "X Software Development"
  147. sudo dnf install -y fzf ripgrep ranger
  148. pip3 install wheel ueberzug
  149. }
  150. installongentoo() {
  151. sudo emerge -avn sys-apps/ripgrep app-shells/fzf app-misc/ranger dev-python/neovim-remote virtual/jpeg sys-libs/zlib
  152. pipinstallueberzug
  153. npm install -g tree-sitter-cli
  154. }
  155. installextrapackages() {
  156. [ "$(uname)" == "Darwin" ] && installonmac
  157. [ -n "$(cat /etc/os-release | grep Ubuntu)" ] && installonubuntu
  158. [ -f "/etc/arch-release" ] && installonarch
  159. [ -f "/etc/artix-release" ] && installonarch
  160. [ -f "/etc/fedora-release" ] && installonfedora
  161. [ -f "/etc/gentoo-release" ] && installongentoo
  162. [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
  163. }
  164. # Welcome
  165. echo 'Installing LunarVim'
  166. # move old nvim directory if it exists
  167. [ -d "$HOME/.config/nvim" ] && moveoldnvim
  168. # install pip
  169. which pip3 >/dev/null && echo "pip installed, moving on..." || asktoinstallpip
  170. # install node and neovim support
  171. which node >/dev/null && echo "node installed, moving on..." || asktoinstallnode
  172. # install pynvim
  173. pip3 list | grep pynvim >/dev/null && echo "pynvim installed, moving on..." || installpynvim
  174. if [ -e "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" ]; then
  175. echo 'packer already installed'
  176. else
  177. installpacker
  178. fi
  179. if [ -e "$HOME/.config/nvim/init.lua" ]; then
  180. echo 'LunarVim already installed'
  181. else
  182. # clone config down
  183. cloneconfig
  184. # echo 'export PATH=$HOME/.config/nvim/utils/bin:$PATH' >>~/.zshrc
  185. # echo 'export PATH=$HOME/.config/lunarvim/utils/bin:$PATH' >>~/.bashrc
  186. fi
  187. echo "I recommend you also install and activate a font from here: https://github.com/ryanoasis/nerd-fonts"
  188. # echo "I also recommend you add 'set preview_images_method ueberzug' to ~/.config/ranger/rc.conf"
  189. # echo 'export PATH=/home/$USER/.config/lunarvim/utils/bin:$PATH appending to zshrc/bashrc'