install.sh 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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 \
  91. +'autocmd User PackerComplete sleep 100m | write ~/.config/nvim/packer.install.result | qall' \
  92. +PackerInstall \
  93. nvim \
  94. +'autocmd User PackerComplete sleep 100m | write ~/.config/nvim/packer.compile.result | qall' \
  95. +PackerCompile \
  96. cat ~/.config/nvim/packer.result | rg -v 'Press'
  97. # nvim +PackerCompile +PackerInstall
  98. # rm $HOME/.config/nvim/init.lua
  99. # mv $HOME/.config/nvim/init.lua.tmp $HOME/.config/nvim/init.lua
  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. # move old nvim directory if it exists
  157. [ -d "$HOME/.config/nvim" ] && moveoldnvim
  158. # install pip
  159. which pip3 >/dev/null && echo "pip installed, moving on..." || asktoinstallpip
  160. # install node and neovim support
  161. which node >/dev/null && echo "node installed, moving on..." || asktoinstallnode
  162. # install pynvim
  163. pip3 list | grep pynvim >/dev/null && echo "pynvim installed, moving on..." || installpynvim
  164. if [ -e "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" ]; then
  165. echo 'packer already installed'
  166. else
  167. installpacker
  168. fi
  169. if [ -e "$HOME/.config/nvim/init.lua" ]; then
  170. echo 'LunarVim already installed'
  171. else
  172. # clone config down
  173. cloneconfig
  174. # echo 'export PATH=$HOME/.config/nvim/utils/bin:$PATH' >>~/.zshrc
  175. # echo 'export PATH=$HOME/.config/lunarvim/utils/bin:$PATH' >>~/.bashrc
  176. fi
  177. echo "I recommend you also install and activate a font from here: https://github.com/ryanoasis/nerd-fonts"
  178. # echo "I also recommend you add 'set preview_images_method ueberzug' to ~/.config/ranger/rc.conf"
  179. # echo 'export PATH=/home/$USER/.config/lunarvim/utils/bin:$PATH appending to zshrc/bashrc'