From c4ce10ad821f48066b9b5b371e2a0ca86d3a0b69 Mon Sep 17 00:00:00 2001 From: Aaron Jensen Date: Sat, 6 May 2017 16:33:09 -0700 Subject: [PATCH] helm/ivy: Limit rg results to 150 columns 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. --- layers/+completion/helm/packages.el | 4 ++-- layers/+completion/ivy/config.el | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/layers/+completion/helm/packages.el b/layers/+completion/helm/packages.el index 4f30e5a48598..c917e4a62ea9 100644 --- a/layers/+completion/helm/packages.el +++ b/layers/+completion/helm/packages.el @@ -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 () @@ -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 () diff --git a/layers/+completion/ivy/config.el b/layers/+completion/ivy/config.el index ae7055317708..4fc25e001311 100644 --- a/layers/+completion/ivy/config.el +++ b/layers/+completion/ivy/config.el @@ -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 .")