install.sh 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. installnode() {
  27. echo "Installing node..."
  28. [ "$(uname)" == "Darwin" ] && installnodemac
  29. [ -n "$(uname -a | grep Ubuntu)" ] && installnodeubuntu
  30. [ -f "/etc/arch-release" ] && installnodearch
  31. [ -f "/etc/artix-release" ] && installnodearch
  32. [ -f "/etc/fedora-release" ] && installnodefedora
  33. [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
  34. sudo npm i -g neovim
  35. }
  36. installpiponmac() {
  37. sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  38. python3 get-pip.py
  39. rm get-pip.py
  40. }
  41. installpiponubuntu() {
  42. sudo apt install python3-pip >/dev/null
  43. }
  44. installpiponarch() {
  45. pacman -S python-pip
  46. }
  47. installpiponfedora() {
  48. sudo dnf install -y pip >/dev/nul
  49. }
  50. installpip() {
  51. echo "Installing pip..."
  52. [ "$(uname)" == "Darwin" ] && installpiponmac
  53. [ -n "$(uname -a | grep Ubuntu)" ] && installpiponubuntu
  54. [ -f "/etc/arch-release" ] && installpiponarch
  55. [ -f "/etc/fedora-release" ] && installpiponfedora
  56. [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
  57. }
  58. installpynvim() {
  59. echo "Installing pynvim..."
  60. pip3 install pynvim --user
  61. }
  62. installpacker() {
  63. git clone https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
  64. }
  65. cloneconfig() {
  66. echo "Cloning LunarVim configuration"
  67. git clone https://github.com/ChristianChiarulli/lunarvim.git ~/.config/nvim
  68. # mv $HOME/.config/nvim/init.lua $HOME/.config/nvim/init.lua.tmp
  69. # mv $HOME/.config/nvim/utils/init.lua $HOME/.config/nvim/init.lua
  70. nvim -u $HOME/.config/nvim/init.lua +PackerInstall
  71. # rm $HOME/.config/nvim/init.lua
  72. # mv $HOME/.config/nvim/init.lua.tmp $HOME/.config/nvim/init.lua
  73. }
  74. asktoinstallnode() {
  75. echo "node not found"
  76. echo -n "Would you like to install node now (y/n)? "
  77. read answer
  78. [ "$answer" != "${answer#[Yy]}" ] && installnode
  79. }
  80. asktoinstallpip() {
  81. # echo "pip not found"
  82. # echo -n "Would you like to install pip now (y/n)? "
  83. # read answer
  84. # [ "$answer" != "${answer#[Yy]}" ] && installpip
  85. echo "Please install pip3 before continuing with install"
  86. exit
  87. }
  88. installonmac() {
  89. brew install ripgrep fzf ranger
  90. npm install -g tree-sitter-cli
  91. }
  92. pipinstallueberzug() {
  93. which pip3 >/dev/null && pip3 install ueberzug || echo "Not installing ueberzug pip not found"
  94. }
  95. installonubuntu() {
  96. sudo apt install ripgrep fzf ranger
  97. sudo apt install libjpeg8-dev zlib1g-dev python-dev python3-dev libxtst-dev
  98. pip3 install ueberzug
  99. pip3 install neovim-remote
  100. npm install -g tree-sitter-cli
  101. }
  102. installonarch() {
  103. sudo pacman -S ripgrep fzf ranger
  104. which yay >/dev/null && yay -S python-ueberzug-git || pipinstallueberzug
  105. pip3 install neovim-remote
  106. npm install -g tree-sitter-cli
  107. }
  108. installonfedora() {
  109. sudo dnf groupinstall "X Software Development"
  110. sudo dnf install -y fzf ripgrep ranger
  111. pip3 install wheel ueberzug
  112. }
  113. installextrapackages() {
  114. [ "$(uname)" == "Darwin" ] && installonmac
  115. [ -n "$(uname -a | grep Ubuntu)" ] && installonubuntu
  116. [ -f "/etc/arch-release" ] && installonarch
  117. [ -f "/etc/artix-release" ] && installonarch
  118. [ -f "/etc/fedora-release" ] && installonfedora
  119. [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
  120. }
  121. # Welcome
  122. echo 'Installing LunarVim'
  123. # move old nvim directory if it exists
  124. [ -d "$HOME/.config/nvim" ] && moveoldnvim
  125. # install pip
  126. which pip3 >/dev/null && echo "pip installed, moving on..." || asktoinstallpip
  127. # install node and neovim support
  128. which node >/dev/null && echo "node installed, moving on..." || asktoinstallnode
  129. # install pynvim
  130. pip3 list | grep pynvim >/dev/null && echo "pynvim installed, moving on..." || installpynvim
  131. if [ -a "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" ]; then
  132. echo 'packer already installed'
  133. else
  134. installpacker
  135. fi
  136. if [ -a "$HOME/.config/nvim/init.lua" ]; then
  137. echo 'nvcode already installed'
  138. else
  139. # clone config down
  140. cloneconfig
  141. # echo 'export PATH=$HOME/.config/nvim/utils/bin:$PATH' >>~/.zshrc
  142. # echo 'export PATH=$HOME/.config/nvcode/utils/bin:$PATH' >>~/.bashrc
  143. fi
  144. echo "I recommend you also install and activate a font from here: https://github.com/ryanoasis/nerd-fonts"
  145. # echo "I also recommend you add 'set preview_images_method ueberzug' to ~/.config/ranger/rc.conf"
  146. # echo 'export PATH=/home/$USER/.config/nvcode/utils/bin:$PATH appending to zshrc/bashrc'