install.sh 6.3 KB

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