1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Add install instruction for nodejs and vim-language-server

This commit is contained in:
jdhao 2021-07-16 00:44:28 +08:00
parent ffb0601aca
commit 7e75a91d66
2 changed files with 72 additions and 0 deletions

View File

@ -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 #

View File

@ -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