Update keymap settings for neovim 0.7

pull/2/head
Ensar Sarajčić 2022-04-27 11:02:47 +02:00
parent 17a5fa1172
commit 78c30af4f2
2 changed files with 56 additions and 19 deletions

View File

@ -10,16 +10,34 @@ vim.cmd [[ au FileType dap-repl lua require('dap.ext.autocompl').attach() ]]
require("nvim-dap-virtual-text").setup()
-- Keymaps
local function set_keymap(...)
vim.api.nvim_set_keymap(...)
vim.keymap.set(
"n",
"<leader>db",
function()
dap.toggle_breakpoint()
end
local default_opts = {noremap = true, silent = true}
set_keymap("n", "<Leader>db", "<cmd>lua require'dap'.toggle_breakpoint()<CR>", default_opts)
set_keymap("n", "<Leader>dc", "<cmd>lua require'dap'.continue()<CR>", default_opts)
set_keymap("n", "<Leader>dso", "<cmd>lua require'dap'.step_over()<CR>", default_opts)
set_keymap("n", "<Leader>dsi", "<cmd>lua require'dap'.step_into()<CR>", default_opts)
set_keymap("n", "<Leader>dro", "<cmd>lua require'dap'.open()<CR>", default_opts)
)
vim.keymap.set(
"n",
"<leader>dc",
function()
dap.continue()
end
)
vim.keymap.set(
"n",
"<leader>dso",
function()
dap.step_over()
end
)
vim.keymap.set(
"n",
"<leader>dsi",
function()
dap.step_into()
end
)
-- Nvim DAP UI
local dapui = require("dapui")
@ -38,8 +56,20 @@ dap.listeners.after["event_initialized"]["me"] = function()
end
end
end
api.nvim_set_keymap("n", "K", '<Cmd>lua require("dapui").eval()<CR>', {silent = true})
api.nvim_set_keymap("v", "K", '<Cmd>lua require("dapui").eval()<CR>', {silent = true})
vim.keymap.set(
"n",
"K",
function()
dapui.eval()
end
)
vim.keymap.set(
"v",
"K",
function()
dapui.eval()
end
)
end
dap.listeners.after["event_terminated"]["me"] = function()

View File

@ -22,10 +22,17 @@ require("telescope").setup {
require("telescope").load_extension("dap")
default_opts = {noremap = true}
local function set_keymap(...)
vim.api.nvim_set_keymap(...)
vim.keymap.set(
"n",
"<C-P>",
function()
require("telescope.builtin").find_files()
end
set_keymap("n", "<C-P>", "<cmd>lua require('telescope.builtin').find_files()<CR>", default_opts)
set_keymap("n", "<C-M-F>", "<cmd>lua require('telescope.builtin').live_grep()<CR>", default_opts)
)
vim.keymap.set(
"n",
"<C-M-F>",
function()
require("telescope.builtin").live_grep()
end
)