mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
add(nvim): dap configurations
This commit is contained in:
parent
9adc476f6b
commit
263a551ddb
4 changed files with 149 additions and 91 deletions
|
|
@ -1,70 +1,71 @@
|
|||
-- local use_light = function()
|
||||
-- vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
-- callback = function()
|
||||
-- -- LSP window border color
|
||||
-- vim.cmd("highlight NormalFloat guibg=white")
|
||||
-- vim.cmd("highlight FloatBorder guifg=black guibg=white")
|
||||
--
|
||||
-- -- Tune virtual text colors
|
||||
-- -- vim.cmd ("highlight DiagnosticError gui=bold")
|
||||
-- -- vim.cmd ("highlight DiagnosticWarn gui=italic")
|
||||
-- -- vim.cmd ("highlight DiagnosticInfo guibg=black guibg=italic")
|
||||
-- -- vim.cmd ("highlight DiagnosticHint guibg=black")
|
||||
--
|
||||
-- -- TreesitterContext border
|
||||
-- vim.cmd("highlight TreesitterContext guibg=#EEEEEE")
|
||||
-- vim.cmd("highlight TreesitterContextBottom guibg=#EEEEEE gui=underline guisp=Grey")
|
||||
--
|
||||
-- -- Diff colors override
|
||||
-- vim.cmd("highlight DiffAdd guibg=#f0f0f0")
|
||||
-- vim.cmd("highlight DiffChange guibg=#f0f0f0")
|
||||
-- vim.cmd("highlight DiffDelete guibg=#f0f0f0")
|
||||
-- vim.cmd("highlight DiffText guibg=#f0f0f0")
|
||||
-- vim.cmd("highlight DiffAdded guibg=#f0f0f0")
|
||||
-- vim.cmd("highlight DiffFile guibg=#f0f0f0")
|
||||
-- vim.cmd("highlight DiffNewFile guibg=#f0f0f0")
|
||||
-- vim.cmd("highlight DiffLine guibg=#f0f0f0")
|
||||
-- vim.cmd("highlight DiffRemoved guibg=#f0f0f0")
|
||||
-- end,
|
||||
-- group = vim.api.nvim_create_augroup("MyColorOverride", { clear = true }),
|
||||
-- pattern = "*",
|
||||
-- })
|
||||
--
|
||||
-- vim.o.background = "light"
|
||||
-- end
|
||||
--
|
||||
-- local use_dark = function()
|
||||
-- vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
-- callback = function()
|
||||
-- -- LSP window border color
|
||||
-- vim.cmd("highlight NormalFloat guibg=black")
|
||||
-- vim.cmd("highlight FloatBorder guifg=white guibg=black")
|
||||
--
|
||||
-- -- Tune virtual text colors
|
||||
-- -- vim.cmd "highlight DiagnosticError gui=bold"
|
||||
-- -- vim.cmd "highlight DiagnosticWarn gui=italic"
|
||||
-- -- vim.cmd "highlight DiagnosticInfo guifg=white guibg=black"
|
||||
-- -- vim.cmd "highlight DiagnosticHint guifg=white guibg=black"
|
||||
--
|
||||
-- -- TreesitterContext border
|
||||
-- vim.cmd("highlight TreesitterContext guibg=#555555")
|
||||
-- vim.cmd("highlight TreesitterContextBottom guibg=#555555 gui=underline guisp=LightGrey")
|
||||
--
|
||||
-- -- Diff colors override
|
||||
-- vim.cmd("highlight DiffAdd guibg=#303030")
|
||||
-- vim.cmd("highlight DiffChange guibg=#303030")
|
||||
-- vim.cmd("highlight DiffDelete guibg=#303030")
|
||||
-- vim.cmd("highlight DiffText guibg=#303030")
|
||||
-- vim.cmd("highlight DiffAdded guibg=#303030")
|
||||
-- vim.cmd("highlight DiffFile guibg=#303030")
|
||||
-- vim.cmd("highlight DiffNewFile guibg=#303030")
|
||||
-- vim.cmd("highlight DiffLine guibg=#303030")
|
||||
-- vim.cmd("highlight DiffRemoved guibg=#303030")
|
||||
-- end,
|
||||
-- group = vim.api.nvim_create_augroup("MyColorOverride", { clear = true }),
|
||||
-- pattern = "*",
|
||||
-- })
|
||||
-- vim.o.background = "dark"
|
||||
-- end
|
||||
--
|
||||
-- use_light()
|
||||
vim.cmd.colorscheme "one-nvim"
|
||||
local use_light = function()
|
||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
callback = function()
|
||||
-- LSP window border color
|
||||
vim.cmd("highlight NormalFloat guibg=white")
|
||||
vim.cmd("highlight FloatBorder guifg=black guibg=white")
|
||||
|
||||
-- Tune virtual text colors
|
||||
-- vim.cmd ("highlight DiagnosticError gui=bold")
|
||||
-- vim.cmd ("highlight DiagnosticWarn gui=italic")
|
||||
-- vim.cmd ("highlight DiagnosticInfo guibg=black guibg=italic")
|
||||
-- vim.cmd ("highlight DiagnosticHint guibg=black")
|
||||
|
||||
-- TreesitterContext border
|
||||
vim.cmd("highlight TreesitterContext guibg=#EEEEEE")
|
||||
vim.cmd("highlight TreesitterContextBottom guibg=#EEEEEE gui=underline guisp=Grey")
|
||||
|
||||
-- Diff colors override
|
||||
vim.cmd("highlight DiffAdd guibg=#f0f0f0")
|
||||
vim.cmd("highlight DiffChange guibg=#f0f0f0")
|
||||
vim.cmd("highlight DiffDelete guibg=#f0f0f0")
|
||||
vim.cmd("highlight DiffText guibg=#f0f0f0")
|
||||
vim.cmd("highlight DiffAdded guibg=#f0f0f0")
|
||||
vim.cmd("highlight DiffFile guibg=#f0f0f0")
|
||||
vim.cmd("highlight DiffNewFile guibg=#f0f0f0")
|
||||
vim.cmd("highlight DiffLine guibg=#f0f0f0")
|
||||
vim.cmd("highlight DiffRemoved guibg=#f0f0f0")
|
||||
end,
|
||||
group = vim.api.nvim_create_augroup("MyColorOverride", { clear = true }),
|
||||
pattern = "*",
|
||||
})
|
||||
|
||||
vim.o.background = "light"
|
||||
end
|
||||
|
||||
local use_dark = function()
|
||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
callback = function()
|
||||
-- LSP window border color
|
||||
vim.cmd("highlight NormalFloat guibg=black")
|
||||
vim.cmd("highlight FloatBorder guifg=white guibg=black")
|
||||
|
||||
-- Tune virtual text colors
|
||||
-- vim.cmd "highlight DiagnosticError gui=bold"
|
||||
-- vim.cmd "highlight DiagnosticWarn gui=italic"
|
||||
-- vim.cmd "highlight DiagnosticInfo guifg=white guibg=black"
|
||||
-- vim.cmd "highlight DiagnosticHint guifg=white guibg=black"
|
||||
|
||||
-- TreesitterContext border
|
||||
vim.cmd("highlight TreesitterContext guibg=#555555")
|
||||
vim.cmd("highlight TreesitterContextBottom guibg=#555555 gui=underline guisp=LightGrey")
|
||||
|
||||
-- Diff colors override
|
||||
vim.cmd("highlight DiffAdd guibg=#303030")
|
||||
vim.cmd("highlight DiffChange guibg=#303030")
|
||||
vim.cmd("highlight DiffDelete guibg=#303030")
|
||||
vim.cmd("highlight DiffText guibg=#303030")
|
||||
vim.cmd("highlight DiffAdded guibg=#303030")
|
||||
vim.cmd("highlight DiffFile guibg=#303030")
|
||||
vim.cmd("highlight DiffNewFile guibg=#303030")
|
||||
vim.cmd("highlight DiffLine guibg=#303030")
|
||||
vim.cmd("highlight DiffRemoved guibg=#303030")
|
||||
end,
|
||||
group = vim.api.nvim_create_augroup("MyColorOverride", { clear = true }),
|
||||
pattern = "*",
|
||||
})
|
||||
vim.o.background = "dark"
|
||||
end
|
||||
|
||||
use_light()
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
require "mason".setup()
|
||||
require "mason-lspconfig".setup({
|
||||
require "mason-lspconfig".setup {
|
||||
ensure_installed = {},
|
||||
automatic_installation = false
|
||||
})
|
||||
}
|
||||
require "neodev".setup()
|
||||
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = "open diagnostic in a float window" })
|
||||
|
|
@ -30,6 +30,7 @@ local on_attach = function(_, bufnr)
|
|||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', 'gu', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', '<leader>cl', vim.lsp.codelens.run, bufopts)
|
||||
vim.keymap.set('n', '<leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
vim.keymap.set('n', '<leader>r', rename, bufopts)
|
||||
end
|
||||
|
|
@ -125,13 +126,65 @@ require "lspconfig".pylsp.setup {
|
|||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
-- Scala
|
||||
require "lspconfig".metals.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
-- C
|
||||
require "lspconfig".clangd.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
-- DAP
|
||||
local dap = require "dap"
|
||||
|
||||
vim.keymap.set("n", "<leader>dc", function() dap.continue() end)
|
||||
vim.keymap.set("n", "<leader>dr", function() dap.repl.toggle() end)
|
||||
vim.keymap.set("n", "<leader>dK", function() require "dap.ui.widgets".hover() end)
|
||||
vim.keymap.set("n", "<leader>dt", function() dap.toggle_breakpoint() end)
|
||||
vim.keymap.set("n", "<leader>dso", function() dap.step_over() end)
|
||||
vim.keymap.set("n", "<leader>dsi", function() dap.step_into() end)
|
||||
vim.keymap.set("n", "<leader>dl", function() dap.run_last() end)
|
||||
|
||||
-- Scala Metals
|
||||
local metals = require "metals"
|
||||
local metals_config = metals.bare_config()
|
||||
|
||||
dap.configurations.scala = {
|
||||
{
|
||||
type = "scala",
|
||||
request = "launch",
|
||||
name = "Run",
|
||||
metals = {
|
||||
runType = "run",
|
||||
},
|
||||
},
|
||||
{
|
||||
type = "scala",
|
||||
request = "launch",
|
||||
name = "Test File",
|
||||
metals = {
|
||||
runType = "testFile",
|
||||
},
|
||||
},
|
||||
{
|
||||
type = "scala",
|
||||
request = "launch",
|
||||
name = "Test Target",
|
||||
metals = {
|
||||
runType = "testTarget",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
metals_config.on_attach = function(client, bufnr)
|
||||
on_attach(client, bufnr)
|
||||
require("metals").setup_dap()
|
||||
end
|
||||
|
||||
metals_config.capabilities = capabilities
|
||||
local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true })
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "scala", "sbt" },
|
||||
callback = function()
|
||||
metals.initialize_or_attach(metals_config)
|
||||
end,
|
||||
group = nvim_metals_group,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue