refactor(nvim): add tex and eyeliner and stuff

main
sgoudham 7 months ago
parent 610308d789
commit 0fc14e33a7
Signed by: hammy
GPG Key ID: 44E818FD5457EEA4

@ -1,38 +1,36 @@
{ {
"LazyVim": { "branch": "main", "commit": "c433ea7aa842c446edc2b1570998bf5440c68188" }, "LazyVim": { "branch": "main", "commit": "c433ea7aa842c446edc2b1570998bf5440c68188" },
"LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" }, "LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" },
"SchemaStore.nvim": { "branch": "main", "commit": "be4d1084397c9b9d3d5a41bda871e6b20415bf48" }, "SchemaStore.nvim": { "branch": "main", "commit": "17de2914bad410d391f184bb14f2a7327777ca38" },
"catppuccin": { "branch": "main", "commit": "c2034f7b549152e5cc757820426341ea5000bc7a" }, "catppuccin": { "branch": "main", "commit": "c2034f7b549152e5cc757820426341ea5000bc7a" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "c0e0e80f0c233cb3a249f719a44324c660163a3f" }, "conform.nvim": { "branch": "master", "commit": "c0e0e80f0c233cb3a249f719a44324c660163a3f" },
"copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" }, "crates.nvim": { "branch": "main", "commit": "ec2b04a380c9f3a8e6ca38c230e4990d71978143" },
"copilot.lua": { "branch": "master", "commit": "71382c2efec76647287d46a4fbe0ec8c9809e2ee" }, "doom-one.nvim": { "branch": "main", "commit": "76595eec15896a5da7f4e39ceeded6ffb0f4dc38" },
"crates.nvim": { "branch": "main", "commit": "2bd990871f0aef159933bd5fe6da421690a832b9" },
"dashboard-nvim": { "branch": "master", "commit": "c045eb24334324fb39ad5ede0b5d15a74a5d229e" },
"dressing.nvim": { "branch": "master", "commit": "6f212262061a2120e42da0d1e87326e8a41c0478" }, "dressing.nvim": { "branch": "master", "commit": "6f212262061a2120e42da0d1e87326e8a41c0478" },
"eyeliner.nvim": { "branch": "main", "commit": "c540d58bf52aa979d4cca639c60387ae0c0ccf88" },
"friendly-snippets": { "branch": "main", "commit": "b8fae73a479ae0a1c54f5c98fa687ae8a0addc53" }, "friendly-snippets": { "branch": "main", "commit": "b8fae73a479ae0a1c54f5c98fa687ae8a0addc53" },
"gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" }, "gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" },
"headlines.nvim": { "branch": "master", "commit": "e3d7bfdf40e41a020d966d35f8b48d75b90367d2" },
"indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" }, "indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" },
"lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" }, "lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" },
"ltex_extra.nvim": { "branch": "master", "commit": "42dd3572cb09b52a137e91e515f2dff5eb631b1e" }, "ltex_extra.nvim": { "branch": "master", "commit": "42dd3572cb09b52a137e91e515f2dff5eb631b1e" },
"lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "2b3d247fce06f53934174f5dfe0362c42d65c00c" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "0954d7730e749d606ddf8d7ae8846848be435d53" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "3614a39aae98ccd34124b072939d6283853b3dd2" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "3614a39aae98ccd34124b072939d6283853b3dd2" },
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
"mini.ai": { "branch": "main", "commit": "3ad9d455a91b8bf3c24d4e50518d9a6b9dddb42c" }, "mini.ai": { "branch": "main", "commit": "3ad9d455a91b8bf3c24d4e50518d9a6b9dddb42c" },
"mini.comment": { "branch": "main", "commit": "b0b359ada4293cdcea7ab4072dfd5b031aac3f8e" }, "mini.comment": { "branch": "main", "commit": "b0b359ada4293cdcea7ab4072dfd5b031aac3f8e" },
"mini.indentscope": { "branch": "main", "commit": "ca129b71edb672d30b8d7ec3138106db1b1f6a8b" }, "mini.indentscope": { "branch": "main", "commit": "ca129b71edb672d30b8d7ec3138106db1b1f6a8b" },
"mini.nvim": { "branch": "main", "commit": "d1413e1cacaacd29e420b9482754e762076e64ac" }, "mini.nvim": { "branch": "main", "commit": "9adc2eeec07f3ee65d54f7ceb791ad8fead49c92" },
"mini.pairs": { "branch": "main", "commit": "552062017ff207e1f35f7028bfb3f27c7421d22d" }, "mini.pairs": { "branch": "main", "commit": "552062017ff207e1f35f7028bfb3f27c7421d22d" },
"mini.surround": { "branch": "main", "commit": "5ceb6a12d3761bc719fbdad5432c89333deb1498" }, "mini.surround": { "branch": "main", "commit": "5ceb6a12d3761bc719fbdad5432c89333deb1498" },
"neoconf.nvim": { "branch": "main", "commit": "435d70c1bc5a5bd21ecb98163baa8262480c4019" }, "neoconf.nvim": { "branch": "main", "commit": "435d70c1bc5a5bd21ecb98163baa8262480c4019" },
"neodev.nvim": { "branch": "main", "commit": "2793ba3127c2c93ee486b9072a3ef129eeb950cc" }, "neodev.nvim": { "branch": "main", "commit": "0ee95ecefc8ea45898a0383364f736e098c8703f" },
"neogit": { "branch": "master", "commit": "a3f23af6f1b12938745092c4b427c732c79effe7" }, "neogit": { "branch": "master", "commit": "463a32ca1dcbf35f97b16a7d955217687e850f8d" },
"noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" }, "noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" },
"nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" }, "nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" },
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
@ -41,21 +39,20 @@
"nvim-dap-python": { "branch": "master", "commit": "f5b6f3a90aae0284b61fb3565e575267c19a16e6" }, "nvim-dap-python": { "branch": "master", "commit": "f5b6f3a90aae0284b61fb3565e575267c19a16e6" },
"nvim-dap-ui": { "branch": "master", "commit": "d845ebd798ad1cf30aa4abd4c4eff795cdcfdd4f" }, "nvim-dap-ui": { "branch": "master", "commit": "d845ebd798ad1cf30aa4abd4c4eff795cdcfdd4f" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "d4542ac257d3c7ee4131350db6179ae6340ce40b" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "d4542ac257d3c7ee4131350db6179ae6340ce40b" },
"nvim-jdtls": { "branch": "master", "commit": "4f4de4d80e1df43d58e5e21677fca4c63676664d" },
"nvim-lint": { "branch": "master", "commit": "76af3422e3c82ea40adf9ade1ccf1dc1eb361789" }, "nvim-lint": { "branch": "master", "commit": "76af3422e3c82ea40adf9ade1ccf1dc1eb361789" },
"nvim-lspconfig": { "branch": "master", "commit": "9a6279953c82d01b58825a46ede032ab246a5983" }, "nvim-lspconfig": { "branch": "master", "commit": "d12140c5687a1186b95b3f42dbc6cc769df0cf0d" },
"nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" }, "nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" },
"nvim-spectre": { "branch": "master", "commit": "d1ce28b6dc287a6f673461218f3326f0266d75f7" }, "nvim-spectre": { "branch": "master", "commit": "81cb3999e5db37e97f6336b39c077aea5bb32062" },
"nvim-treesitter": { "branch": "master", "commit": "4fbf150a1621d52f17b099506e1a32f107079210" }, "nvim-treesitter": { "branch": "master", "commit": "4fbf150a1621d52f17b099506e1a32f107079210" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "8edd5a6d96936bdff23333d3bc177481388839e5" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "8edd5a6d96936bdff23333d3bc177481388839e5" },
"nvim-ts-autotag": { "branch": "main", "commit": "a65b202cfd08e0e69e531eab737205ff5bc082a4" }, "nvim-ts-autotag": { "branch": "main", "commit": "a65b202cfd08e0e69e531eab737205ff5bc082a4" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" },
"nvim-web-devicons": { "branch": "master", "commit": "aaec87dbdaa776bfa0a13c8694bec9bcb7454719" }, "nvim-web-devicons": { "branch": "master", "commit": "313d9e7193354c5de7cdb1724f9e2d3f442780b0" },
"plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
"rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" }, "rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
"telescope.nvim": { "branch": "master", "commit": "7b5c5f56a21e82fdcfe5b250278b8dfc4b1cbab4" }, "telescope.nvim": { "branch": "master", "commit": "236083884cfe6c874e03e6cb4e7cb08809c1333c" },
"todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" }, "todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" },
"toggleterm.nvim": { "branch": "main", "commit": "b49df5cdce67a8964d1b027dae94bde212092b51" }, "toggleterm.nvim": { "branch": "main", "commit": "b49df5cdce67a8964d1b027dae94bde212092b51" },
"tokyonight.nvim": { "branch": "main", "commit": "610179f7f12db3d08540b6cc61434db2eaecbcff" }, "tokyonight.nvim": { "branch": "main", "commit": "610179f7f12db3d08540b6cc61434db2eaecbcff" },

