various debug keymap changes

This commit is contained in:
Markus Dieckmann 2023-04-15 15:36:44 +02:00
parent 16e2ddfe94
commit f5378b619b
2 changed files with 29 additions and 24 deletions

View File

@ -1,4 +1,3 @@
function map(mode, shortcut, command) function map(mode, shortcut, command)
vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true }) vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true })
end end
@ -14,41 +13,46 @@ end
function vmap(shortcut, command) function vmap(shortcut, command)
map('v', shortcut, command) map('v', shortcut, command)
end end
function xmap(shortcut, command) function xmap(shortcut, command)
map('x', shortcut, command) map('x', shortcut, command)
end end
nmap("<SPACE>","<Nop>") nmap("<SPACE>", "<Nop>")
nmap("<Esc><Esc>", ":noh<cr>") nmap("<Esc><Esc>", ":noh<cr>")
nmap("<C-f>",":ToggleTerm direction=float<cr>") nmap("<C-f>", ":ToggleTerm direction=float<cr>")
imap("<C-f>",":ToggleTerm direction=float<cr>") imap("<C-f>", ":ToggleTerm direction=float<cr>")
nmap("<C-l>",":ToggleTerm direction=horizontal size=10<cr>") nmap("<C-l>", ":ToggleTerm direction=horizontal size=10<cr>")
imap("<C-l>",":ToggleTerm direction=horizontal size=10<cr>") imap("<C-l>", ":ToggleTerm direction=horizontal size=10<cr>")
xmap("p",'\"_dP') xmap("p", '\"_dP')
nmap("<leader>fg", "<cmd>lua require('telescope.builtin').live_grep()<cr>") nmap("<leader>fg", "<cmd>lua require('telescope.builtin').live_grep()<cr>")
nmap("<leader>fb", "<cmd>lua require('telescope.builtin').buffers()<cr>") nmap("<leader>fb", "<cmd>lua require('telescope.builtin').buffers()<cr>")
nmap("<leader>fh", "<cmd>lua require('telescope.builtin').help_tags()<cr>") nmap("<leader>fh", "<cmd>lua require('telescope.builtin').help_tags()<cr>")
nmap("<leader>ff", "<cmd>lua require('telescope.builtin').find_files()<cr>") nmap("<leader>ff", "<cmd>lua require('telescope.builtin').find_files()<cr>")
nmap("<leader>vb", "<cmd>lua require('telescope.builtin').git_branches()<cr>") nmap("<leader>vb", "<cmd>lua require('telescope.builtin').git_branches()<cr>")
nmap("<leader>b","<cmd>lua require('telescope.builtin').buffers()<cr>") nmap("<leader>b", "<cmd>lua require('telescope.builtin').buffers()<cr>")
nmap("<C-n>",":NvimTreeToggle<cr>") nmap("<C-n>", ":NvimTreeToggle<cr>")
nmap("<leader>r",":NvimTreeRefresh<cr>") nmap("<leader>r", ":NvimTreeRefresh<cr>")
nmap("<leader>n",":NvimTreeToggle<cr>") nmap("<leader>n", ":NvimTreeToggle<cr>")
nmap("<leader>zn","zf%") nmap("<leader>zn", "zf%")
nmap("<leader>y",'\"+y') nmap("<leader>y", '\"+y')
vmap("<leader>y",'\"+y') vmap("<leader>y", '\"+y')
nmap("<F5>",":lua require'dap'.continue()<CR>") nmap("<F5>", ":lua require'dap'.continue()<CR>")
nmap("<F10>",":lua require'dap'.step_over()<CR>") nmap("<F10>", ":lua require'dap'.step_over()<CR>")
nmap("<F11>",":lua require'dap'.step_into()<CR>") nmap("<F11>", ":lua require'dap'.step_into()<CR>")
nmap("<F12>",":lua require'dap'.step_out()<CR>") nmap("<F12>", ":lua require'dap'.step_out()<CR>")
nmap("<leader>B",":lua require'dap'.toggle_breakpoint()<CR>") nmap("<leader>B", ":lua require'dap'.toggle_breakpoint()<CR>")
nmap("<leader>Bc",":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>") nmap("<leader>Bc", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>")
nmap("<leader>lp",":lua require'dap'.set_breakpoint(nil,nil,vim.fn.input('Log point message: '))<CR>") nmap("<leader>lp", ":lua require'dap'.set_breakpoint(nil,nil,vim.fn.input('Log point message: '))<CR>")
nmap("<leader>lp",":lua require'dap'.repl.open()<CR>") nmap("<leader>lR", ":lua require'dap'.repl.open()<CR>")
nmap("<leader>dK", ":lua require'dap.ui.widgets'.hover()<CR>")
nmap("<leader>dh", ":lua require'dap.ui.variables'.visual_hover()<CR>")
nmap("<leader>d?", ":lua require'dap.ui.variables'.scopes()<CR>")
nmap("<leader>da", ":lua require'debugHelper'.attach()<CR>")

View File

@ -1,9 +1,10 @@
-- Mappings. -- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions -- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap = true, silent = true } local opts = { noremap = true, silent = true }
local goErrorOpts = { severity = vim.diagnostic.severity.ERROR, noremap = true, silent = true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts) vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) vim.keymap.set('n', 'gE', ':lua vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR})<cr>', opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) vim.keymap.set('n', 'ge', ':lua vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR})<cr>', opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts) vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
-- Use an on_attach function to only map the following keys -- Use an on_attach function to only map the following keys