install-nv-code.sh 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #!/bin/bash
  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. installnodearch() { \
  14. sudo pacman -S nodejs
  15. sudo pacman -S npm
  16. }
  17. installnode() { \
  18. echo "Installing node..."
  19. [ "$(uname)" == "Darwin" ] && installnodemac
  20. [ -n "$(uname -a | grep Ubuntu)" ] && installnodeubuntu
  21. [ -f "/etc/arch-release" ] && installnodearch
  22. [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
  23. sudo npm i -g neovim
  24. }
  25. installpiponmac() { \
  26. sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  27. python3 get-pip.py
  28. rm get-pip.py
  29. }
  30. installpiponubuntu() { \
  31. sudo apt install python3-pip > /dev/null
  32. }
  33. installpiponarch() { \
  34. pacman -S python-pip
  35. }
  36. installpip() { \
  37. echo "Installing pip..."
  38. [ "$(uname)" == "Darwin" ] && installpiponmac
  39. [ -n "$(uname -a | grep Ubuntu)" ] && installpiponubuntu
  40. [ -f "/etc/arch-release" ] && installpiponarch
  41. [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
  42. }
  43. installpynvim() { \
  44. echo "Installing pynvim..."
  45. pip3 install pynvim --user
  46. }
  47. cloneconfig() { \
  48. echo "Cloning NVCode configuration"
  49. git clone https://github.com/ChristianChiarulli/nvcode.git ~/.config/nvcode
  50. }
  51. asktoinstallnode() { \
  52. echo "node not found"
  53. echo -n "Would you like to install node now (y/n)? "
  54. read answer
  55. [ "$answer" != "${answer#[Yy]}" ] && installnode
  56. }
  57. asktoinstallpip() { \
  58. # echo "pip not found"
  59. # echo -n "Would you like to install pip now (y/n)? "
  60. # read answer
  61. # [ "$answer" != "${answer#[Yy]}" ] && installpip
  62. echo "Please install pip3 before continuing with install"
  63. exit
  64. }
  65. installonmac() { \
  66. brew install ripgrep fzf ranger
  67. }
  68. pipinstallueberzug() { \
  69. which pip3 > /dev/null && pip3 install ueberzug || echo "Not installing ueberzug pip not found"
  70. }
  71. installonubuntu() { \
  72. sudo apt install ripgrep fzf ranger
  73. sudo apt install libjpeg8-dev zlib1g-dev python-dev python3-dev libxtst-dev
  74. pip3 install ueberzug
  75. pip3 install neovim-remote
  76. }
  77. installonarch() { \
  78. sudo pacman -S install ripgrep fzf ranger
  79. which yay > /dev/null && yay -S python-ueberzug-git || pipinstallueberzug
  80. pip3 install neovim-remote
  81. }
  82. installextrapackages() { \
  83. [ "$(uname)" == "Darwin" ] && installonmac
  84. [ -n "$(uname -a | grep Ubuntu)" ] && installonubuntu
  85. [ -f "/etc/arch-release" ] && installonarch
  86. [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
  87. }
  88. # Welcome
  89. echo 'Installing NVCode'
  90. # install pip
  91. which pip3 > /dev/null && echo "pip installed, moving on..." || asktoinstallpip
  92. # install node and neovim support
  93. which node > /dev/null && echo "node installed, moving on..." || asktoinstallnode
  94. # install pynvim
  95. pip3 list | grep pynvim > /dev/null && echo "pynvim installed, moving on..." || installpynvim
  96. # move old nvim directory if it exists
  97. # [ -d "$HOME/.config/nvim" ] && moveoldnvim
  98. # clone config down
  99. cloneconfig
  100. echo 'export PATH=/home/$USER/.config/nvcode/utils/bin:$PATH' >> ~/.zshrc
  101. echo 'export PATH=/home/$USER/.config/nvcode/utils/bin:$PATH' >> ~/.bashrc
  102. echo "I recommend you also install and activate a font from here: https://github.com/ryanoasis/nerd-fonts"
  103. echo "I also recommend you add 'set preview_images_method ueberzug' to ~/.config/ranger/rc.conf"
  104. echo 'export PATH=/home/$USER/.config/nvcode/utils/bin:$PATH appending to zshrc/bashrc'