From d810132ada3224c1e871ce63d85fa97a1ce70f2b Mon Sep 17 00:00:00 2001 From: Hau Nguyen Date: Sat, 23 Sep 2023 12:15:16 +0700 Subject: [PATCH] chore(nvim): move lsp keymaps to fzf-lua --- data/nvim/init.lua | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/data/nvim/init.lua b/data/nvim/init.lua index 29db997..1e5b69b 100644 --- a/data/nvim/init.lua +++ b/data/nvim/init.lua @@ -49,8 +49,8 @@ vim.cmd("command Wq wq") vim.cmd("command Qa qa") -- Leader -vim.keymap.set("n", ";", "", { remap = true }) -vim.keymap.set("n", "'", "", { remap = true }) +vim.keymap.set({ "n", "v" }, ";", "", { remap = true }) +vim.keymap.set({ "n", "v" }, "'", "", { remap = true }) -- Keymap vim.keymap.set("n", "n", "nzz") @@ -60,20 +60,20 @@ vim.keymap.set("n", "}", "}zz") -- Conflict with :q -- https://neovim.io/doc/user/cmdline.html#c_CTRL-F -vim.keymap.set("n", "q:", "") +vim.keymap.set({ "n", "v" }, "q:", "") -- Conflict with QMK Space Cadet -vim.keymap.set("n", "(", "") -vim.keymap.set("n", ")", "") +vim.keymap.set({ "n", "v" }, "(", "") +vim.keymap.set({ "n", "v" }, ")", "") -- Disable scrolling -- https://neovim.io/doc/user/scroll.html -vim.keymap.set("n", "", "") -vim.keymap.set("n", "", "") -vim.keymap.set("n", "", "") -vim.keymap.set("n", "", "") -vim.keymap.set("n", "", "") -vim.keymap.set("n", "", "") +vim.keymap.set({ "n", "v" }, "", "") +vim.keymap.set({ "n", "v" }, "", "") +vim.keymap.set({ "n", "v" }, "", "") +vim.keymap.set({ "n", "v" }, "", "") +vim.keymap.set({ "n", "v" }, "", "") +vim.keymap.set({ "n", "v" }, "", "") -- https://github.com/folke/lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" @@ -211,9 +211,13 @@ require("lazy").setup({ config = function() require("fzf-lua").setup({ "max-perf" }) - vim.keymap.set("n", "f", ":FzfLua files") - vim.keymap.set("n", "rg", ":FzfLua live_grep_native") - vim.keymap.set("n", "s", ":FzfLua lsp_document_symbols") + vim.keymap.set({ "n", "v" }, "f", ":FzfLua files") + vim.keymap.set({ "n", "v" }, "l", ":FzfLua lines") + vim.keymap.set({ "n", "v" }, "rg", ":FzfLua live_grep_native") + vim.keymap.set({ "n", "v" }, "s", ":FzfLua lsp_document_symbols") + vim.keymap.set({ "n", "v" }, "d", ":FzfLua lsp_definitions") + vim.keymap.set({ "n", "v" }, "r", ":FzfLua lsp_references") + vim.keymap.set({ "n", "v" }, "i", ":FzfLua lsp_implementations") end, }, @@ -587,15 +591,9 @@ require("lazy").setup({ vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" local opts = { buffer = ev.buf } - vim.keymap.set("n", "d", vim.lsp.buf.definition, opts) vim.keymap.set("n", "k", vim.lsp.buf.hover, opts) vim.keymap.set("n", "", vim.lsp.buf.rename, opts) vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) - vim.keymap.set("n", "r", vim.lsp.buf.references, opts) - vim.keymap.set("n", "i", vim.lsp.buf.implementation, opts) - vim.keymap.set("n", "f", function() - vim.lsp.buf.format({ async = true }) - end, opts) end, })