diff --git a/data/nvim/init.lua b/data/nvim/init.lua index a5f2217..579da14 100644 --- a/data/nvim/init.lua +++ b/data/nvim/init.lua @@ -35,23 +35,14 @@ vim.opt.mouse = "a" -- Workaround -- https://github.com/neovim/neovim/issues/16416 -vim.keymap.set("i", "", "") +-- https://github.com/rafamadriz/dotfiles/commit/1298a91558a7def5866ebee3a0b13899a6d1a78e +vim.keymap.set("i", "", "") -- Keymap -vim.keymap.set("n", ";", "", { remap = true }) -vim.keymap.set("n", "'", "", { remap = true }) +vim.keymap.set("n", ";", "", { remap = true }) +vim.keymap.set("n", "'", "", { remap = true }) vim.keymap.set("n", "q", ":q") --- Keymap for plugin -vim.keymap.set("n", "f", ":FzfLua files") -vim.keymap.set("n", "rg", ":FzfLua live_grep_native") -vim.keymap.set("n", "ds", ":FzfLua lsp_document_symbols") -vim.keymap.set("n", "", ":NvimTreeToggle") -vim.keymap.set("n", "n", ":NvimTreeFindFile") -vim.keymap.set("n", "tr", ":lua MiniTrailspace.trim()") -vim.keymap.set("n", "nf", ":Neoformat") -vim.keymap.set("n", "lr", ":LspRestart") - -- Use plugin nvim-tree.lua vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 @@ -122,6 +113,18 @@ require("lazy").setup({ "junegunn/fzf", "neovim/nvim-lspconfig", }, + config = function() + local fzf_lua = require("fzf-lua") + + 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({ "i" }, "", function() + fzf_lua.complete_path() + end, { silent = true, desc = "Fuzzy complete path" }) + end, }, -- https://github.com/nvim-lualine/lualine.nvim @@ -171,6 +174,9 @@ require("lazy").setup({ }, }, }) + + vim.keymap.set("n", "", ":NvimTreeToggle") + vim.keymap.set("n", "n", ":NvimTreeFindFile") end, }, @@ -279,6 +285,8 @@ require("lazy").setup({ -- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-trailspace.md require("mini.trailspace").setup() + + vim.keymap.set("n", "tr", ":lua MiniTrailspace.trim()") end, }, @@ -373,20 +381,18 @@ require("lazy").setup({ vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" local opts = { buffer = ev.buf } - vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) - vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) - vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) - vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) - vim.keymap.set("n", "D", vim.lsp.buf.type_definition, opts) - vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) + vim.keymap.set("n", "gd", 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", "gr", vim.lsp.buf.references, opts) - vim.keymap.set("n", "f", function() + vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) + vim.keymap.set("n", "f", function() vim.lsp.buf.format({ async = true }) end, opts) end, }) + + vim.keymap.set("n", "lr", ":LspRestart") end, },