aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardofSprites <[email protected]>2026-06-03 18:08:11 -0400
committerBardofSprites <[email protected]>2026-06-03 18:08:11 -0400
commitd07a593b6354d570043dbc68bd2945139133f9c8 (patch)
treeaebf27e98d2d70ae2f7b31581b6d0653a3ba9d5e
parent1a0db1edb0271bfd04a8149efd1434be6a1830b8 (diff)
neovim java completionHEADmaster
-rw-r--r--nvim/.config/nvim/ftplugin/java.lua22
-rw-r--r--nvim/.config/nvim/init.lua205
-rw-r--r--nvim/.config/nvim/lazy-lock.json22
3 files changed, 221 insertions, 28 deletions
diff --git a/nvim/.config/nvim/ftplugin/java.lua b/nvim/.config/nvim/ftplugin/java.lua
new file mode 100644
index 0000000..8dec951
--- /dev/null
+++ b/nvim/.config/nvim/ftplugin/java.lua
@@ -0,0 +1,22 @@
+local jdtls = require("jdtls")
+local capabilities = require("cmp_nvim_lsp").default_capabilities()
+
+local root_dir = vim.fs.dirname(
+ vim.fs.find({ "gradlew", "pom.xml", "build.gradle", ".git" }, { upward = true })[1]
+)
+
+local workspace = vim.fn.stdpath("data") .. "/jdtls-workspaces/" ..
+ vim.fn.fnamemodify(root_dir, ":t")
+
+jdtls.start_or_attach({
+ cmd = { vim.fn.stdpath("data") .. "/mason/bin/jdtls", "--data", workspace },
+ root_dir = root_dir,
+ capabilities = capabilities, -- this is what was missing
+
+ on_attach = function(_, bufnr)
+ local opts = { buffer = bufnr }
+ vim.keymap.set("n", "<leader>ji", jdtls.organize_imports, opts)
+ vim.keymap.set("n", "<leader>jv", jdtls.extract_variable, opts)
+ vim.keymap.set("v", "<leader>jm", jdtls.extract_method, opts)
+ end,
+})
diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua
index 848602a..6019f11 100644
--- a/nvim/.config/nvim/init.lua
+++ b/nvim/.config/nvim/init.lua
@@ -16,44 +16,176 @@ vim.opt.rtp:prepend(lazypath)
-- --- Plugin Setup ---
require("lazy").setup({
+
+ -- --- Utilities ---
{ "junegunn/goyo.vim" },
{ "junegunn/fzf.vim" },
{ "tpope/vim-commentary" },
{ "tpope/vim-surround" },
{ "ap/vim-css-color" },
+
+ -- --- Telescope ---
{ "nvim-telescope/telescope.nvim" },
+
+ -- --- Colorschemes ---
{ "ellisonleao/gruvbox.nvim" },
+ { "craftzdog/solarized-osaka.nvim" },
+
+ -- --- File Tree ---
+ {
+ "nvim-tree/nvim-tree.lua",
+ dependencies = { "nvim-tree/nvim-web-devicons" },
+ config = function()
+ require("nvim-tree").setup({
+ sort = { sorter = "case_sensitive" },
+ view = { width = 30 },
+ renderer = {
+ group_empty = true,
+ icons = {
+ show = { git = true, file = false, folder = false, folder_arrow = true },
+ glyphs = {
+ folder = { arrow_closed = "⏵", arrow_open = "⏷" },
+ git = {
+ unstaged = "✗", staged = "✓", unmerged = "⌥",
+ renamed = "➜", untracked = "★", deleted = "⊖", ignored = "◌",
+ },
+ },
+ },
+ },
+ filters = { dotfiles = true },
+ })
+ end
+ },
+
+ -- --- Java LSP ---
+ { "mfussenegger/nvim-jdtls" },
+
+ -- --- Mason (installs LSP server binaries) ---
+ {
+ "williamboman/mason.nvim",
+ lazy = false,
+ config = true,
+ },
+
+ -- --- Snippets ---
+ {
+ "L3MON4D3/LuaSnip",
+ dependencies = {
+ "saadparwaiz1/cmp_luasnip",
+ "rafamadriz/friendly-snippets",
+ },
+ },
+ -- --- Completion ---
+ {
+ "hrsh7th/nvim-cmp",
+ lazy = false,
+ dependencies = {
+ "hrsh7th/cmp-nvim-lsp",
+ "L3MON4D3/LuaSnip",
+ },
+ config = function()
+ require("luasnip.loaders.from_vscode").lazy_load()
+
+ local cmp = require("cmp")
+ local luasnip = require("luasnip")
+
+ cmp.setup({
+ completion = {
+ -- autocomplete = { cmp.TriggerEvent.TextChanged },
+ autocomplete = { require("cmp.types").cmp.TriggerEvent.TextChanged },
+ },
+
+ snippet = {
+ expand = function(args)
+ luasnip.lsp_expand(args.body)
+ end,
+ },
+ sources = {
+ { name = "nvim_lsp" },
+ { name = "luasnip" },
+ },
+ mapping = cmp.mapping.preset.insert({
+ ["<C-Space>"] = cmp.mapping.complete(),
+ ["<CR>"] = cmp.mapping.confirm({ select = true }),
+ ["<C-n>"] = cmp.mapping.select_next_item(),
+ ["<C-p>"] = cmp.mapping.select_prev_item(),
+ ["<C-u>"] = cmp.mapping.scroll_docs(-4),
+ ["<C-d>"] = cmp.mapping.scroll_docs(4),
+ }),
+ })
+ end,
+ },
+ {
+ "ThePrimeagen/harpoon",
+ branch = "harpoon2",
+ dependencies = { "nvim-lua/plenary.nvim" },
+ config = function()
+ require("harpoon"):setup()
+ end,
+ },
})
-require("gruvbox").setup({
- terminal_colors = true, -- add neovim terminal colors
- undercurl = true,
- underline = true,
- bold = true,
- italic = {
- strings = false,
- emphasis = false,
- comments = false,
- operators = false,
- folds = false,
+-- --- LSP Setup (native nvim 0.11 API, no lspconfig needed) ---
+-- attach keybinds whenever any LSP connects to a buffer
+vim.api.nvim_create_autocmd("LspAttach", {
+ callback = function(args)
+ local bufnr = args.buf
+ local opts = { buffer = bufnr }
+ vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
+ vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
+ vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
+ vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
+ vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
+ vim.keymap.set("n", "<leader>ji", vim.lsp.buf.format, opts)
+ end,
+})
+
+-- configure lua_ls directly (no lspconfig wrapper)
+vim.lsp.config("lua_ls", {
+ cmd = { vim.fn.stdpath("data") .. "/mason/bin/lua-language-server" },
+ filetypes = { "lua" },
+ root_markers = { ".luarc.json", ".git" },
+ settings = {
+ Lua = {
+ runtime = { version = "LuaJIT" },
+ workspace = {
+ checkThirdParty = false,
+ library = vim.api.nvim_get_runtime_file("", true),
+ },
+ diagnostics = { globals = { "vim" } },
+ telemetry = { enable = false },
+ },
+ },
+})
+
+vim.lsp.enable("lua_ls")
+
+-- --- Colorscheme ---
+require("solarized-osaka").setup({
+ transparent = false,
+ terminal_colors = true,
+ styles = {
+ comments = { italic = false },
+ keywords = { italic = false },
+ functions = {},
+ variables = {},
+ sidebars = "dark",
+ floats = "dark",
},
- strikethrough = true,
- invert_selection = false,
- invert_signs = false,
- invert_tabline = false,
- inverse = true, -- invert background for search, diffs, statuslines and errors
- contrast = "", -- can be "hard", "soft" or empty string
- palette_overrides = {},
- overrides = {},
+ sidebars = { "qf", "help" },
+ day_brightness = 0.3,
+ hide_inactive_statusline = false,
dim_inactive = false,
- transparent_mode = true,
+ lualine_bold = false,
+ on_colors = function(colors) end,
+ on_highlights = function(highlights, colors) end,
})
-vim.cmd("colorscheme gruvbox")
+
+vim.cmd("colorscheme solarized-osaka")
-- --- General Settings ---
vim.cmd("syntax enable")
vim.cmd("filetype plugin indent on")
-
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
@@ -64,7 +196,6 @@ vim.opt.smartcase = true
vim.opt.incsearch = true
vim.opt.modeline = true
vim.opt.hlsearch = false
-
vim.opt.termguicolors = true
-- --- Filetype Specific ---
@@ -73,11 +204,29 @@ vim.api.nvim_create_autocmd("FileType", {
command = "setlocal nofoldenable",
})
+vim.diagnostic.config({
+ signs = { priority = 10 },
+})
+vim.opt.signcolumn = "yes"
+
-- --- Keybinds ---
vim.g.mapleader = " "
-local builtin = require('telescope.builtin')
-vim.keymap.set('n', '<leader>f', builtin.find_files, { desc = 'Telescope find files' })
-vim.keymap.set('n', '<leader>g', builtin.live_grep, { desc = 'Telescope live grep' })
-vim.keymap.set('n', '<leader>b', builtin.buffers, { desc = 'Telescope buffers' })
-vim.keymap.set("n", "<Leader>d", ":Ex<CR>", { silent = true })
+local builtin = require("telescope.builtin")
+vim.keymap.set("n", "<leader>f", builtin.find_files, { desc = "Telescope find files" })
+vim.keymap.set("n", "<leader>g", builtin.live_grep, { desc = "Telescope live grep" })
+vim.keymap.set("n", "<leader>b", builtin.buffers, { desc = "Telescope buffers" })
+vim.keymap.set("n", "<Leader>d", ":Ex<CR>", { silent = true })
+vim.keymap.set("n", "<Leader>e", ":NvimTreeToggle<CR>", { silent = true })
+
+local harpoon = require("harpoon")
+vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end, { desc = "Harpoon add file" })
+vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end, { desc = "Harpoon menu" })
+
+vim.diagnostic.config({
+ virtual_text = true, -- shows the error message inline at end of the line
+ float = {
+ border = "rounded",
+ source = true, -- shows which LSP is reporting it
+ },
+})
diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json
new file mode 100644
index 0000000..c2e64d6
--- /dev/null
+++ b/nvim/.config/nvim/lazy-lock.json
@@ -0,0 +1,22 @@
+{
+ "LuaSnip": { "branch": "master", "commit": "0abc8f390b278c3b4aabc4c004ac8a088b65cf24" },
+ "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
+ "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
+ "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
+ "fzf.vim": { "branch": "master", "commit": "356608e2ae5d9127e2c964885ea2b21ea7aea9ab" },
+ "goyo.vim": { "branch": "master", "commit": "9c72fdf2d202914318581f9f0dd09fd102f8504d" },
+ "gruvbox.nvim": { "branch": "main", "commit": "154eb5ff5b96d0641307113fa385eaf0d36d9796" },
+ "harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" },
+ "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
+ "mason.nvim": { "branch": "main", "commit": "16ba83bfc8a25f52bb545134f5bee082b195c460" },
+ "nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" },
+ "nvim-jdtls": { "branch": "master", "commit": "6e9d953f0b82bccdb834cfde0e893f3119c22592" },
+ "nvim-tree.lua": { "branch": "master", "commit": "07f541fcaa4a5ae019598240362449ab7e9812b3" },
+ "nvim-web-devicons": { "branch": "master", "commit": "dfbfaa967a6f7ec50789bead7ef87e336c1fa63c" },
+ "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
+ "solarized-osaka.nvim": { "branch": "main", "commit": "f675d9a5c58f3b0d6158d665a623f81a62e7bdaf" },
+ "telescope.nvim": { "branch": "master", "commit": "7d324792b7943e4aa16ad007212e6acc6f9fe335" },
+ "vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" },
+ "vim-css-color": { "branch": "master", "commit": "14fd934cdd9ca1ac0e53511094e612eb9bace373" },
+ "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }
+}