Skip to content

Lazyvim

Srinesh Nisala edited this page May 29, 2024 · 8 revisions

Install nvim-java on Lazyvim

Video

I have following video if you'd like to watch.

Watch the video

Java Playground

If you just want to try it out, I have this devcontainer environment that quickly spin up a new docker container with everything you need including nvim-java configured lazyvim, some maven & gradle java project for you to try. All the instructions are in the readme.

Instruction to Setup

Important

For debugging, install dap.core LazyExtra package

Installing nvim-java is super easy

  • Create a new file for java plugin ~/.config/nvim/lua/plugins/java/init.lua
  • Add the following content to the file
return {
  "nvim-java/nvim-java",
  dependencies = {
    "nvim-java/lua-async-await",
    "nvim-java/nvim-java-refactor",
    "nvim-java/nvim-java-core",
    "nvim-java/nvim-java-test",
    "nvim-java/nvim-java-dap",
    "MunifTanjim/nui.nvim",
    "neovim/nvim-lspconfig",
    "mfussenegger/nvim-dap",
    {
      "williamboman/mason.nvim",
      opts = {
        registries = {
          "github:nvim-java/mason-registry",
          "github:mason-org/mason-registry",
        },
      },
    },
    {
      "williamboman/mason-lspconfig.nvim",
      opts = {
        handlers = {
          ["jdtls"] = function()
            require("java").setup()
          end,
        },
      },
    },
  },
  opts = {},
}
  • Enjoy
Clone this wiki locally