]> Sergey Matveev's repositories - dotfiles.git/commitdiff
Separate g and sorted-g commands
authorSergey Matveev <stargrave@stargrave.org>
Sun, 22 Dec 2019 15:19:53 +0000 (18:19 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 22 Dec 2019 15:19:55 +0000 (18:19 +0300)
If you pass -A, then sorting will break everything.

zsh/.zshrc

index adc241e438f48e0c39cdec09f19a348a6ce6bd76..9a783b766cac4515f9de9c232e96754e585c3de1 100644 (file)
@@ -109,10 +109,13 @@ bindkey -s "\eOR" " 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 "