@ -26,6 +26,7 @@ require("lazy").setup({
{ import = "lazyvim.plugins.extras.lang.typescript" }, { import = "lazyvim.plugins.extras.lang.typescript" },
{ import = "lazyvim.plugins.extras.lang.python" }, { import = "lazyvim.plugins.extras.lang.python" },
{ import = "lazyvim.plugins.extras.lang.markdown" }, { import = "lazyvim.plugins.extras.lang.markdown" },
{ import = "lazyvim.plugins.extras.lang.tex" },
{ import = "lazyvim.plugins.extras.dap.core" }, { import = "lazyvim.plugins.extras.dap.core" },
-- Can't figure out how to force reordering of the completions so just gonna disable it for now -- Can't figure out how to force reordering of the completions so just gonna disable it for now
-- { import = "lazyvim.plugins.extras.coding.copilot" }, -- { import = "lazyvim.plugins.extras.coding.copilot" },

@ -4,9 +4,10 @@ return {
name = "catppuccin", name = "catppuccin",
priority = 10000, priority = 10000,
opts = { opts = {
flavour = "latte", flavour = "mocha",
custom_highlights = function(c) custom_highlights = function(c)
local u = require("catppuccin.utils.colors") local u = require("catppuccin.utils.colors")
local latte = require("catppuccin.palettes.latte")
return { return {
NoiceCmdLinePopupTitle = { fg = c.base, bg = c.blue }, NoiceCmdLinePopupTitle = { fg = c.base, bg = c.blue },
@ -20,7 +21,7 @@ return {
-- Setting the borders and background of the completion/documentation menu -- Setting the borders and background of the completion/documentation menu
BorderBG = { fg = c.blue }, BorderBG = { fg = c.blue },
PmenuSel = { bg = c.mantle }, -- PmenuSel = { bg = c.mantle }, -- enable when using latte
-- Setting the background of the lsp.buf.hover() and other floats -- Setting the background of the lsp.buf.hover() and other floats
NormalFloat = { bg = c.base }, NormalFloat = { bg = c.base },
-- Setting the background of the lsp diagnostics - stuff like [d, [w -- Setting the background of the lsp diagnostics - stuff like [d, [w
@ -29,6 +30,9 @@ return {
-- Markdown headlines -- Markdown headlines
Headline1 = { bg = c.transparent }, Headline1 = { bg = c.transparent },
EyelinerPrimary = { fg = latte.red },
EyelinerSecondary = { fg = latte.peach },
-- Neogit -- Neogit
-- NeogitUnstagedchanges = { bg = c.base }, -- NeogitUnstagedchanges = { bg = c.base },
-- NeogitUnstagedchangesRegion = { bg = c.base }, -- NeogitUnstagedchangesRegion = { bg = c.base },

@ -35,6 +35,7 @@ return {
{ event = "notify", find = "No information available" }, { event = "notify", find = "No information available" },
{ event = "msg_show", find = "fewer lines" }, { event = "msg_show", find = "fewer lines" },
{ event = "msg_show", find = "more lines" }, { event = "msg_show", find = "more lines" },
{ event = "notify", find = "Compilation completed" },
{ {
event = "lsp", event = "lsp",
kind = "progress", kind = "progress",
@ -78,4 +79,12 @@ return {
shell = "fish", shell = "fish",
}, },
}, },
{
"jinh0/eyeliner.nvim",
config = function()
require("eyeliner").setup({
highlight_on_key = true,
})
end,
},
} }

@ -2,6 +2,7 @@ return {
{ {
"NeogitOrg/neogit", "NeogitOrg/neogit",
dependencies = "nvim-lua/plenary.nvim", dependencies = "nvim-lua/plenary.nvim",
cmd = { "Neogit" },
opts = { opts = {
disable_commit_confirmation = true, disable_commit_confirmation = true,
}, },

@ -1,210 +1,211 @@
local Util = require("lazyvim.util") return {}
-- local Util = require("lazyvim.util")
-- This is the same as in lspconfig.server_configurations.jdtls, but avoids --
-- needing to require that when this module loads. -- -- This is the same as in lspconfig.server_configurations.jdtls, but avoids
local java_filetypes = { "java" } -- -- needing to require that when this module loads.
-- local java_filetypes = { "java" }
-- Utility function to extend or override a config table, similar to the way --
-- that Plugin.opts works. -- -- Utility function to extend or override a config table, similar to the way
---@param config table -- -- that Plugin.opts works.
---@param custom function | table | nil -- ---@param config table
local function extend_or_override(config, custom, ...) -- ---@param custom function | table | nil
if type(custom) == "function" then -- local function extend_or_override(config, custom, ...)
config = custom(config, ...) or config -- if type(custom) == "function" then
elseif custom then -- config = custom(config, ...) or config
config = vim.tbl_deep_extend("force", config, custom) --[[@as table]] -- elseif custom then
end -- config = vim.tbl_deep_extend("force", config, custom) --[[@as table]]
return config -- end
end -- return config
-- end
return { --
-- Ensure java debugger and test packages are installed. -- return {
{ -- -- Ensure java debugger and test packages are installed.
"mfussenegger/nvim-dap", -- {
optional = true, -- "mfussenegger/nvim-dap",
dependencies = { -- optional = true,
{ -- dependencies = {
"williamboman/mason.nvim", -- {
opts = function(_, opts) -- "williamboman/mason.nvim",
opts.ensure_installed = opts.ensure_installed or {} -- opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "java-test", "java-debug-adapter" }) -- opts.ensure_installed = opts.ensure_installed or {}
end, -- vim.list_extend(opts.ensure_installed, { "java-test", "java-debug-adapter" })
}, -- end,
},
},
-- Configure nvim-lspconfig to install the server automatically via mason, but
-- defer actually starting it to our configuration of nvim-jtdls below.
{
"neovim/nvim-lspconfig",
opts = {
-- make sure mason installs the server
servers = {
jdtls = {},
},
setup = {
jdtls = function()
return true -- avoid duplicate servers
end,
},
},
},
-- Set up nvim-jdtls to attach to java files.
{
"mfussenegger/nvim-jdtls",
ft = java_filetypes,
opts = function()
return {
-- How to find the root dir for a given filename. The default comes from
-- lspconfig which provides a function specifically for java projects.
root_dir = require("lspconfig.server_configurations.jdtls").default_config.root_dir,
-- How to find the project name for a given root dir.
project_name = function(root_dir)
return root_dir and vim.fs.basename(root_dir)
end,
-- Where are the config and workspace dirs for a project?
jdtls_config_dir = function(project_name)
return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/config"
end,
jdtls_workspace_dir = function(project_name)
return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/workspace"
end,
-- How to run jdtls. This can be overridden to a full java command-line
-- if the Python wrapper script doesn't suffice.
cmd = { vim.fn.exepath("jdtls") },
full_cmd = function(opts)
local fname = vim.api.nvim_buf_get_name(0)
local root_dir = opts.root_dir(fname)
local project_name = opts.project_name(root_dir)
local cmd = vim.deepcopy(opts.cmd)
if project_name then
vim.list_extend(cmd, {
"-configuration",
opts.jdtls_config_dir(project_name),
"-data",
opts.jdtls_workspace_dir(project_name),
})
end
return cmd
end,
-- These depend on nvim-dap, but can additionally be disabled by setting false here.
dap = { hotcodereplace = "auto", config_overrides = {} },
test = true,
}
end,
config = function()
local opts = Util.opts("nvim-jdtls") or {}
-- Find the extra bundles that should be passed on the jdtls command-line
-- if nvim-dap is enabled with java debug/test.
local mason_registry = require("mason-registry")
local bundles = {} ---@type string[]
if opts.dap and Util.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then
local java_dbg_pkg = mason_registry.get_package("java-debug-adapter")
local java_dbg_path = java_dbg_pkg:get_install_path()
local jar_patterns = {
java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar",
}
-- java-test also depends on java-debug-adapter.
if opts.test and mason_registry.is_installed("java-test") then
local java_test_pkg = mason_registry.get_package("java-test")
local java_test_path = java_test_pkg:get_install_path()
vim.list_extend(jar_patterns, {
java_test_path .. "/extension/server/*.jar",
})
end
for _, jar_pattern in ipairs(jar_patterns) do
for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), "\n")) do
table.insert(bundles, bundle)
end
end
end
local function attach_jdtls()
local fname = vim.api.nvim_buf_get_name(0)
-- Configuration can be augmented and overridden by opts.jdtls
local config = extend_or_override({
cmd = opts.full_cmd(opts),
root_dir = opts.root_dir(fname),
init_options = {
bundles = bundles,
},
-- enable CMP capabilities
capabilities = require("cmp_nvim_lsp").default_capabilities(),
}, opts.jdtls)
-- Existing server will be reused if the root_dir matches.
require("jdtls").start_or_attach(config)
-- not need to require("jdtls.setup").add_commands(), start automatically adds commands
end
-- Attach the jdtls for each java buffer. HOWEVER, this plugin loads
-- depending on filetype, so this autocmd doesn't run for the first file.
-- For that, we call directly below.
vim.api.nvim_create_autocmd("FileType", {
pattern = java_filetypes,
callback = attach_jdtls,
})
-- Setup keymap and dap after the lsp is fully attached.
-- https://github.com/mfussenegger/nvim-jdtls#nvim-dap-configuration
-- https://neovim.io/doc/user/lsp.html#LspAttach
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client and client.name == "jdtls" then
-- ["<leader>cx"] = { name = "+extract" },
-- ["<leader>cxv"] = { require("jdtls").extract_variable_all, "Extract Variable" },
-- ["<leader>cxc"] = { require("jdtls").extract_constant, "Extract Constant" },
-- ["gs"] = { require("jdtls").super_implementation, "Goto Super" },
-- ["gS"] = { require("jdtls.tests").goto_subjects, "Goto Subjects" },
-- ["<leader>co"] = { require("jdtls").organize_imports, "Organize Imports" },
-- ["<leader>c"] = { name = "+code" },
-- ["<leader>cx"] = { name = "+extract" },
-- ["<leader>cxm"] = {
-- [[<ESC><CMD>lua require('jdtls').extract_method(true)<CR>]],
-- "Extract Method",
-- }, -- },
-- ["<leader>cxv"] = {
-- [[<ESC><CMD>lua require('jdtls').extract_variable_all(true)<CR>]],
-- "Extract Variable",
-- }, -- },
-- ["<leader>cxc"] = {
-- [[<ESC><CMD>lua require('jdtls').extract_constant(true)<CR>]],
-- "Extract Constant",
-- }, -- },
--
if opts.dap and Util.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then -- -- Configure nvim-lspconfig to install the server automatically via mason, but
-- custom init for Java debugger -- -- defer actually starting it to our configuration of nvim-jtdls below.
require("jdtls").setup_dap(opts.dap) -- {
require("jdtls.dap").setup_dap_main_class_configs() -- "neovim/nvim-lspconfig",
-- opts = {
-- Java Test require Java debugger to work -- -- make sure mason installs the server
if opts.test and mason_registry.is_installed("java-test") then -- servers = {
-- custom keymaps for Java test runner (not yet compatible with neotest) -- jdtls = {},
-- ["<leader>t"] = { name = "+test" }, -- },
-- ["<leader>tt"] = { require("jdtls.dap").test_class, "Run All Test" }, -- setup = {
-- ["<leader>tr"] = { require("jdtls.dap").test_nearest_method, "Run Nearest Test" }, -- jdtls = function()
-- ["<leader>tT"] = { require("jdtls.dap").pick_test, "Run Test" }, -- return true -- avoid duplicate servers
end -- end,
end -- },
-- },
-- User can set additional keymaps in opts.on_attach -- },
if opts.on_attach then --
opts.on_attach(args) -- -- Set up nvim-jdtls to attach to java files.
end -- {
end -- "mfussenegger/nvim-jdtls",
end, -- ft = java_filetypes,
}) -- opts = function()
-- return {
-- Avoid race condition by calling attach the first time, since the autocmd won't fire. -- -- How to find the root dir for a given filename. The default comes from
attach_jdtls() -- -- lspconfig which provides a function specifically for java projects.
end, -- root_dir = require("lspconfig.server_configurations.jdtls").default_config.root_dir,
}, --
} -- -- How to find the project name for a given root dir.
-- project_name = function(root_dir)
-- return root_dir and vim.fs.basename(root_dir)
-- end,
--
-- -- Where are the config and workspace dirs for a project?
-- jdtls_config_dir = function(project_name)
-- return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/config"
-- end,
-- jdtls_workspace_dir = function(project_name)
-- return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/workspace"
-- end,
--
-- -- How to run jdtls. This can be overridden to a full java command-line
-- -- if the Python wrapper script doesn't suffice.
-- cmd = { vim.fn.exepath("jdtls") },
-- full_cmd = function(opts)
-- local fname = vim.api.nvim_buf_get_name(0)
-- local root_dir = opts.root_dir(fname)
-- local project_name = opts.project_name(root_dir)
-- local cmd = vim.deepcopy(opts.cmd)
-- if project_name then
-- vim.list_extend(cmd, {
-- "-configuration",
-- opts.jdtls_config_dir(project_name),
-- "-data",
-- opts.jdtls_workspace_dir(project_name),
-- })
-- end
-- return cmd
-- end,
--
-- -- These depend on nvim-dap, but can additionally be disabled by setting false here.
-- dap = { hotcodereplace = "auto", config_overrides = {} },
-- test = true,
-- }
-- end,
-- config = function()
-- local opts = Util.opts("nvim-jdtls") or {}
--
-- -- Find the extra bundles that should be passed on the jdtls command-line
-- -- if nvim-dap is enabled with java debug/test.
-- local mason_registry = require("mason-registry")
-- local bundles = {} ---@type string[]
-- if opts.dap and Util.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then
-- local java_dbg_pkg = mason_registry.get_package("java-debug-adapter")
-- local java_dbg_path = java_dbg_pkg:get_install_path()
-- local jar_patterns = {
-- java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar",
-- }
-- -- java-test also depends on java-debug-adapter.
-- if opts.test and mason_registry.is_installed("java-test") then
-- local java_test_pkg = mason_registry.get_package("java-test")
-- local java_test_path = java_test_pkg:get_install_path()
-- vim.list_extend(jar_patterns, {
-- java_test_path .. "/extension/server/*.jar",
-- })
-- end
-- for _, jar_pattern in ipairs(jar_patterns) do
-- for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), "\n")) do
-- table.insert(bundles, bundle)
-- end
-- end
-- end
--
-- local function attach_jdtls()
-- local fname = vim.api.nvim_buf_get_name(0)
--
-- -- Configuration can be augmented and overridden by opts.jdtls
-- local config = extend_or_override({
-- cmd = opts.full_cmd(opts),
-- root_dir = opts.root_dir(fname),
-- init_options = {
-- bundles = bundles,
-- },
-- -- enable CMP capabilities
-- capabilities = require("cmp_nvim_lsp").default_capabilities(),
-- }, opts.jdtls)
--
-- -- Existing server will be reused if the root_dir matches.
-- require("jdtls").start_or_attach(config)
-- -- not need to require("jdtls.setup").add_commands(), start automatically adds commands
-- end
--
-- -- Attach the jdtls for each java buffer. HOWEVER, this plugin loads
-- -- depending on filetype, so this autocmd doesn't run for the first file.
-- -- For that, we call directly below.
-- vim.api.nvim_create_autocmd("FileType", {
-- pattern = java_filetypes,
-- callback = attach_jdtls,
-- })
--
-- -- Setup keymap and dap after the lsp is fully attached.
-- -- https://github.com/mfussenegger/nvim-jdtls#nvim-dap-configuration
-- -- https://neovim.io/doc/user/lsp.html#LspAttach
-- vim.api.nvim_create_autocmd("LspAttach", {
-- callback = function(args)
-- local client = vim.lsp.get_client_by_id(args.data.client_id)
-- if client and client.name == "jdtls" then
-- -- ["<leader>cx"] = { name = "+extract" },
-- -- ["<leader>cxv"] = { require("jdtls").extract_variable_all, "Extract Variable" },
-- -- ["<leader>cxc"] = { require("jdtls").extract_constant, "Extract Constant" },
-- -- ["gs"] = { require("jdtls").super_implementation, "Goto Super" },
-- -- ["gS"] = { require("jdtls.tests").goto_subjects, "Goto Subjects" },
-- -- ["<leader>co"] = { require("jdtls").organize_imports, "Organize Imports" },
-- -- ["<leader>c"] = { name = "+code" },
-- -- ["<leader>cx"] = { name = "+extract" },
-- -- ["<leader>cxm"] = {
-- -- [[<ESC><CMD>lua require('jdtls').extract_method(true)<CR>]],
-- -- "Extract Method",
-- -- },
-- -- ["<leader>cxv"] = {
-- -- [[<ESC><CMD>lua require('jdtls').extract_variable_all(true)<CR>]],
-- -- "Extract Variable",
-- -- },
-- -- ["<leader>cxc"] = {
-- -- [[<ESC><CMD>lua require('jdtls').extract_constant(true)<CR>]],
-- -- "Extract Constant",
-- -- },
--
-- if opts.dap and Util.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then
-- -- custom init for Java debugger
-- require("jdtls").setup_dap(opts.dap)
-- require("jdtls.dap").setup_dap_main_class_configs()
--
-- -- Java Test require Java debugger to work
-- if opts.test and mason_registry.is_installed("java-test") then
-- -- custom keymaps for Java test runner (not yet compatible with neotest)
-- -- ["<leader>t"] = { name = "+test" },
-- -- ["<leader>tt"] = { require("jdtls.dap").test_class, "Run All Test" },
-- -- ["<leader>tr"] = { require("jdtls.dap").test_nearest_method, "Run Nearest Test" },
-- -- ["<leader>tT"] = { require("jdtls.dap").pick_test, "Run Test" },
-- end
-- end
--
-- -- User can set additional keymaps in opts.on_attach
-- if opts.on_attach then
-- opts.on_attach(args)
-- end
-- end
-- end,
-- })
--
-- -- Avoid race condition by calling attach the first time, since the autocmd won't fire.
-- attach_jdtls()
-- end,
-- },
-- }

@ -25,6 +25,8 @@ return {
}, },
---@class PluginLspOpts ---@class PluginLspOpts
init = function() init = function()
require("lspconfig.ui.windows").default_options.border = "rounded"
local keys = require("lazyvim.plugins.lsp.keymaps").get() local keys = require("lazyvim.plugins.lsp.keymaps").get()
local function swap_prefix(before, after) local function swap_prefix(before, after)
for _, keymap in ipairs(keys) do for _, keymap in ipairs(keys) do
@ -70,9 +72,6 @@ return {
end, end,
}, },
}, },
config = function()
require("lspconfig.ui.windows").default_options.border = "rounded"
end,
}, },
{ {
"williamboman/mason.nvim", "williamboman/mason.nvim",

@ -36,6 +36,12 @@ return {
}, },
}) })
require("mini.pick").setup() require("mini.pick").setup()
require("mini.indentscope").setup({
draw = {
delay = 0,
animation = require('mini.indentscope').gen_animation.none()
}
})
end, end,
keys = { keys = {
{ {

Loading…
Cancel
Save