feat(ext/search): add Periscope for searching with ripgrep

Also replaces swiper and the alt+r keybinding with Periscope search in current file.
This commit is contained in:
Jim Myhrberg
2025-08-04 23:40:18 +01:00
parent 11e8b6e013
commit d4961c5e26
4 changed files with 131 additions and 9 deletions

View File

@@ -6,6 +6,7 @@
"esbenp",
"exafunction",
"frontmost",
"iglob",
"logpanel",
"modelcontextprotocol",
"runonsave",

View File

@@ -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

View File

@@ -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"
},
//
// ===========================================================================

View File

@@ -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
},
//
// ===========================================================================