From 98f4fd1cbc17e62aeb00d57770b9ff35d143bd89 Mon Sep 17 00:00:00 2001 From: lew Date: Wed, 12 Nov 2025 19:58:07 +0000 Subject: [PATCH] Update .config/nvim/lazy-lock.json Update .config/nvim/lua/config/20_keymaps.lua Update .config/nvim/lua/plugin/03_treesitter.lua Update .config/nvim/lua/plugin/05_fzf.lua Update .config/nvim/lua/plugin/10_hop.lua Update .config/nvim/lua/plugin/35_yanky.lua --- private_dot_config/nvim/lazy-lock.json | 3 +- .../nvim/lua/config/20_keymaps.lua | 33 +++++++++++++++---- .../nvim/lua/plugin/03_treesitter.lua | 12 +++---- private_dot_config/nvim/lua/plugin/05_fzf.lua | 7 ++-- private_dot_config/nvim/lua/plugin/10_hop.lua | 18 ++++------ .../nvim/lua/plugin/35_yanky.lua | 21 +++++------- 6 files changed, 50 insertions(+), 44 deletions(-) diff --git a/private_dot_config/nvim/lazy-lock.json b/private_dot_config/nvim/lazy-lock.json index 031e504..8ceab6c 100644 --- a/private_dot_config/nvim/lazy-lock.json +++ b/private_dot_config/nvim/lazy-lock.json @@ -2,13 +2,12 @@ "blink-copilot": { "branch": "main", "commit": "7ad8209b2f880a2840c94cdcd80ab4dc511d4f39" }, "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, "codecompanion.nvim": { "branch": "main", "commit": "79c6908a091f19c447141459a481e8ce05e49151" }, - "comment-box.nvim": { "branch": "main", "commit": "06bb771690bc9df0763d14769b779062d8f12bc5" }, "conform.nvim": { "branch": "master", "commit": "02736cf359a3235c6d7d601a2f6bdc909e557513" }, "eyeliner.nvim": { "branch": "main", "commit": "8f197eb30cecdf4c2cc9988a5eecc6bc34c0c7d6" }, + "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "fzf-lua": { "branch": "main", "commit": "a8458b79a957a6e3e217d84106a0fd4b9470ff4c" }, "gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" }, - "helix-nvim": { "branch": "main", "commit": "c2875fb19df7f3624d0ae1c82b063fc14de1d64b" }, "hop.nvim": { "branch": "master", "commit": "08ddca799089ab96a6d1763db0b8adc5320bf050" }, "img-clip.nvim": { "branch": "main", "commit": "e7e29f0d07110405adecd576b602306a7edd507a" }, "lazy.nvim": { "branch": "main", "commit": "db067881fff0fd4be8c00e5bde7492e0e1c77a2f" }, diff --git a/private_dot_config/nvim/lua/config/20_keymaps.lua b/private_dot_config/nvim/lua/config/20_keymaps.lua index 71d3cc4..12c4a95 100644 --- a/private_dot_config/nvim/lua/config/20_keymaps.lua +++ b/private_dot_config/nvim/lua/config/20_keymaps.lua @@ -2,18 +2,37 @@ ---@diagnostic disable: unused-local, unused-function -- stylua: ignore start -local nmap = function(lhs, rhs, desc) - vim.keymap.set("n", lhs, rhs, { desc = desc }) +local map = function(mode, lhs, rhs, desc) + vim.keymap.set(mode, lhs, rhs, { noremap = true, desc = desc }) end -local nmap_leader = function(lhs, rhs, desc) - vim.keymap.set("n", "" .. lhs, rhs, { desc = desc }) -end +local nop = function(lhs) map({ "n", "v" }, lhs, "", "") end +local nmap = function(lhs, rhs, desc) map("n", lhs, rhs, desc) end +local xmap = function(lhs, rhs, desc) map("x", lhs, rhs, desc) end + +local nmap_leader = function(lhs, rhs, desc) nmap("" .. lhs, rhs, desc) end + +nop('s') +nop('v') + +nmap_leader(';', 'vsplit', 'vsplit') +nmap_leader('-', 'split', 'hsplit') nmap_leader('ca', 'lua vim.lsp.buf.code_action()', 'lsp code action') nmap_leader('ci', 'lua vim.lsp.buf.implementation()', 'lsp find implementation') nmap_leader('cr', 'lua vim.lsp.buf.references()', 'lsp find references') nmap_leader('cR', 'lua vim.lsp.buf.rename()', 'lsp rename') -nmap_leader(';', 'vsplit', 'vsplit') -nmap_leader('-', 'split', 'hsplit') +local c = function(rhs) + return function() + local count = vim.v.count1 + for _ = 1, count do + vim.cmd(rhs) + end + end +end + +nmap(">", c("normal! >>"), "indent") +nmap("<", c("normal! <<"), "dedent") +xmap(">", ">gv", "indent and reselect") +xmap("<", "ff", "FzfLua files", mode = { "n" }, desc = "fzf files" }, { "fg", "FzfLua live_grep", mode = { "n" }, desc = "fzf grep" }, { "fh", "FzfLua command_history", mode = { "n" }, desc = "fzf cmd history" }, - -- fi --> lsp find implementation { "fk", "FzfLua keymaps", mode = { "n" }, desc = "fzf keymaps" }, - { "fl", "FzfLua blines", mode = { "n" }, desc = "fzf bufferlines" }, - { "fo", "FzfLua oldfiles", mode = { "n" }, desc = "fzf oldfiles" }, - -- fr --> lsp find references + { "fr", "FzfLua oldfiles", mode = { "n" }, desc = "fzf oldfiles" }, { "fs", "FzfLua", mode = { "n" }, desc = "fzf something else" }, }, }, diff --git a/private_dot_config/nvim/lua/plugin/10_hop.lua b/private_dot_config/nvim/lua/plugin/10_hop.lua index 0289340..90ab79e 100644 --- a/private_dot_config/nvim/lua/plugin/10_hop.lua +++ b/private_dot_config/nvim/lua/plugin/10_hop.lua @@ -4,13 +4,11 @@ return { version = "*", config = function() local hop = require("hop") - hop.setup({ - keys = "etovxqpdygfblzhckisuran", + jump_on_sole_occurrence = true, }) - -- Runs vim cmds ... if in visual mode - local function run_if_visual(...) + local function if_visual(...) local mode = vim.fn.mode() if mode == "v" then for _, cmd in ipairs({ ... }) do @@ -19,26 +17,22 @@ return { end end - -- HopWordMW, and include whole word if in visual mode. local function hop_word_smart() ---@diagnostic disable-next-line: missing-fields hop.hint_words({ multi_windows = true }) - run_if_visual("normal! iw") + if_visual("normal! iw") end - -- HopPatternMW, and include whole word if in visual mode. local function hop_pattern_smart() ---@diagnostic disable-next-line: missing-fields hop.hint_patterns({ multi_windows = true }) - run_if_visual("normal! iw") + if_visual("normal! iw") end -- stylua: ignore start vim.keymap.set({ "n", "x", "o" }, "gw", hop_word_smart, { desc = "hop to word" }) - vim.keymap.set({ "n", "x", "o" }, "gl", "HopChar1MW", { desc = "hop to char" }) - vim.keymap.set({ "n", "x", "o" }, "g:", "HopLineStartMW", { desc = "hop to line" }) - vim.keymap.set({ "n", "x", "o" }, "gt", "HopNodes", { desc = "hop to ts" }) - vim.keymap.set({ "n", "x", "o" }, "gp", hop_pattern_smart, { desc = "hop to pattern" }) + vim.keymap.set({ "n", "x", "o" }, "gt", "HopNodes", { desc = "hop to ts" }) + vim.keymap.set({ "n", "x", "o" }, "s", hop_pattern_smart, { desc = "hop to pattern" }) -- stylua: ignore end end, }, diff --git a/private_dot_config/nvim/lua/plugin/35_yanky.lua b/private_dot_config/nvim/lua/plugin/35_yanky.lua index 983c99b..0e60578 100644 --- a/private_dot_config/nvim/lua/plugin/35_yanky.lua +++ b/private_dot_config/nvim/lua/plugin/35_yanky.lua @@ -1,19 +1,16 @@ return { { "gbprod/yanky.nvim", + -- stylua: ignore keys = { - { "y", "(YankyYank)" }, - { "p", "(YankyPutAfter)", mode = { "n", "x" } }, - { "P", "(YankyPutBefore)", mode = { "n", "x" } }, - { "[p", "(YankyPutIndentBeforeLinewise)", mode = { "n", "x" } }, - { "]p", "(YankyPutIndentAfterLinewise)", mode = { "n", "x" } }, - { ">p", "(YankyPutIndentAfterShiftRight)", mode = { "n", "x" } }, - { ">P", "(YankyPutIndentBeforeShiftRight)", mode = { "n", "x" } }, - { "(YankyPutIndentAfterShiftLeft)", mode = { "n", "x" } }, - { "(YankyPutIndentBeforeShiftLeft)", mode = { "n", "x" } }, - { "", "(YankyPreviousEntry)", mode = "n" }, - { "", "(YankyNextEntry)", mode = "n" }, - { "fy", "YankyRingHistory", mode = { "n", "x" } }, + { "y", "(YankyYank)", desc = "yank" }, + { "p", "(YankyPutAfter)", mode = { "n", "x" }, desc = "put after" }, + { "P", "(YankyPutBefore)", mode = { "n", "x" }, desc = "put before" }, + { "[p", "(YankyPutIndentBeforeLinewise)", mode = { "n", "x" }, desc = "put after line" }, + { "]p", "(YankyPutIndentAfterLinewise)", mode = { "n", "x" }, desc = "put before line" }, + { "", "(YankyPreviousEntry)", mode = "n", desc = "previous yank" }, + { "", "(YankyNextEntry)", mode = "n", desc = "next yank" }, + { "fy", "YankyRingHistory", mode = { "n", "x" }, desc = "yank history" }, }, opts = { preserve_cursor_position = { enabled = true },