From 8192828336a79c463f351d7fd12c9b7daaa0346d Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sun, 22 Dec 2019 18:19:53 +0300 Subject: [PATCH] Separate g and sorted-g commands If you pass -A, then sorting will break everything. --- zsh/.zshrc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index adc241e..9a783b7 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -109,10 +109,13 @@ bindkey -s "OR" " git status --short\n" # F3 # grep {{{ GREP=/usr/local/bin/grep +GREP_ARGS="--color=always --with-filename --line-number --recursive" +LESS_COLORED="less --RAW-CONTROL-CHARS" g() { - $GREP --color=always --with-filename --line-number --recursive $@ | - sort --numeric-sort | - less --RAW-CONTROL-CHARS + $GREP ${=GREP_ARGS} $@ | ${=LESS_COLORED} +} +gS() { + $GREP ${=GREP_ARGS} $@ | sort --numeric-sort | ${=LESS_COLORED} } alias -g G="| $GREP --color" alias gg="git grep " -- 2.44.0