mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
Escape pipes in selection for rg project searches
Pipes need to be double-escaped, because they're meaningful to both ivy and ripgrep, and searches conducted on a selection need to be literal.
This commit is contained in:
@ -340,11 +340,14 @@ order.
|
||||
(when (> (abs (- end beg)) 1)
|
||||
(let ((query (buffer-substring-no-properties beg end)))
|
||||
;; Escape characters that are special to ivy searches
|
||||
(replace-regexp-in-string "[! ]" (lambda (substr)
|
||||
(if (and (featurep! +fuzzy)
|
||||
(string= substr " "))
|
||||
" "
|
||||
(concat "\\\\" substr)))
|
||||
(replace-regexp-in-string "[! |]" (lambda (substr)
|
||||
(cond ((and (featurep! +fuzzy)
|
||||
(string= substr " "))
|
||||
" ")
|
||||
((and (string= substr "|")
|
||||
(eq engine 'rg))
|
||||
"\\\\\\\\|")
|
||||
((concat "\\\\" substr))))
|
||||
(regexp-quote query))))))))
|
||||
(prompt
|
||||
(format "%s%%s %s"
|
||||
|
Reference in New Issue
Block a user