From 23cb8d32e592b86a70c2cd5fb3278c0025254441 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 11 Dec 2025 20:39:05 +0100 Subject: [PATCH] nvim: Add spider plugin for better web key movement Improves the 'subword' and punctuation jumps of the w/e/b keys, by adhering to snake_case and CamelCase words and jumping to subparts of them, as well as ignoring 'useless' punctuation when jumping. --- nvim/.config/nvim/lazy-lock.json | 1 + nvim/.config/nvim/lua/modules/editing.lua | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index ec5a304..bcb0216 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -74,6 +74,7 @@ "nvim-lint": { "branch": "master", "commit": "f126af5345c7472e9a0cdbe1d1a29209be72c4c4" }, "nvim-lspconfig": { "branch": "master", "commit": "77d3fdfb3554632c7a3b101ded643d422de7626f" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-spider": { "branch": "main", "commit": "fed9f683db005e6eb676e11a615b0e249a21142e" }, "nvim-surround": { "branch": "main", "commit": "8dd9150ca7eae5683660ea20cec86edcd5ca4046" }, "nvim-toggleterm.lua": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, diff --git a/nvim/.config/nvim/lua/modules/editing.lua b/nvim/.config/nvim/lua/modules/editing.lua index 88d0fb7..a306205 100644 --- a/nvim/.config/nvim/lua/modules/editing.lua +++ b/nvim/.config/nvim/lua/modules/editing.lua @@ -2,6 +2,16 @@ return { -- surround things with other things using ys/cs/ds { "kylechui/nvim-surround", config = true, event = { "CursorHold", "InsertEnter" } }, + -- more intelligent w/e/b key jumps including CamelCase, snake_case words and + -- ignoring some punctuation + { + "chrisgrieser/nvim-spider", + keys = { + { "w", "lua require('spider').motion('w')", mode = { "n", "o", "x" } }, + { "e", "lua require('spider').motion('e')", mode = { "n", "o", "x" } }, + { "b", "lua require('spider').motion('b')", mode = { "n", "o", "x" } }, + }, + }, -- jump between letters with improved fFtT quicksearch, mimics sneak { "folke/flash.nvim",