aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjdhao <jdhao@hotmail.com>2021-07-16 00:44:28 +0800
committerjdhao <jdhao@hotmail.com>2021-07-16 00:44:28 +0800
commit7e75a91d66b4de0e68343fb2a12ff68333f836da (patch)
tree98c49ee027eae33e1c4ee33c7e52fd4884549096
parentffb0601aca630d33adc84606db54aca3a5484e72 (diff)
Add install instruction for nodejs and vim-language-server
-rwxr-xr-xdocs/Nvim_setup.sh34
-rw-r--r--docs/README.md38
2 files changed, 72 insertions, 0 deletions
diff --git a/docs/Nvim_setup.sh b/docs/Nvim_setup.sh
index cb66300..b76b7c0 100755
--- a/docs/Nvim_setup.sh
+++ b/docs/Nvim_setup.sh
@@ -86,6 +86,40 @@ else
done
fi
+#######################################################################
+# Install node and vim-language-server #
+#######################################################################
+NODE_DIR=$HOME/tools/nodejs
+NODE_SRC_NAME=$HOME/packages/nodejs.tar.gz
+NODE_LINK="https://nodejs.org/dist/v14.15.4/node-v14.15.4-linux-x64.tar.xz"
+
+mkdir -p $HOME/tools
+# extract node to a custom directory, the directory should exist.
+tar xvf node-v14.15.4-linux-x64.tar.xz --directory=$HOME/tools
+
+if [[ -z "$(command -v node)" ]]; then
+ echo "Install Nodejs"
+ if [[ ! -f $NODE_SRC_NAME ]]; then
+ echo "Downloading nodejs and renaming"
+ wget $NODE_LINK -O "$NODE_SRC_NAME"
+ fi
+
+ if [[ ! -d "$NODE_DIR" ]]; then
+ echo "Creating nodejs directory under tools directory"
+ mkdir -p "$NODE_DIR"
+ echo "Extracting to $HOME/tools/nodejs directory"
+ tar zxvf "$NODE_SRC_NAME" -C "$NODE_DIR" --strip-components 1
+ fi
+
+ if [[ "$ADD_TO_SYSTEM_PATH" = true ]] && [[ "$USE_BASH_SHELL" = true ]]; then
+ echo "export PATH=\"$NVIM_DIR/bin:\$PATH\"" >> "$HOME/.bash_profile"
+ fi
+else
+ echo "Nodejs is already installed. Skip installing it."
+fi
+
+# Install vim-language-server
+$NODE_DIR/bin/npm install -g vim-language-server
#######################################################################
# Ripgrep part #
diff --git a/docs/README.md b/docs/README.md
index 2f47a65..e9fee25 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -29,6 +29,44 @@ linting, go to definition, etc.
pip install 'python-lsp-server[all]' pylsp-mypy pyls-isort
```
+## Node
+
+We need to install node.js from [here](https://nodejs.org/en/download/):
+
+```bash
+# Ref: https://johnpapa.net/node-and-npm-without-sudo/
+wget https://nodejs.org/dist/v14.15.4/node-v14.15.4-linux-x64.tar.xz
+
+mkdir -p $HOME/tools
+# extract node to a custom directory, the directory should exist.
+tar xvf node-v14.15.4-linux-x64.tar.xz --directory=$HOME/tools
+```
+
+Then add the following config to `.bash_profile` or `.zshrc`
+
+```bash
+export PATH="$HOME/tools/node-v14.15.4-linux-x64/bin:$PATH"
+```
+
+Source the file:
+
+```bash
+source ~/.bash_profile
+# source ~/.zshrc
+```
+
+## vim-language-server
+
+[vim-language-server](https://github.com/iamcco/vim-language-server) provides
+completion for vim script. We can install vim-language-server globally and set
+its path:
+
+```bash
+npm install -g vim-language-server
+
+export PATH="$HOME/.npm-packages/bin:$PATH"
+```
+
## Git
Git is used by the plugin manager packer.nvim to download plugins from GitHub