diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua index c6b0eb8..832052d 100644 --- a/dot_config/nvim/init.lua +++ b/dot_config/nvim/init.lua @@ -1,2 +1,3 @@ require("settings") +require("keymap") require("config.lazy") diff --git a/dot_config/nvim/lua/keymap.lua b/dot_config/nvim/lua/keymap.lua new file mode 100644 index 0000000..f22beac --- /dev/null +++ b/dot_config/nvim/lua/keymap.lua @@ -0,0 +1,32 @@ +local function map(mode, lhs, rhs, desc, opts) + local options = { noremap = true, silent = true } + if opts then + options = vim.tbl_extend("force", options, opts) + end + vim.keymap.set(mode, lhs, rhs, vim.tbl_extend("force", options, { desc = desc })) +end + +-- Buffer navigation +map("n", "", "bp", "") +map("n", "", "bn", "") +map("n", "bb", "e #", "Switch to other buffer") +map("n", "`", "e #", "Switch to other buffer") +map("n", "bd", "bd", "Delete buffer") +map("n", "bp", "bp", "Previous buffer") +map("n", "bn", "bn", "Next buffer") + +-- Better indentation +map("v", "<", "", ">gv") + +-- Lazy +map("n", "l", "Lazy", "Lazy") + +-- Mason +map("n", "cm", "Mason", "Mason") + +-- Clear search on escape +map({ "i", "n", "s" }, "", function() + vim.cmd("noh") + return "" +end, "", { expr = true }) diff --git a/dot_config/nvim/lua/plugins/telescope.lua b/dot_config/nvim/lua/plugins/telescope.lua index 81b5a59..4448c6c 100644 --- a/dot_config/nvim/lua/plugins/telescope.lua +++ b/dot_config/nvim/lua/plugins/telescope.lua @@ -24,6 +24,21 @@ return { "Telescope current_buffer_fuzzy_find", desc = "Search in buffer", }, + { + "cd", + "Telescope diagnostics bufnr=0", + desc = "List diagnostics", + }, + { + "sp", + "Telescope live_grep", + desc = "Search in project", + }, + { + "bb", + "Telescope buffers", + desc = "Find buffer", + }, }, }, {