Guest User

Untitled

a guest
Jan 18th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. " vim:set et sw=4 ts=4 tw=79 ft=vim:
  2.  
  3. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  4. " sh.vim syntax extension for highlighting Perl code inside shell HEREDOC "
  5. "============================================================================="
  6. " Save in ~/.vim/after/syntax/sh.vim "
  7. "-----------------------------------------------------------------------------"
  8. " Check if ~/.vim/after/syntax/sh.vim gist on Github differs from local file: "
  9. " diff <(gist --read 7b603ae72e8f2e7f5501495b5c451e36) \ "
  10. " ~/.vim/after/syntax/sh.vim "
  11. "-----------------------------------------------------------------------------"
  12. " Replace local file with current GitHub gist version: "
  13. " gist --read 7b603ae72e8f2e7f5501495b5c451e36 \ "
  14. " > ~/.vim/after/syntax/sh.vim "
  15. "-----------------------------------------------------------------------------"
  16. " Update GitHub gist with local ~/.vim/after/syntax/sh.vim file: "
  17. " gist --update 7b603ae72e8f2e7f5501495b5c451e36 \ "
  18. " ~/.vim/after/syntax/sh.vim "
  19. "-----------------------------------------------------------------------------"
  20. " Lint the script for style and logical errors: "
  21. " vint --style-problem ~/.vim/after/syntax/sh.vim | cut -d : -f 2- "
  22. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  23.  
  24. if exists('b:current_syntax')
  25. let s:previous_syntax = b:current_syntax
  26. unlet b:current_syntax
  27. endif
  28. syntax include @Perl syntax/perl.vim
  29. if exists('s:previous_syntax')
  30. let b:current_syntax = s:previous_syntax
  31. endif
  32.  
  33. syntax region shHereDoc
  34. \ matchgroup=shHereDocPerl start=/<<-\?\s*\'\z(PERLCODE\)\'/
  35. \ matchgroup=shHereDocPerl end=/^\s*\z1/
  36. \ contains=@Perl
  37.  
  38. """""""""""""""""""""""""""""""""""""""""""""""""""""
  39. " Perl HEREDOC example (shHereDocPerl): "
  40. "==================================================="
  41. " perl_embedded_srccode="$(cat <<'PERLCODE' "
  42. " print "$1\n" if /HREF="(.*?)"( ADD_DATE=|>)/; "
  43. " PERLCODE "
  44. " )" "
  45. """""""""""""""""""""""""""""""""""""""""""""""""""""
  46.  
  47. highlight def link shHereDocPerl shRedir
Add Comment
Please, Sign In to add comment