From 94855c05a13ab1dd67dd807b651c4f2f4c7399f8 Mon Sep 17 00:00:00 2001 From: Wryn Wagner Date: Tue, 29 Sep 2020 18:48:16 -0600 Subject: [PATCH] Added color demo and rgv (rip-grep vim) --- zsh/utility | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/zsh/utility b/zsh/utility index ab98684..cc38139 100644 --- a/zsh/utility +++ b/zsh/utility @@ -15,7 +15,6 @@ function notes() { NOTE="$NOTE_PATH/$1$NOTE_EXTENSION"; [ $1 ] && [ -f $NOTE ] & # --- GIT ----------------------------------------------------- alias gitbranchcleanup='git branch -d $(git branch | sed -E "/develop|master|\*/d")' - alias fix='vim $(git diff --name-only | uniq) -p'; @@ -51,3 +50,26 @@ alias qd='popd'; alias ds='dirs'; alias cdo='cd $(xclip -o)'; alias pdo='pwd | xclip'; + +alias rgv='EDIT_RIP_GREP_FILE_MATCHES'; + +EDIT_RIP_GREP_FILE_MATCHES() { + [ $EDITOR = "vim" ] \ + && $EDITOR -p $(rg -l $1) \ + || $EDITOR $(rg -l $1) ; +} + + +alias color_demo='DISPLAY_ALL_TERMINAL_COLORS' + +DISPLAY_ALL_TERMINAL_COLORS() { + for x in {0..8}; do + for i in {30..37}; do + for a in {40..47}; do + echo -ne "\e[$x;$i;$a""m\\\e[$x;$i;$a""m\e[0;37;40m " + done + echo + done + done + echo "" +}