From 6981c67821d778e74284192002ad4f20cc7ec8df Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Tue, 28 Jul 2020 09:38:04 +0300 Subject: [PATCH] ++git-cblame --- README.md | 1 + git-cblame | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100755 git-cblame diff --git a/README.md b/README.md index 15e0033..f3176dd 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ will create the symbolic link for each script in the \ directory. ### Git - [git-aliases](git-aliases) shows a commented list of all git aliases. +- [git-cblame](git-cblame) adds a syntax highlighting to the standard `git blame` command. - [git-forks](git-forks) shows the latest forks of github repository. - [git-graphviz](git-graphviz) creates dot-graph of a git repository. - [git-ignore](git-ignore) gets specified gitignore settings from [https://gitignore.io/](https://gitignore.io/) website. diff --git a/git-cblame b/git-cblame new file mode 100755 index 0000000..dd12df6 --- /dev/null +++ b/git-cblame @@ -0,0 +1,17 @@ +#!/bin/bash + +# Blame с подсветкой синтаксиса + +vcat() { + BAT_CONFIG_PATH="$SHELLRC/etc/soft/bat/bat.conf" bat --decorations never "$1" +} + +clr() { + sed -e "s/$1/$(echo -e "\033")[7;32m&$(echo -e "\033")[1;0m/g" +} + +paste -d ' ' \ + <(git blame "$1" | cut -d ')' -f 1 | sed 's/(//' | clr "0\{9\}.*Not Committed Yet.*") \ + <(vcat "$1") \ +| less -R +