dap'n
This commit is contained in:
parent
7e2e0bdc3a
commit
0f183fba0e
|
@ -0,0 +1,75 @@
|
|||
local ok, dap = pcall(require, 'dap')
|
||||
if ok then
|
||||
vim.keymap.set("n", "<Leader>dl", function() dap.step_into() end)
|
||||
vim.keymap.set("n", "<Leader>dj", function() dap.step_over() end)
|
||||
vim.keymap.set("n", "<Leader>dk", function() dap.step_out() end)
|
||||
vim.keymap.set("n", "<Leader>dc", function() dap.continue() end)
|
||||
vim.keymap.set("n", "<Leader>db", function() dap.toggle_breakpoint() end)
|
||||
vim.keymap.set("n", "<Leader>db>", function()
|
||||
dap.set_breakpoint(vim.fn.input('Breakpoint condition: '))
|
||||
end)
|
||||
vim.keymap.set("n", "<Leader>dd", function() dap.terminate() end)
|
||||
vim.keymap.set("n", "<Leader>dr", function() dap.run_last() end)
|
||||
--vim.keymap.set("n", "<Leader>dt", "<cmd>lua vim.cmd('RustLsp testables')<Cr>")
|
||||
|
||||
|
||||
-- vim.api.nvim_set_hl(namespace, 'DapBreakpoint', { fg='#993939', bg='#31353f' })
|
||||
-- vim.api.nvim_set_hl(namespace, 'DapLogPoint', { fg='#61afef', bg='#31353f' })
|
||||
-- vim.api.nvim_set_hl(namespace, 'DapStopped', { fg='#98c379', bg='#31353f' })
|
||||
|
||||
-- Reuse current SignColumn background (except for DapStoppedLine)
|
||||
local sign_column_hl = vim.api.nvim_get_hl(0, { name = 'SignColumn' })
|
||||
-- if bg or ctermbg aren't found, use bg = 'bg' (which means current Normal) and ctermbg = 'Black'
|
||||
-- convert to 6 digit hex value starting with #
|
||||
local sign_column_bg = (sign_column_hl.bg ~= nil) and ('#%06x'):format(sign_column_hl.bg) or 'bg'
|
||||
local sign_column_ctermbg = (sign_column_hl.ctermbg ~= nil) and sign_column_hl.ctermbg or 'Black'
|
||||
|
||||
vim.api.nvim_set_hl(0, 'DapStopped', { fg = '#00ff00', bg = sign_column_bg, ctermbg = sign_column_ctermbg })
|
||||
vim.api.nvim_set_hl(0, 'DapStoppedLine', { bg = '#2e4d3d', ctermbg = 'Green' })
|
||||
vim.api.nvim_set_hl(0, 'DapBreakpoint', { fg = '#c23127', bg = sign_column_bg, ctermbg = sign_column_ctermbg })
|
||||
vim.api.nvim_set_hl(0, 'DapBreakpointRejected', { fg = '#888ca6', bg = sign_column_bg, ctermbg = sign_column_ctermbg })
|
||||
vim.api.nvim_set_hl(0, 'DapLogPoint', { fg = '#61afef', bg = sign_column_bg, ctermbg = sign_column_ctermbg })
|
||||
|
||||
|
||||
vim.fn.sign_define('DapBreakpoint', { text='•', texthl='DapBreakpoint', linehl='DapBreakpoint', numhl='DapBreakpoint' })
|
||||
vim.fn.sign_define('DapBreakpointCondition', { text='ﳁ', texthl='DapBreakpoint', linehl='DapBreakpoint', numhl='DapBreakpoint' })
|
||||
vim.fn.sign_define('DapBreakpointRejected', { text='', texthl='DapBreakpoint', linehl='DapBreakpoint', numhl= 'DapBreakpoint' })
|
||||
vim.fn.sign_define('DapLogPoint', { text='', texthl='DapLogPoint', linehl='DapLogPoint', numhl= 'DapLogPoint' })
|
||||
vim.fn.sign_define('DapStopped', { text='', texthl='DapStopped', linehl='DapStopped', numhl= 'DapStopped' })
|
||||
|
||||
|
||||
local ok, dapui = pcall(require, 'dapui')
|
||||
if ok then
|
||||
dapui.setup()
|
||||
dap.listeners.before.attach.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.launch.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
|
||||
|
||||
dap.configurations.rust = {
|
||||
{
|
||||
name = "Launch",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
--return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/target/debug/", "file")
|
||||
if vim.fn.expand("%:t:r") == "main" then
|
||||
return vim.fn.getcwd() .. "/target/debug/" .. vim.fn.fnamemodify(vim.fn.getcwd(), ':t')
|
||||
else
|
||||
return vim.fn.getcwd() .. "/target/debug/" .. vim.fn.fnameescape(vim.fn.expand("%:t:r"))
|
||||
end
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
stopOnEntry = false,
|
||||
},
|
||||
}
|
||||
end
|
|
@ -142,6 +142,16 @@ if ok then
|
|||
"github:mason-org/mason-registry",
|
||||
},
|
||||
})
|
||||
require('mason-nvim-dap').setup({
|
||||
ensure_installed = {
|
||||
"codelldb",
|
||||
},
|
||||
handlers = {
|
||||
function(config)
|
||||
require("mason-nvim-dap").default_setup(config)
|
||||
end,
|
||||
}
|
||||
})
|
||||
require('mason-lspconfig').setup({
|
||||
ensure_installed = {
|
||||
--"markdownlint-cli2",
|
||||
|
@ -172,6 +182,14 @@ if ok then
|
|||
end
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
src = "greyscript"
|
||||
}
|
||||
})
|
||||
|
||||
lsp.greybel.setup({})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
|
|
|
@ -22,13 +22,13 @@ vim.o.ignorecase = true
|
|||
vim.opt.updatetime = 50
|
||||
--vim.opt.colorcolumn = "80"
|
||||
--vim.cmd('colorscheme vim')
|
||||
vim.cmd('colorscheme tokyonight')
|
||||
--vim.cmd('colorscheme tokyonight')
|
||||
vim.cmd('colorscheme eldritch')
|
||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
|
||||
|
||||
vim.cmd('hi SignColumn ctermbg=0')
|
||||
vim.cmd('set signcolumn=no')
|
||||
|
||||
vim.cmd('hi Pmenu ctermfg=120')
|
||||
vim.cmd('hi Pmenu ctermbg=0')
|
||||
|
@ -43,13 +43,6 @@ vim.opt.termguicolors = true
|
|||
--vim.api.nvim_set_hl(0, '@lsp.type.comment.cpp', {})
|
||||
|
||||
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
src = "greyscript"
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
-- make no file extension go to sh type
|
||||
vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, {
|
||||
pattern = "*",
|
||||
|
|
|
@ -19,6 +19,8 @@ return require('packer').startup(function(use)
|
|||
|
||||
use { "rose-pine/neovim", as = "rose-pine" }
|
||||
use { "folke/tokyonight.nvim", as = "tokyonight"}
|
||||
use { "eldritch-theme/eldritch.nvim", as = "eldritch" }
|
||||
|
||||
|
||||
use "jbyuki/quickmath.nvim"
|
||||
|
||||
|
@ -66,6 +68,7 @@ return require('packer').startup(function(use)
|
|||
requires = {
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
-- Autocompletion
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-buffer',
|
||||
|
@ -79,20 +82,17 @@ return require('packer').startup(function(use)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
use 'folke/trouble.nvim'
|
||||
use 'mfussenegger/nvim-lint'
|
||||
use 'nvimtools/none-ls.nvim'
|
||||
|
||||
-- to dap, or not to dap? tis the question
|
||||
--use 'mfussenegger/nvim-dap'
|
||||
--use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap", "nvim-neotest/nvim-nio"} }
|
||||
--[[
|
||||
use {
|
||||
"williamboman/mason.nvim",
|
||||
"mfussenegger/nvim-dap",
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
}
|
||||
--]]
|
||||
-- ill trya dap
|
||||
-- use 'mrcjkb/rustaceanvim'
|
||||
|
||||
use 'mfussenegger/nvim-dap'
|
||||
use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap", "nvim-neotest/nvim-nio"} }
|
||||
|
||||
use({ "iamcco/markdown-preview.nvim", run = "cd app && npm install", setup = function() vim.g.mkdp_filetypes = { "markdown" } end, ft = { "markdown" }, })
|
||||
|
||||
|
|
Loading…
Reference in New Issue