The earlier parts of this series built a Java and Spring Boot setup one piece at a time. This part puts all of it in one place: a Git repository with a Neovim configuration you can clone instead of starting from the plain starter. It contains only the plugins and settings the series tested against the companion code, and nothing it did not.
Built on LazyVim, not a fork of it
LazyVim recommends one way to build your own configuration: start from its starter layout and load LazyVim as a plugin. The repository does exactly that. lua/config/lazy.lua bootstraps lazy.nvim and imports lazyvim.plugins, then your own files in lua/plugins/:
spec = {
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{ import = "plugins" },
},
Because LazyVim stays a dependency, its updates arrive with :Lazy update like any other plugin. Nothing of LazyVim is copied into the repository.
What is inside
The configuration is small. Most of it is a list of extras and three plugin files:
nvim-spring-ide/
├── init.lua
├── lazyvim.json extras: lang.java, dap.core, editor.overseer,
│ lang.sql, lang.docker, lang.yaml
├── lazy-lock.json exact plugin versions that were tested
├── lua/config/ LazyVim's options, keymaps, autocmds (defaults)
├── lua/plugins/
│ ├── spring-boot.lua Spring Boot language server (Part 4)
│ ├── kubernetes-yaml.lua Kubernetes schema for k8s/**/*.yaml (Part 12)
│ └── ide-trainer.lua loads the :IdeTrainer practice game (Part 16)
├── local-plugins/ide-trainer/ the game itself, plain Lua
└── extras/
├── tmux.conf optional tmux settings (Part 14)
└── vscode/ launch.json and tasks.json examples (Part 9)
Each extra maps to a part of the series: lang.java for , refactoring and tests (Parts 2, 3, 5, 8), dap.core for the debugger (Part 7), editor.overseer for tasks (Part 9), lang.sql for dadbod (Part 11), and lang.docker and lang.yaml for container and Kubernetes files (Part 12).
Install it
You need the tools from Part 1: Neovim 0.12 or newer, Git, a C compiler, tree-sitter-cli, curl, ripgrep, fd, and a JDK 21 or newer, JDK 25 for the companion code. SDKMAN is an optional way to get the JDK. Then back up your configuration and clone:
mv ~/.config/nvim{,.bak}
git clone https://github.com/mnafshin/nvim-spring-ide ~/.config/nvim
nvim
On the first start lazy.nvim installs the plugins at the versions in lazy-lock.json, and installs the external tools. In our test that was twelve packages, among them jdtls, java-debug-adapter, java-test, vscode-spring-boot-tools, yaml-language-server, hadolint and sqlfluff. Watch :Mason until they are done, restart once, and run :LazyHealth.
Try it without replacing your setup
Neovim reads its configuration from a folder named by the NVIM_APPNAME variable, nvim by default. Clone the repository under another name and point the variable at it:
git clone https://github.com/mnafshin/nvim-spring-ide ~/.config/nvim-spring-ide
NVIM_APPNAME=nvim-spring-ide nvim
Plugins, Mason tools and caches then live in separate folders, such as ~/.local/share/nvim-spring-ide, so your own setup is untouched. This is how we tested the repository: a fresh NVIM_APPNAME, the companion code opened from its root, and then the checks from the earlier parts, including jdtls, Spring symbols, a conditional breakpoint with evaluate and watches, tests, dadbod and the Kubernetes schema.
Add the per-project files
Run configurations and tasks belong to a project, not to the editor. Copy the examples into the project and edit the module and class names:
mkdir -p .vscode
cp ~/.config/nvim/extras/vscode/*.json .vscode/
launch.json starts the catalog app on port 8081 with a JFR recording (Parts 9 and 10) and attaches to a JVM listening on port 5005 (Part 7). tasks.json holds two Maven tasks for overseer. For , copy the lines you want from extras/tmux.conf into ~/.tmux.conf.
Make it yours
The repository is a starting point, so change it freely:
- Add or remove extras with
:LazyExtras; the choice is saved inlazyvim.json. - Add plugins as new files in
lua/plugins/, and options or keymaps inlua/config/. - Change the Kubernetes glob in
kubernetes-yaml.luaif your manifests live somewhere other thank8s/.
Commit your changes to your own fork, so the same editor follows you to every machine.
Keep it up to date
:Lazy update updates plugins, including LazyVim, and rewrites lazy-lock.json. Commit the lock file after checking that everything still works; if an update breaks something, :Lazy restore goes back to the versions in the committed lock file. :Mason lists the external tools, and U in that window updates them. LazyVim announces breaking changes in its news, which :LazyExtras and the LazyVim website show.
Recap
nvim-spring-ideis a LazyVim-based configuration with only the extras and plugins this series tested.- LazyVim is loaded as a plugin, so
:Lazy updateupdates it;lazy-lock.jsonpins tested versions. - Clone it into
~/.config/nvim, or try it withNVIM_APPNAME=nvim-spring-ide nvim. - Copy
extras/vscode/*.jsoninto a project for run configurations and Maven tasks. - Update with
:Lazy updateand:Mason, and roll back with:Lazy restore. :IdeTrainerpractises the keys of this series inside the companion project (Part 16).
Series: Neovim as a Java IDE. Previous: Neovim inside tmux · Next: Practise the keys with a game inside Neovim
Sources
Official documentation and well-known tutorials read while writing this article. The wording here is our own.
- LazyVim: Installation (starter)
- LazyVim: Configuration and plugins
- lazy.nvim: Lockfile and commands
- Neovim: NVIM_APPNAME
- mason.nvim README
- Lorenzo Bettini: lazyvim-java configuration repository
- LazyVim starter repository
- Nirmal Ravidas: Setting Up a Full Spring Boot Dev Environment on Linux with Neovim and LazyVim
Comments