Created
October 16, 2025 11:15
-
-
Save CypherpunkSamurai/2272bb8fade9234837f1612c2b0092c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| B:\Code> function Find-ContentFuzzy { | |
| >> param ( | |
| >> [string]$SearchPattern | |
| >> ) | |
| >> | |
| >> $selected = rg --color=always --line-number --no-heading $SearchPattern | | |
| >> fzf --ansi ` | |
| >> --delimiter ':' ` | |
| >> --preview 'bat --color=always --highlight-line {2} --line-range {2}: {1}' ` | |
| >> --preview-window 'right:50%:+{2}/2' | |
| >> | |
| >> if ($selected) { | |
| >> $parts = $selected -split ':' | Select-Object -First 2 | |
| >> $file = $parts[0] | |
| >> $lineNum = $parts[1] | |
| >> nvim "+$lineNum" $file | |
| >> } | |
| >> } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Find-ContentFuzzy { | |
| param ( | |
| [string]$SearchPattern = '' | |
| ) | |
| if ([string]::IsNullOrWhiteSpace($SearchPattern)) { | |
| # No pattern: use rg to list files | |
| $selected = rg --files --color=always | | |
| fzf --ansi ` | |
| --preview 'bat --color=always {}' ` | |
| --preview-window 'right:50%' | |
| if ($selected) { | |
| nvim $selected | |
| } | |
| } | |
| else { | |
| # With pattern: use ripgrep to search content | |
| $selected = rg --color=always --line-number --no-heading $SearchPattern | | |
| fzf --ansi ` | |
| --delimiter ':' ` | |
| --preview 'bat --color=always --highlight-line {2} {1}' ` | |
| --preview-window 'right:50%:+{2}/2' | |
| if ($selected) { | |
| # More robust parsing that handles Windows paths | |
| if ($selected -match '^(.+?):(\d+):') { | |
| $file = $matches[1] | |
| $lineNum = $matches[2] | |
| nvim "+$lineNum" $file | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment