My neovim
configuration as a git repository.
đź”— View all releases
(Read more about how this repository creates releases)
- Requirements
- Instructions
- Switching profiles
- Updating
- Notes
- Fix Github rate limit with Lazy
- Releases
- Links
Minimum: v0.11.0
check with nvim --version
Warning
The Linux install script(s) do not support LXC container environments or ARM CPUs.
I have access to both of these environments and will develop the configuration for those platforms, but until this message is removed, LXC containers and ARM CPUs are not supported.
If you install neovim
using one of the install/setup scripts, the dependencies for my neovim
configuration will be installed automatically.
Otherwise, requirements for this configuration are:
- Kickstart.nvim dependencies
nodejs
/npm
- The setup scripts install
nodejs-lts
with the Node Version Manager (nvm
) on Linux, andnodejs-lts
viascoop
on Windows.
- The setup scripts install
- Languages for Neovim LSP (all optional, except Node)
- Python
- Go
- Node
- Lua / Luarocks
- Clone repository with
git clone git@github.com:redjax/neovim
(or with HTTPS:git clone https://github.com/redjax/neovim ./neovim
) - Run the setup script for your platform:
- Run
nvim
to ensure everything installed correctly.
The Linux setup script installs & configures neovim
and any dependencies needed to build/configure/run the program. The script also creates a symlink of each Neovim configuration in the config/
directory to the ~/.config/{neovim-config-name}
path on the host.
Run ./scripts/linux/install.sh
to install neovim
and its dependencies.
The Windows setup script installs the scoop
package manager, then installs all neovim
requirements (including nodejs-lts
) with it. neovim
itself is installed with scoop
using this script.
I chose scoop
over other options like winget
and chocolatey
because every dependency I need is there, the setup is simple, and it keeps everything contained to a path instead of throwing shit all over the OS's $PATH
.
- Run
./scripts/windows/install-neovim-win.ps1
- NOTE: Windows requires Administrator priviliges to create path junctions. If you use the Windows setup script, the junction will call the
Run-AsAdmin
command if the script is not running in an elevated session; you may see a UAC prompt, have to type a password, or you might see a blue Powershell window flash on the screen for a moment.
- NOTE: Windows requires Administrator priviliges to create path junctions. If you use the Windows setup script, the junction will call the
This repository includes Docker images for building Neovim with my custom config in a container environment. The Dockerfiles can be found in the containers/ path. For example, deb.Dockerfile
builds neovim
on a Debian base and installs the configuration for Debian.
The containers set up an environment to run install.sh
, and can be used to test my neovim
setup across multiple platforms.
To build the container, run the build-deb-img.sh
(for Debian) or build-rpm-img.sh
(for Fedora) script.
For example, the build-deb-img.sh
script (note: you should run this script from the root of the repository):
./scripts/docker/build-deb-img.sh
You can also manually build the command (note: add --progress=plain
to the end of the docker build command to see all build output):
## Enable CONTAINER_ENV and set a build path for Neovim before running container
# This example builds the deb.Dockerfile Debian container environment
CONTAINER_ENV=1 NEOVIM_MAKE_BUILD_DIR="/tmp/build" docker build -f ./containers/deb.Dockerfile -t neovim-buildtest .
After building the Docker container, you can run it with:
docker exec --rm -it nvim-buildtest /bin/bash
Once you're in the container, open neovim with nvim
. The Lazy
installer should kick off and build the configuration. After this first execution, each subsequent run will launch immediately, until the container is rebuilt.
The install scripts create symbolic links to each configuration in the config/
directory. By default, running nvim
will open the configuration at ~/.config/nvim
(or $env:LOCALAPPDATA\nvim
on Windows).
You can have Neovim open a different configuration by setting the NVIM_APPNAME
environment variable.
Prepend your nvim
command with NVIM_APPNAME=
:
NVIM_APPNAME=nvim-configname nvim
Use an existing configuration name, i.e. nvim-kickstart
or nvim-noplugins
.
In a Powershell prompt, run:
$env:NVIM_APPNAME=nvim-configname; nvim
Use an existing configuration name, i.e. nvim-kickstart
or nvim-noplugins
.
You may see an error about HOME not being set:
Error detected while processing C:\Users\$USERNAME\AppData\Local\nvim-noplugins\init.lua:
HOME not set! Undo directory not configured.
If you see this, you must also set a value for $env:HOME
:
$env:HOME=$env:USERPROFILE; $NVIM_APPNAME="nvim-noplugins"; nvim
If you export the NVIM_APPNAME
environment variable globally, you can set the configuration Neovim will use whenever you run nvim
. You can still temporarily override the profile.
Export the NVIM_APPNAME
environment variable, i.e. by putting the following in your ~/.bashrc
:
NVIM_APPNAME="nvim-configname"
Use an existing configuration name, i.e. nvim-kickstart
or nvim-noplugins
.
On Windows, you can set this environment variable by hitting the Start button, searching for "environment variables," and opening the option to edit the user's environment variables. Then, create a new variable called NVIM_APPNAME
, and set the value to the configuration you want to use, i.e. nvim-noplugins
.
You can also do this with an elevated Powershell prompt using setx
:
setx NVIM_APPNAME "nvim-configname"
Use an existing configuration name, i.e. nvim-kickstart
or nvim-noplugins
.
You may see an error about HOME not being set:
Error detected while processing C:\Users\$USERNAME\AppData\Local\nvim-noplugins\init.lua:
HOME not set! Undo directory not configured.
If you see this, you must also set a value for $env:HOME
:
setx HOME "$env:USERPROFILE"; setx NVIM_APPNAME "nvim-noplugins"
To get the latest stable version of the configuration, run git switch main && git pull
.
Run sudo rm $(which nvim)
, then re-run the Linux install script at ./scripts/linux/install.sh
. This will re-install the latest version of Neovim from source.
Update Neovim using whichever installer you used.
- Github release: download & install latest release
- Winget: Run
winget update Neovim.Neovim
- Scoop: Run
scoop update neovim
- Chocolatey: Run
choco upgrade neovim
- View available colorschemes by opening neovim and running
:Telescope colorscheme
- Press
<Space>
to open an interactive menu - Run
:Lazy
to open the package manager
Configuring a language server (LSP) with Lazy and Mason is pretty simple. Find a language server here, for example the marksman
Markdown LSP.
In your init.lua
, find the line that begins with require('lazy').setup({
. Within that function, find the section that begins with the comment -- Main LSP Configuration
. In that section, in the config = function()
function, find the variable local servers = {
.
Configure your LSPs Within the local servers = {}
mapping, referencing existing LSPs for setup. After finding an LSP from the list, find the setup instructions and the Default config:
section.
For example, the marksman
default config looks like:
cmd
:
{ "marksman", "server" }
filetypes
:
{ "markdown", "markdown.mdx" }
root_markers
:
{ ".marksman.toml", ".git" }
To configure a new LSP with Mason, you just need to add some setup instructions:
-- Markdown https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#marksman
marksman = {
cmd = { "marksman", "server" },
filetypes = { "markdown", "markdown.mdx" },
root_markers = { ".marksman.toml", ".git" }
},
Next time you run nvim
, Mason will install the LSP and neovim
will use it when an appropriate file is opened.
Github rate limits unauthenticated requests at 60/hour. If you hit this rate limit, Lazy will fail to install/update packages with an error like:
clone failed
Cloning into 'C:/Users/jack/AppData/Local/nvim-data/lazy/mason'...
remote: Repository not found.
fatal: repository 'https://github.com/mason-org/mason.git/' not found
To fix this, you can configure a Github Personal Access Token (PAT) and set it in your environment or a .netrc
file in your home directory.
Set an environment variable GITHUB_TOKEN
in your environment. You can run one of the commands below to set your token for the current terminal session, but when you close that session the variable will be reset. Add it to your ~/.bashrc
on Linux, or your Windows user's environment.
Temporarily set a token on Linux:
export GITHUB_TOKEN=ghp_your_personal_access_token
Temporarily set a token on Windows:
$env:GITHUB_TOKEN = "ghp_your_personal_access_token"
To set the environment variable permanently on Windows, you can run:
[System.Environment]::SetEnvironmentVariable("GITHUB_TOKEN", "ghp_your_token", "User")
You can also create a ~/.netrc
file with the following contents:
machine github.com
login your_github_username
password ghp_your_personal_access_token
This repository releases .zip archives of the neovim configurations in config/
. The release pipeline is triggered manually, and creates the next patch version automatically (i.e. v0.0.1
-> v0.0.2
).
Each time a release is created, it will contain .zip archives of each configuration, named after the directory (i.e. nvim-v0.0.1.zip
for the default nvim/
config). When you extract the archive, a directory named nvim/
will be created, containing the configuration you downloaded. You can move this file to the Neovim configuration path (~/.config/nvim
on Linux, %USERPROFILE%\AppData\Local\nvim
on Windows) to install the configuration. You can also extract the .zip archive directly to that path to extract & install in 1 step.