Guest User

Untitled

a guest
Jun 19th, 2018
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. " Vim plugin to strip ANSI escape sequences from an entire buffer.
  2. " Maintainer: Ben Kibbey <bjk@arbornet.org>
  3. " Last Change: Auguest 22, 2003
  4. "
  5. " $Log: stripansi.vim,v $
  6. " Revision 1.1 2003/08/22 22:56:47 bjk
  7. " Initial commit.
  8. "
  9.  
  10. if exists("loaded_stripansi")
  11. finish
  12. endif
  13.  
  14. let loaded_stripansi = 1
  15.  
  16. noremap <unique> <script> <Plug>StripAnsi <SID>StripAnsi
  17. noremap <SID>StripAnsi :call <SID>StripAnsi()<CR>
  18. noremenu <script> Plugin.StripAnsi <SID>StripAnsi
  19.  
  20. if !hasmapto('<Plug>StripAnsi')
  21. nmap <unique> <Leader>sa <Plug>StripAnsi
  22. endif
  23.  
  24. if exists(":StripAnsi") != 2
  25. comm -nargs=0 StripAnsi call <SID>StripAnsi()
  26. endif
  27.  
  28. func <SID>StripAnsi()
  29. :%s/\(\[\d*[ABCD]\)\|\(\[\d*,\d*[HfR]\)\|\(\[2J\)\|\(\[\d*m\)\|\(\[\d*\([;]\)\?\d*\([;]\)\?\d*[mH]\)//ge
  30. :%s/\(\[=[01]\?[h1]\?\)\|\(\[=[0-7],7[h1]\)\|\(\[?[7]\?[h1]\{,2\}\)\|\(\[[suK:]\)\|\(=\)//ge
  31. endfunc
Add Comment
Please, Sign In to add comment