From d4961c5e26b9b9ee7f83e3c209adde5782483a07 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Mon, 4 Aug 2025 23:40:18 +0100 Subject: [PATCH] feat(ext/search): add Periscope for searching with ripgrep Also replaces swiper and the alt+r keybinding with Periscope search in current file. --- .vscode/settings.shared.json | 1 + extensions.cursor.lock | 4 +- keybindings.json | 21 +++++-- settings.json | 114 ++++++++++++++++++++++++++++++++++- 4 files changed, 131 insertions(+), 9 deletions(-) diff --git a/.vscode/settings.shared.json b/.vscode/settings.shared.json index e647f28..df89a43 100644 --- a/.vscode/settings.shared.json +++ b/.vscode/settings.shared.json @@ -6,6 +6,7 @@ "esbenp", "exafunction", "frontmost", + "iglob", "logpanel", "modelcontextprotocol", "runonsave", diff --git a/extensions.cursor.lock b/extensions.cursor.lock index fb6bb12..1affcd0 100644 --- a/extensions.cursor.lock +++ b/extensions.cursor.lock @@ -1,5 +1,5 @@ # cursor Extensions -# Generated on Mon Aug 4 10:04:42 BST 2025 +# Generated on Mon Aug 4 11:11:05 BST 2025 alefragnani.project-manager@12.8.0 anthropic.claude-code@1.0.67 @@ -48,6 +48,7 @@ hverlin.mise-vscode@0.53.0 jakearl.search-editor-apply-changes@0.1.1 jnoortheen.nix-ide@0.4.22 joshbolduc.commitlint@2.6.2 +joshmu.periscope@1.12.0 kahole.magit@0.6.67 karunamurti.haml@1.4.1 koichisasada.vscode-rdbg@0.2.2 @@ -98,7 +99,6 @@ tootone.org-mode@0.5.0 tuttieee.emacs-mcx@0.88.8 tyriar.sort-lines@1.12.0 viktorzetterstrom.non-breaking-space-highlighter@0.0.3 -wenhoujx.swiper@2.1.2 zhuangtongfa.material-theme@3.19.0 ziyasal.vscode-open-in-github@1.3.6 zxh404.vscode-proto3@0.5.5 diff --git a/keybindings.json b/keybindings.json index dc91101..601b461 100644 --- a/keybindings.json +++ b/keybindings.json @@ -973,14 +973,27 @@ }, // // =========================================================================== - // MARK: swiper + // MARK: Periscope // =========================================================================== // Extension: - // - https://marketplace.visualstudio.com/items?itemName=wenhoujx.swiper + // - https://marketplace.visualstudio.com/items?itemName=joshmu.periscope // - { // Swiper word at cursor. + { // Search. + "key": "ctrl+x ctrl+'", + "command": "periscope.search" + }, + { // Resume last search. + "key": "ctrl+x '", + "command": "periscope.resumeSearch" + }, + { // Search current file. "key": "alt+r", - "command": "swiper.swiper-word-at-cursor" + "command": "periscope.searchCurrentFile" + }, + { // Open current result in horizontal split. + "key": "ctrl+v", + "command": "periscope.openInHorizontalSplit", + "when": "periscopeActive" }, // // =========================================================================== diff --git a/settings.json b/settings.json index 5f191a2..dc92f17 100644 --- a/settings.json +++ b/settings.json @@ -325,6 +325,114 @@ "rewrap.wholeComment": false, // // =========================================================================== + // MARK: Periscope + // =========================================================================== + // Extension: + // - https://marketplace.visualstudio.com/items?itemName=joshmu.periscope + // + "periscope.rgGlobExcludes": [ + "**/dist/**", + "**/node_modules/**", + "*.cjs", + "*.cts", + "*.log", + "*.min-latest.css", + "*.min-latest.js", + "*.min.css", + "*.min.js", + "*.sql", + "*.test", + "*/.log/*", + "*/.yarn/*", + ".bundle/*", + ".git/*", + ".log/*", + ".vscode/*", + ".yarn/*", + "straight/*", + "vendor/*" + ], + "periscope.rgMenuActions": [ + { + "label": "Go", + "value": "--type-add 'go:go.{mod,work}' -t go" + }, + { + "label": "JSON", + "value": "-t json" + }, + { + "label": "JS/TS", + "value": "--type-add 'jsts:*.{js,ts,tsx,jsx}' -t jsts" + }, + { + "label": "Ruby", + "value": "-t ruby" + }, + { + "label": "Rust", + "value": "-t rust" + }, + { + "label": "TOML", + "value": "-t toml" + }, + { + "label": "YAML", + "value": "-t yaml" + } + ], + "periscope.rgOptions": [ + "--smart-case", + "--sortr path", + "--hidden" + ], + "periscope.showWorkspaceFolderInFilePath": false, + "periscope.rgQueryParams": [ + { + // filter the results to a folder + // Query: "redis -m module1" + // After: "rg 'redis' --iglob '**/*module1*/**'" + "regex": "^(.+) -m ([\\w-_\/]+)$", + "param": "--iglob '**/*$1*/**'" + }, + { + // filter the results to a folder and filetype + // Query: "redis -m module1 yaml" + // After: "rg 'redis' --iglob '**/*module1*/**/*.yaml'" + "regex": "^(.+) -m ([\\w-_\/]+) ([\\w]+)$", + "param": "--iglob '**/*$1*/**/*.$2'" + }, + { + // filter the results that match a glob + // Query: "redis -g *module" + // After: "rg 'redis' -g '*module'" + "regex": "^(.+) -g (.+)$", + "param": "-g '$1'" + }, + { + // filter the results that match a glob + // Query: "redis -ig *module" + // After: "rg 'redis' -iglob '*module'" + "regex": "^(.+) -ig (.+)$", + "param": "--iglob '$1'" + }, + { + // filter the results to rg filetypes + // Query: "redis -t yaml" + // After: "rg 'redis' -t yaml" + "regex": "^(.+) -t ?(\\w+)$", + "param": "-t $1" + }, + { + // filter the results that match a file extension through a glob + // Query: redis *.rs => rg 'redis' -iglob '*.rs' + "regex": "^(.+) \\*\\.(\\w+)$", + "param": "--iglob '*.$1'" + } + ], + // + // =========================================================================== // MARK: Prettier // =========================================================================== // @@ -649,10 +757,10 @@ // - https://marketplace.visualstudio.com/items?itemName=ArturoDent.command-alias // "command aliases": { - "sortLines.sortLines": "sl", // Sort Lines - https://marketplace.visualstudio.com/items?itemName=Tyriar.sort-lines - "settings.cycle.commandCenter": "Toggle Command Center", "macros.insertEmDash": "Insert Em Dash", - "macros.insertEnDash": "Insert En Dash" + "macros.insertEnDash": "Insert En Dash", + "settings.cycle.commandCenter": "Toggle Command Center", + "sortLines.sortLines": "sl" // Sort Lines - https://marketplace.visualstudio.com/items?itemName=Tyriar.sort-lines }, // // ===========================================================================