From 68d91bcbdce6b4504a9e141982c1ef408bfd9a9f Mon Sep 17 00:00:00 2001 From: skywind3000 Date: Wed, 28 Feb 2018 17:50:00 +0800 Subject: [PATCH] update ccat function --- languages/bash.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/languages/bash.sh b/languages/bash.sh index d8b089b..c9ed51f 100644 --- a/languages/bash.sh +++ b/languages/bash.sh @@ -1,6 +1,6 @@ ############################################################################## # BASH CHEATSHEET (中文速查表) - by skywind (created on 2018/02/14) -# Version: 30, Last Modified: 2018/02/28 17:24 +# Version: 31, Last Modified: 2018/02/28 17:49 # https://github.com/skywind3000/awesome-cheatsheets ############################################################################## @@ -646,6 +646,9 @@ lsof -P -i -n | cut -f 1 -d " "| uniq | tail -n +2 # Vim 中保存一个没有权限的文件 :w !sudo tee > /dev/null % +# 终端下正确设置 ALT 键和 BackSpace 键 +http://www.skywind.me/blog/archives/2021 + ############################################################################## # 有用的函数 @@ -696,14 +699,11 @@ function q-compress() { function ccat() { local style="monokai" if [ $# -eq 0 ]; then - pygmentize -P style=$style -f terminal256 -g + pygmentize -P style=$style -P tabsize=4 -f terminal256 -g else - lexer=$(pygmentize -N "$1") - if [ "$lexer" != "text" ]; then - pygmentize -P style=$style -f terminal256 -l $lexer "$1" - else - pygmentize -P style=$style -f terminal256 -g "$1" - fi + for NAME in $@; do + pygmentize -P style=$style -P tabsize=4 -f terminal256 -g "$NAME" + done fi }