Skip to content

Commit

Permalink
helm/ivy: Limit rg results to 150 columns
Browse files Browse the repository at this point in the history
Emacs doesn't handle long line lengths very well. If you accidentally rg a file
a file that has very long line lengths it can freeze emacs. This prevents rg
from returning any results with more than 150 characters. Instead, it will
indicate that there were results in that file but they were elided.
  • Loading branch information
aaronjensen authored and syl20bnr committed May 8, 2017
1 parent 17ac768 commit c4ce10a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions layers/+completion/helm/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ Search for a search tool in the order provided by `dotspacemacs-search-tools'."
;; --line-number forces line numbers (disabled by default on windows)
;; no --vimgrep because it adds column numbers that wgrep can't handle
;; see https://github.com/syl20bnr/spacemacs/pull/8065
(let ((helm-ag-base-command "rg --smart-case --no-heading --color never --line-number"))
(let ((helm-ag-base-command "rg --smart-case --no-heading --color never --line-number --max-columns 150"))
(helm-do-ag dir)))

(defun spacemacs/helm-files-do-rg-region-or-symbol ()
Expand Down Expand Up @@ -316,7 +316,7 @@ Search for a search tool in the order provided by `dotspacemacs-search-tools'."
;; --line-number forces line numbers (disabled by default on windows)
;; no --vimgrep because it adds column numbers that wgrep can't handle
;; see https://github.com/syl20bnr/spacemacs/pull/8065
(let ((helm-ag-base-command "rg --smart-case --no-heading --color never --line-number"))
(let ((helm-ag-base-command "rg --smart-case --no-heading --color never --line-number --max-columns 150"))
(helm-do-ag-buffers)))

(defun spacemacs/helm-buffers-do-rg-region-or-symbol ()
Expand Down
2 changes: 1 addition & 1 deletion layers/+completion/ivy/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'(;; --line-number forces line numbers (disabled by default on windows)
;; no --vimgrep because it adds column numbers that wgrep can't handle
;; see https://github.com/syl20bnr/spacemacs/pull/8065
("rg" . "rg --smart-case --no-heading --color never --line-number %s %S .")
("rg" . "rg --smart-case --no-heading --color never --line-number --max-columns 150 %s %S .")
("ag" . "ag --nocolor --nogroup %s %S .")
("pt" . "pt -e --nocolor --nogroup %s %S .")
("ack" . "ack --nocolor --nogroup %s %S .")
Expand Down

0 comments on commit c4ce10a

Please sign in to comment.