From 78c30af4f23266956311fd4cf445a2f16a694150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Wed, 27 Apr 2022 11:02:47 +0200 Subject: [PATCH] Update keymap settings for neovim 0.7 --- symlinks/config/nvim/plugin/dap.lua | 54 ++++++++++++++++++----- symlinks/config/nvim/plugin/telescope.lua | 21 ++++++--- 2 files changed, 56 insertions(+), 19 deletions(-) diff --git a/symlinks/config/nvim/plugin/dap.lua b/symlinks/config/nvim/plugin/dap.lua index afa7798..eb56152 100644 --- a/symlinks/config/nvim/plugin/dap.lua +++ b/symlinks/config/nvim/plugin/dap.lua @@ -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(...) -end - -local default_opts = {noremap = true, silent = true} -set_keymap("n", "db", "lua require'dap'.toggle_breakpoint()", default_opts) -set_keymap("n", "dc", "lua require'dap'.continue()", default_opts) -set_keymap("n", "dso", "lua require'dap'.step_over()", default_opts) -set_keymap("n", "dsi", "lua require'dap'.step_into()", default_opts) -set_keymap("n", "dro", "lua require'dap'.open()", default_opts) +vim.keymap.set( + "n", + "db", + function() + dap.toggle_breakpoint() + end +) +vim.keymap.set( + "n", + "dc", + function() + dap.continue() + end +) +vim.keymap.set( + "n", + "dso", + function() + dap.step_over() + end +) +vim.keymap.set( + "n", + "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", 'lua require("dapui").eval()', {silent = true}) - api.nvim_set_keymap("v", "K", 'lua require("dapui").eval()', {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() diff --git a/symlinks/config/nvim/plugin/telescope.lua b/symlinks/config/nvim/plugin/telescope.lua index 179ddd5..97f95f2 100644 --- a/symlinks/config/nvim/plugin/telescope.lua +++ b/symlinks/config/nvim/plugin/telescope.lua @@ -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(...) -end -set_keymap("n", "", "lua require('telescope.builtin').find_files()", default_opts) -set_keymap("n", "", "lua require('telescope.builtin').live_grep()", default_opts) +vim.keymap.set( + "n", + "", + function() + require("telescope.builtin").find_files() + end +) +vim.keymap.set( + "n", + "", + function() + require("telescope.builtin").live_grep() + end +)