install.sh 5.7 KB

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