소스 검색

Add interactive mode function to strip color codes

Alois Mahdal 9 년 전
부모
커밋
ec388222dc
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. 9
    0
      dotfiles/bash/main.bashrc

+ 9
- 0
dotfiles/bash/main.bashrc 파일 보기

@@ -68,6 +68,15 @@ bcdiff() {
68 68
     bcompare "$@" &
69 69
 }
70 70
 
71
+strip_colors() {
72
+    #
73
+    # Strip color codes from stdin
74
+    #
75
+    # Stolen from http://unix.stackexchange.com/a/4533/9365
76
+    #
77
+    sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
78
+}
79
+
71 80
 vims() {
72 81
     #
73 82
     # Show "abandoned" Vim .swp files in a nice table