Update key Map DAP

This commit is contained in:
asep komarudin 2023-01-24 19:53:48 +07:00
parent 78027686b6
commit 254e6b9550
3 changed files with 122 additions and 4 deletions

View file

@ -5,18 +5,20 @@ if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
vim.g.mapleader=' '
vim.g.maplocalleader=' '
vim.g.mapleader = " "
vim.g.maplocalleader = " "
require("lazy").setup({
spec = {
{
{
import = "plugins",
},
},
},
defaults = {
lazy = true, -- every plugin is lazy-loaded by default
version = "*", -- try installing the latest stable version for plugins that support semver
},
ui = { border = "rounded", browser = "chrome", throttle = 40, custom_keys = { ["<localleader>l"] = false } },
change_detection = { enabled = false, notify = false },
checker = { enabled = true }, -- automatically check for plugin updates
performance = {
rtp = {

View file

@ -88,6 +88,42 @@ keymap("x", "K", ":move '<-2<CR>gv-gv", opts)
keymap("x", "<A-j>", ":move '>+1<CR>gv-gv", opts)
keymap("x", "<A-k>", ":move '<-2<CR>gv-gv", opts)
local map = function(mode, lhs, rhs, desc)
if desc then
desc = desc
end
vim.keymap.set(mode, lhs, rhs, { silent = true, desc = desc, buffer = bufnr, noremap = true })
end
-- if pcall(require, "dap") then
-- modified function keys found with `showkey -a` in the terminal to get key code
-- run `nvim -V3log +quit` and search through the "Terminal info" in the `log` file for the correct keyname
if pcall(require, "dap") then
map("n", "<F5>", function()
require("dap").continue()
end, "")
map("n", "<F17>", function()
require("dap").terminate()
end, "") -- Shift+F5
map("n", "<F29>", function()
require("dap").restart_frame()
end, "") -- Control+F5
map("n", "<F6>", function()
require("dap").pause()
end, "")
map("n", "<F9>", function()
require("dap").toggle_breakpoint()
end, "")
map("n", "<F10>", function()
require("dap").step_over()
end, "")
map("n", "<F11>", function()
require("dap").step_into()
end, "")
map("n", "<F23>", function()
require("dap").step_out()
end, "") -- Shift+F11
end
-- Terminal --
-- Better terminal navigation
-- keymap("t", "<C-h>", "<C-\\><C-N><C-w>h", term_opts)

View file

@ -259,6 +259,86 @@ local mappings = {
end,
"Start/Continue",
},
i = {
function()
if is_dap then
require("dap").step_into()
else
vim.notify("DAP Not Support", "info")
end
end,
"Step Into (F11)",
},
o = {
function()
if is_dap then
require("dap").step_over()
else
vim.notify("DAP Not Support", "info")
end
end,
"Step Over (F10)",
},
O = {
function()
if is_dap then
require("dap").step_out()
else
vim.notify("DAP Not Support", "info")
end
end,
"Step Out (S-F11)",
},
q = {
function()
if is_dap then
require("dap").close()
else
vim.notify("DAP Not Support", "info")
end
end,
"Close Session",
},
Q = {
function()
if is_dap then
require("dap").terminate()
else
vim.notify("DAP Not Support", "info")
end
end,
"Terminate Session (S-F5)",
},
p = {
function()
if is_dap then
require("dap").pause()
else
vim.notify("DAP Not Support", "info")
end
end,
"Pause (F6)",
},
r = {
function()
if is_dap then
require("dap").restart_frame()
else
vim.notify("DAP Not Support", "info")
end
end,
"Restart (C-F5)",
},
R = {
function()
if is_dap then
require("dap").repl.toggle()
else
vim.notify("DAP Not Support", "info")
end
end,
"Toggle REPL",
},
},
}