dap and removed java
This commit is contained in:
parent
1999612bf2
commit
d7d344af1b
@ -20,21 +20,3 @@ vim.api.nvim_create_autocmd("BufReadPost", {
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('my.lsp', {}),
|
||||
callback = function(args)
|
||||
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||
-- Usually not needed if server supports "textDocument/willSaveWaitUntil".
|
||||
if not client:supports_method('textDocument/willSaveWaitUntil')
|
||||
and client:supports_method('textDocument/formatting') then
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
group = vim.api.nvim_create_augroup('my.lsp', { clear = false }),
|
||||
buffer = args.buf,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = args.buf, id = client.id, timeout_ms = 1000 })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
@ -4,40 +4,3 @@ vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" })
|
||||
|
||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
||||
-- is not what someone will guess without a bit more experience.
|
||||
--
|
||||
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
|
||||
-- or just use <C-\><C-n> to exit terminal mode
|
||||
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
|
||||
|
||||
-- TIP: Disable arrow keys in normal mode
|
||||
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||
|
||||
-- Keybinds to make split navigation easier.
|
||||
-- Use CTRL+<hjkl> to switch between windows
|
||||
--
|
||||
-- See `:help wincmd` for a list of all window commands
|
||||
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
|
||||
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
|
||||
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
|
||||
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })
|
||||
|
||||
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
|
||||
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
|
||||
-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
|
||||
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
|
||||
-- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })
|
||||
|
||||
-- DAP keymaps
|
||||
vim.keymap.set("n", "<leader>db", "<cmd>lua require'dap'.toggle_breakpoint()<CR>", { desc = "Toggle [B]reakpoint" })
|
||||
vim.keymap.set("n", "<leader>dc", "<cmd>lua require'dap'.continue()<CR>", { desc = "[C]ontinue" })
|
||||
vim.keymap.set("n", "<leader>di", "<cmd>lua require'dap'.step_into()<CR>", { desc = "Step [I]nto" })
|
||||
vim.keymap.set("n", "<leader>do", "<cmd>lua require'dap'.step_over()<CR>", { desc = "Step [O]ver" })
|
||||
vim.keymap.set("n", "<leader>dO", "<cmd>lua require'dap'.step_out()<CR>", { desc = "Step [O]ut" })
|
||||
vim.keymap.set("n", "<leader>dr", "<cmd>lua require'dap'.repl.open()<CR>", { desc = "Open [R]EPL" })
|
||||
|
||||
@ -25,9 +25,7 @@ vim.o.breakindent = true -- keep indentation on wrapped lines (if wrap is enable
|
||||
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
||||
-- Remove this option if you want your OS clipboard to remain independent.
|
||||
-- See `:help 'clipboard'`
|
||||
vim.schedule(function()
|
||||
vim.o.clipboard = "unnamedplus"
|
||||
end)
|
||||
vim.o.clipboard = "unnamedplus"
|
||||
vim.o.swapfile = false -- no swapfiles
|
||||
vim.o.undofile = true -- persistent undo
|
||||
vim.o.writebackup = false -- do not keep backup around
|
||||
@ -47,7 +45,7 @@ vim.o.completeopt = "menu,menuone,noinsert,noselect"
|
||||
vim.o.shortmess = (vim.o.shortmess or "") .. "c" -- reduce completion messages
|
||||
|
||||
-- Performance and input timing
|
||||
vim.o.timeoutlen = 300 -- mapped sequence timeout
|
||||
vim.o.timeoutlen = 800 -- mapped sequence timeout
|
||||
vim.o.updatetime = 250 -- faster CursorHold/diagnostic updates
|
||||
vim.o.scrolloff = 10 -- context lines around cursor
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ return { -- Autocompletion
|
||||
},
|
||||
--- @module 'blink.cmp'
|
||||
--- @type blink.cmp.Config
|
||||
|
||||
opts = {
|
||||
keymap = {
|
||||
-- set to 'none' to disable the 'default' preset
|
||||
@ -38,10 +39,10 @@ return { -- Autocompletion
|
||||
["<C-j>"] = { "select_next", "fallback" },
|
||||
["<C-b>"] = { "scroll_documentation_up", "fallback" },
|
||||
["<C-f>"] = { "scroll_documentation_down", "fallback" },
|
||||
["<Tab>"] = { "snippet_forward", "fallback" },
|
||||
["<S-Tab>"] = { "snippet_backward", "fallback" },
|
||||
-- ["<S-Tab>"] = { "select_prev", "fallback" },
|
||||
-- ["<Tab>"] = { "select_next", "fallback" },
|
||||
-- ["<Tab>"] = { "snippet_forward", "fallback" },
|
||||
-- ["<S-Tab>"] = { "snippet_backward", "fallback" },
|
||||
["<S-Tab>"] = { "select_prev", "fallback" },
|
||||
["<Tab>"] = { "select_next", "fallback" },
|
||||
|
||||
["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
|
||||
["<CR>"] = { "select_and_accept", "fallback" },
|
||||
|
||||
@ -6,7 +6,7 @@ return {
|
||||
keywords = {
|
||||
TODO = { icon = "🤨", color = "info" },
|
||||
WIP = { icon = "🥵", color = "warning" },
|
||||
ERR = { icon = "🤬", color = "error" },
|
||||
ERROR = { icon = "🤬", color = "error" },
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
56
nvim/lua/kanopo/plugins/dap.lua
Normal file
56
nvim/lua/kanopo/plugins/dap.lua
Normal file
@ -0,0 +1,56 @@
|
||||
return {
|
||||
"mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
"nvim-neotest/nvim-nio",
|
||||
},
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
|
||||
dapui.setup()
|
||||
require("nvim-dap-virtual-text").setup({})
|
||||
|
||||
local map = function(keys, func, desc)
|
||||
vim.keymap.set("n", keys, func, { desc = "DAP: " .. desc })
|
||||
end
|
||||
|
||||
map("<leader>db", dap.toggle_breakpoint, "Toggle [B]reakpoint")
|
||||
map("<leader>dc", dap.continue, "[C]ontinue")
|
||||
map("<leader>di", dap.step_into, "Step [I]nto")
|
||||
map("<leader>do", dap.step_over, "Step [O]ver")
|
||||
map("<leader>dO", dap.step_out, "Step [O]ut")
|
||||
map("<leader>dr", dap.repl.open, "Open [R]EPL")
|
||||
map("<leader>dt", dap.terminate, "[T]erminate")
|
||||
map("<leader>du", dapui.toggle, "Toggle [U]I")
|
||||
|
||||
local debuggers = {
|
||||
delve = {},
|
||||
}
|
||||
|
||||
local ensure_installed = vim.tbl_keys(debuggers)
|
||||
|
||||
require("mason-nvim-dap").setup({
|
||||
ensure_installed = ensure_installed,
|
||||
automatic_installation = true,
|
||||
handlers = {
|
||||
function(config)
|
||||
require("mason-nvim-dap").default_setup(config)
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
end,
|
||||
}
|
||||
@ -3,6 +3,6 @@ return {
|
||||
opts = {
|
||||
inputs = {
|
||||
enable = true,
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
|
||||
return { -- Autoformat
|
||||
return { -- Autoformat
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufWritePre" },
|
||||
cmd = { "ConformInfo" },
|
||||
@ -38,4 +37,4 @@
|
||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,10 +5,6 @@ return {
|
||||
"sindrets/diffview.nvim",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
},
|
||||
-- config = function()
|
||||
-- require("neogit").setup()
|
||||
-- vim.keymap.set("n", "<leader>gg", "<cmd>Neogit<cr>", { desc = "Neogit" })
|
||||
-- end,
|
||||
opts = true,
|
||||
keys = {
|
||||
{ "<leader>gg", "<cmd>Neogit<cr>", desc = "Neogit" },
|
||||
|
||||
@ -3,4 +3,3 @@ return {
|
||||
event = "BufRead",
|
||||
opts = {},
|
||||
}
|
||||
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
return {
|
||||
"mfussenegger/nvim-jdtls",
|
||||
ft = "java",
|
||||
config = function()
|
||||
local lombok_dir = vim.fn.stdpath("data") .. "/lombok"
|
||||
local lombok_path = lombok_dir .. "/lombok.jar"
|
||||
|
||||
if not vim.loop.fs_stat(lombok_path) then
|
||||
vim.fn.mkdir(lombok_dir, "p")
|
||||
print("Downloading lombok.jar...")
|
||||
local lombok_url = "https://projectlombok.org/downloads/lombok.jar"
|
||||
vim.fn.system({ "curl", "-L", "-o", lombok_path, lombok_url })
|
||||
print("lombok.jar downloaded to " .. lombok_path)
|
||||
end
|
||||
|
||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
|
||||
local config = {
|
||||
cmd = {
|
||||
"jdtls",
|
||||
"--jvm-arg=-javaagent:" .. lombok_path,
|
||||
},
|
||||
root_dir = vim.fs.root(0, { ".git", "mvnw", "gradlew" }) or vim.fn.getcwd(),
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require("jdtls").start_or_attach(config)
|
||||
end,
|
||||
}
|
||||
@ -1,5 +1,4 @@
|
||||
|
||||
return {
|
||||
return {
|
||||
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
||||
-- used for completion, annotations and signatures of Neovim apis
|
||||
"folke/lazydev.nvim",
|
||||
@ -10,4 +9,4 @@
|
||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,6 +13,8 @@ return {
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
|
||||
callback = function(event)
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
|
||||
local map = function(keys, func, desc, mode)
|
||||
mode = mode or "n"
|
||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
|
||||
@ -61,7 +63,7 @@ return {
|
||||
-- code, if the language server you are using supports them
|
||||
--
|
||||
-- This may be unwanted, since they displace some of your code
|
||||
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
|
||||
if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
|
||||
map("<leader>th", function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf }))
|
||||
end, "[T]oggle Inlay [H]ints")
|
||||
@ -98,28 +100,11 @@ return {
|
||||
},
|
||||
})
|
||||
|
||||
-- LSP servers and clients are able to communicate to each other what features they support.
|
||||
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
||||
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
|
||||
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
|
||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
|
||||
-- Enable the following language servers
|
||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||
--
|
||||
-- Add any additional override configuration in the following tables. Available keys are:
|
||||
-- - cmd (table): Override the default command used to start the server
|
||||
-- - filetypes (table): Override the default list of associated filetypes for the server
|
||||
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
|
||||
-- - settings (table): Override the default settings passed when initializing the server.
|
||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||
local servers = {
|
||||
texlab = {},
|
||||
rust_analyzer = {},
|
||||
cssls = {},
|
||||
astro = {},
|
||||
tailwindcss = {},
|
||||
pylsp = {},
|
||||
ts_ls = {},
|
||||
gopls = {},
|
||||
postgres_lsp = {},
|
||||
@ -129,45 +114,24 @@ return {
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||
-- diagnostics = { disable = { 'missing-fields' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Ensure the servers and tools above are installed
|
||||
--
|
||||
-- To check the current status of installed tools and/or manually install
|
||||
-- other tools, you can run
|
||||
-- :Mason
|
||||
--
|
||||
-- You can press `g?` for help in this menu.
|
||||
--
|
||||
-- `mason` had to be setup earlier: to configure its options see the
|
||||
-- `dependencies` table for `nvim-lspconfig` above.
|
||||
--
|
||||
-- You can add other tools here that you want Mason to install
|
||||
-- for you, so that they are available from within Neovim.
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
"stylua", -- Used to format Lua code
|
||||
})
|
||||
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
|
||||
automatic_installation = true,
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local server = servers[server_name] or {}
|
||||
for server_name, server in pairs(servers) do
|
||||
-- This handles overriding only values explicitly passed
|
||||
-- by the server configuration above. Useful when disabling
|
||||
-- certain features of an LSP (for example, turning off formatting for ts_ls)
|
||||
server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
|
||||
require("lspconfig")[server_name].setup(server)
|
||||
end,
|
||||
},
|
||||
})
|
||||
vim.lsp.config(server_name, server)
|
||||
vim.lsp.enable(server_name)
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
return {
|
||||
'stevearc/oil.nvim',
|
||||
"stevearc/oil.nvim",
|
||||
opts = {},
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if prefer nvim-web-devicons
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
require("oil").setup()
|
||||
vim.keymap.set('n', '<leader>fe', "<cmd>:Oil<cr>")
|
||||
end
|
||||
vim.keymap.set("n", "<leader>fe", "<cmd>:Oil<cr>")
|
||||
end,
|
||||
}
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
return {
|
||||
"ellisonleao/gruvbox.nvim",
|
||||
priority = 1000 ,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.o.background = "dark" -- or "light" for light mode
|
||||
vim.cmd([[colorscheme gruvbox]])
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
@ -1,52 +1,19 @@
|
||||
return { -- Useful plugin to show you pending keybinds.
|
||||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VimEnter", -- Sets the loading event to 'VimEnter'
|
||||
event = "VimEnter",
|
||||
opts = {
|
||||
-- delay between pressing a key and opening which-key (milliseconds)
|
||||
-- this setting is independent of vim.o.timeoutlen
|
||||
delay = 0,
|
||||
icons = {
|
||||
-- set icon mappings to true if you have a Nerd Font
|
||||
mappings = vim.g.have_nerd_font,
|
||||
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
|
||||
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table
|
||||
keys = vim.g.have_nerd_font and {} or {
|
||||
Up = "<Up> ",
|
||||
Down = "<Down> ",
|
||||
Left = "<Left> ",
|
||||
Right = "<Right> ",
|
||||
C = "<C-…> ",
|
||||
M = "<M-…> ",
|
||||
D = "<D-…> ",
|
||||
S = "<S-…> ",
|
||||
CR = "<CR> ",
|
||||
Esc = "<Esc> ",
|
||||
ScrollWheelDown = "<ScrollWheelDown> ",
|
||||
ScrollWheelUp = "<ScrollWheelUp> ",
|
||||
NL = "<NL> ",
|
||||
BS = "<BS> ",
|
||||
Space = "<Space> ",
|
||||
Tab = "<Tab> ",
|
||||
F1 = "<F1>",
|
||||
F2 = "<F2>",
|
||||
F3 = "<F3>",
|
||||
F4 = "<F4>",
|
||||
F5 = "<F5>",
|
||||
F6 = "<F6>",
|
||||
F7 = "<F7>",
|
||||
F8 = "<F8>",
|
||||
F9 = "<F9>",
|
||||
F10 = "<F10>",
|
||||
F11 = "<F11>",
|
||||
F12 = "<F12>",
|
||||
},
|
||||
},
|
||||
|
||||
-- Document existing key chains
|
||||
spec = {
|
||||
{ "<leader>s", group = "[S]earch" },
|
||||
{ "<leader>t", group = "[T]oggle" },
|
||||
{ "<leader>d", group = "[D]ebug" },
|
||||
{ "<leader>h", group = "Git [H]unk", mode = { "n", "v" } },
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user