From 42835e82536dbd1d480ab559012a9e8a703929e4 Mon Sep 17 00:00:00 2001 From: insects Date: Mon, 14 Apr 2025 17:18:36 +0200 Subject: [PATCH 1/2] nvim: replace mini.clue with which-key --- dot_config/nvim/lua/plugins/mini.lua | 27 ----------------------- dot_config/nvim/lua/plugins/which-key.lua | 19 ++++++++++++++++ 2 files changed, 19 insertions(+), 27 deletions(-) create mode 100644 dot_config/nvim/lua/plugins/which-key.lua diff --git a/dot_config/nvim/lua/plugins/mini.lua b/dot_config/nvim/lua/plugins/mini.lua index ef55d61..86ed57d 100644 --- a/dot_config/nvim/lua/plugins/mini.lua +++ b/dot_config/nvim/lua/plugins/mini.lua @@ -25,33 +25,6 @@ return { "echasnovski/mini.bracketed", opts = {}, }, - { - -- Faster and better which-key - "echasnovski/mini.clue", - opts = { - triggers = { - { mode = "n", keys = "" }, - { mode = "x", keys = "" }, - - { mode = "n", keys = "g" }, - { mode = "x", keys = "g" }, - - { mode = "n", keys = "`" }, - { mode = "x", keys = "`" }, - { mode = "n", keys = "'" }, - { mode = "x", keys = "'" }, - - { mode = "n", keys = "" }, - - { mode = "n", keys = "z" }, - { mode = "x", keys = "z" }, - }, - - window = { - delay = 400, - }, - }, - }, { -- Label jumping for visible characters "echasnovski/mini.jump2d", diff --git a/dot_config/nvim/lua/plugins/which-key.lua b/dot_config/nvim/lua/plugins/which-key.lua new file mode 100644 index 0000000..5e4d8be --- /dev/null +++ b/dot_config/nvim/lua/plugins/which-key.lua @@ -0,0 +1,19 @@ +-- Configuration for which-key + +return { + { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + preset = "helix", + spec = { + { "f", group = "file" }, + { "b", group = "buffer" }, + { "c", group = "code" }, + { "g", group = "vc" }, + { "s", group = "search" }, + { ",", group = "vim" }, + }, + }, + }, +} From 4726c1720a1695783a42142a0cf45b6ec0b42e00 Mon Sep 17 00:00:00 2001 From: insects Date: Mon, 14 Apr 2025 17:18:44 +0200 Subject: [PATCH 2/2] nvim: add way more keymaps --- dot_config/nvim/init.lua | 1 + dot_config/nvim/lua/keymap.lua | 32 +++++++++++++++++++++++ dot_config/nvim/lua/plugins/telescope.lua | 15 +++++++++++ 3 files changed, 48 insertions(+) create mode 100644 dot_config/nvim/lua/keymap.lua 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", + }, }, }, {