nvim-java with NvChad v2.5 #308
Jamie-505
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
|
Hey mate! i also came accross this issue, but i use latest version of nvchad. here i share my setup: note: nvchad config structure canged since then and now custom folder is no longer available. but i like to use a structure similar to custom folder. here is my config file structure:
-- Updated config --
-- ~/.config/nvim/lua/plugins/init.lua
-- Create an empty table to hold all plugin specifications
local plugins = {}
-- Helper function to extend the 'plugins' table with configurations from other files
local function extend_plugins(t)
for _, v in ipairs(t) do
table.insert(plugins, v)
end
end
--- Load existing plugins from your original init.lua directly into the 'plugins' table ---
-- These are the plugins you had directly listed in your original init.lua.
-- Add them to the 'plugins' table here.
table.insert(plugins, {
"stevearc/conform.nvim",
-- event = 'BufWritePre', -- uncomment for format on save
opts = require "configs.conform",
})
table.insert(plugins, {
"neovim/nvim-lspconfig",
config = function()
require "configs.lspconfig"
end,
})
-- Uncomment and add other plugins you had directly here, for example:
-- table.insert(plugins, { import = "nvchad.blink.lazyspec" })
-- table.insert(plugins, {
-- "nvim-treesitter/nvim-treesitter",
-- opts = {
-- ensure_installed = {
-- "vim", "lua", "vimdoc",
-- "html", "css"
-- },
-- -- Ensure folding is enabled if you plan to use Treesitter folding
-- folding = { enable = true },
-- },
-- })
-- == uncommented: ==
table.insert(plugins, { import = "nvchad.blink.lazyspec" })
table.insert(plugins, {
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"vim", "lua", "vimdoc",
"html", "css", "java", "python"
},
-- Ensure folding is enabled if you plan to use Treesitter folding
folding = { enable = true },
},
})
-- Add Mason and Mason-LSPConfig here
table.insert(plugins, {
"williamboman/mason.nvim",
cmd = "Mason",
build = ":MasonUpdate",
config = function()
require("mason").setup({
-- Add any global mason settings here if needed
-- e.g., ensure that the "bin" directory is in your system PATH
})
end
})
table.insert(plugins, {
"williamboman/mason-lspconfig.nvim",
dependencies = { "williamboman/mason.nvim", "neovim/nvim-lspconfig" },
config = function()
require("mason-lspconfig").setup({
ensure_installed = {
"jdtls", -- Ensure JDTLS is always installed by Mason
"lua_ls", -- Ensure Lua LS is installed
"cssls", -- Ensure CSS LS is installed
"html" -- Ensure HTML LS is installed
},
-- Automatically setup lspconfig for servers installed by mason
automatic_installation = true,
})
end
})
--- Load plugins from different groups (your new structure) ---
-- Load plugins from the 'note-taking' group
extend_plugins(require("plugins.note-taking.telekasten"))
extend_plugins(require("plugins.note-taking.render-markdown"))
-- Load plugins from the 'java' development group
extend_plugins(require("plugins.java.nvim-java"))
-- Add more groups as you create them, for example:
-- extend_plugins(require("plugins.utility.harpoon"))
-- extend_plugins(require("plugins.lsp.nvim-lspconfig"))
-- Finally, return the combined list of all plugin specifications for lazy.nvim to process
return plugins
Long story short i wanted to learn java and got nvchad, tweaked it for a week or so now i am trying to make java working. but after long hours of trying to set this up in nvchad it wont still work. i got the configurations from that archved post on reddit, then i saw your post, and tried that, but it still is not working:
could you help over please! 🙏 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment



Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
After almost pulling my hair out because nvchads mason config did not play nicely with the extensions from nvim-java I found this reddit post Credit: @Omixxx
so I figured I post this somewhere more easily to find.
here is the lua/plugins/myPlugins.lua section:
{ 'nvim-java/nvim-java', lazy = false, dependencies = { 'nvim-java/lua-async-await', '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', }, }, }, }, config = function() require('configs.java') end, },and the lua/configs/java.lua file I use to store the configuration
hope this serves useful for someone
Beta Was this translation helpful? Give feedback.
All reactions