vim-prettier: install node if missing
authorAJ ONeal <aj@therootcompany.com>
Mon, 22 Mar 2021 21:26:23 +0000 (21:26 +0000)
committerAJ ONeal <aj@therootcompany.com>
Wed, 24 Mar 2021 17:51:50 +0000 (17:51 +0000)
vim-prettier/install.sh

index 50387ab92b67ee3598a3bfbba64407ffec524e13..eebd1fa56126d779a44a92d18cb07905b4d09974 100644 (file)
@@ -8,6 +8,10 @@ function __init_vim_prettier() {
     rm -rf "$HOME/.vim/pack/plugins/start/vim-prettier"
     git clone --depth=1 https://github.com/prettier/vim-prettier.git "$HOME/.vim/pack/plugins/start/vim-prettier"
 
+    if [ -z "$(command -v node)" ]; then
+      export PATH="$HOME/.local/opt/node/bin:$HOME/.local/bin:${PATH}"
+      webi node
+    fi
     npm install -g prettier@2
 
     if [ ! -f "$HOME/.vimrc" ]; then