Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " vim:set et sw=4 ts=4 tw=79 ft=vim:
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " sh.vim syntax extension for highlighting Perl code inside shell HEREDOC "
- "============================================================================="
- " Save in ~/.vim/after/syntax/sh.vim "
- "-----------------------------------------------------------------------------"
- " Check if ~/.vim/after/syntax/sh.vim gist on Github differs from local file: "
- " diff <(gist --read 7b603ae72e8f2e7f5501495b5c451e36) \ "
- " ~/.vim/after/syntax/sh.vim "
- "-----------------------------------------------------------------------------"
- " Replace local file with current GitHub gist version: "
- " gist --read 7b603ae72e8f2e7f5501495b5c451e36 \ "
- " > ~/.vim/after/syntax/sh.vim "
- "-----------------------------------------------------------------------------"
- " Update GitHub gist with local ~/.vim/after/syntax/sh.vim file: "
- " gist --update 7b603ae72e8f2e7f5501495b5c451e36 \ "
- " ~/.vim/after/syntax/sh.vim "
- "-----------------------------------------------------------------------------"
- " Lint the script for style and logical errors: "
- " vint --style-problem ~/.vim/after/syntax/sh.vim | cut -d : -f 2- "
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- if exists('b:current_syntax')
- let s:previous_syntax = b:current_syntax
- unlet b:current_syntax
- endif
- syntax include @Perl syntax/perl.vim
- if exists('s:previous_syntax')
- let b:current_syntax = s:previous_syntax
- endif
- syntax region shHereDoc
- \ matchgroup=shHereDocPerl start=/<<-\?\s*\'\z(PERLCODE\)\'/
- \ matchgroup=shHereDocPerl end=/^\s*\z1/
- \ contains=@Perl
- """""""""""""""""""""""""""""""""""""""""""""""""""""
- " Perl HEREDOC example (shHereDocPerl): "
- "==================================================="
- " perl_embedded_srccode="$(cat <<'PERLCODE' "
- " print "$1\n" if /HREF="(.*?)"( ADD_DATE=|>)/; "
- " PERLCODE "
- " )" "
- """""""""""""""""""""""""""""""""""""""""""""""""""""
- highlight def link shHereDocPerl shRedir
Add Comment
Please, Sign In to add comment