Browse Source

Add interactive mode function to strip color codes

Alois Mahdal 9 years ago
parent
commit
ec388222dc
1 changed files with 9 additions and 0 deletions
  1. 9
    0
      dotfiles/bash/main.bashrc

+ 9
- 0
dotfiles/bash/main.bashrc View File

68
     bcompare "$@" &
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
 vims() {
80
 vims() {
72
     #
81
     #
73
     # Show "abandoned" Vim .swp files in a nice table
82
     # Show "abandoned" Vim .swp files in a nice table