Personal Neovim config.
Install the following packages using Homebrew:
brew install neovim ripgrep fzf sqlite fd black isort prettier stylua terraform
brew install --cask font-hack-nerd-font
Create a dedicated virtual environment for Neovim:
# Create a virtual environment for Neovim
python3 -m venv ~/neovim_env
# Activate the environment
source ~/neovim_env/bin/activate
# Install the neovim package
pip install neovim
# Deactivate the environment
deactivate
Add this to your Neovim configuration (init.lua or similar):
-- Set the Python provider to use the dedicated Neovim environment
vim.g.python3_host_prog = vim.fn.expand('~/.config/nvim/neovim_env/bin/python')
Add the virtual environment to your global .gitignore
:
echo "~/neovim_env/" >> ~/.gitignore
- Install nvm:
brew install nvm
- Add to your
.zshrc
:
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion"
- Install and use a Node.js version:
nvm install node # Install the latest version
nvm use node # Use the latest version
- Install the neovim npm package:
npm install -g neovim
To set up LSP for various languages, you'll need to install language servers and configure them in Neovim. Here's an example for Python using Pyright:
- Install Pyright:
npm install -g pyright
- Add this to your Neovim configuration:
local lspconfig = require('lspconfig')
lspconfig.pyright.setup{
settings = {
python = {
analysis = {
autoSearchPaths = true,
useLibraryCodeForTypes = true,
diagnosticMode = "workspace"
}
}
}
}
Repeat similar steps for other languages you work with.
After completing the setup:
- Restart Neovim
- Run
:checkhealth
to ensure everything is properly configured - Address any remaining warnings or errors as needed
Remember to keep your Neovim and its plugins updated regularly for the best experience.