sponsor Vim development Vim logo Vim Book Ad

update_perl_line_directives : automatically add/update line directives in perl embedded in vim scripts

 script karma  Rating 0/0, Downloaded by 954  Comments, bugs, improvements  Vim wiki

created by
Britton Kerin
 
script type
ftplugin
 
description
WARNING: if your vim links to (or dlopen()'s) a libperl earlier than 5.12, perl may end up lying to you about the line number by one (or maybe more, but one is what I've seen).

This script eases development of vim scripts that use embedded perl code by automatically adding or updating line directives to perl code blocks.  So for example:

     perl <<EOF

will automagically become

     perl <<EOF
     # line 42 /some/file.vim

when you save /some/file.vim.  You can use other valid here-document terminators, not just 'EOF'.

Now your error messages that come from perl will have correct file names and line numbers.

See also http://www.vim.org/scripts/script.php?script_id=3411 if you want to automatically catch perl syntax errors when vim scripts are saved.
 
install details
Its a standard vimball so all you need to do is:

     vim update_perl_line_directives.vba
     :so %
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
update_perl_line_directives.vba 0.3 2011-01-31 7.0 Britton Kerin Fixed bug which caused last line of files to get nuked
update_perl_line_directives.vba 0.2 2011-01-19 7.0 Britton Kerin Fixed off-by-one error in line number settings
update_perl_line_directives.vba 0.1 2011-01-19 7.0 Britton Kerin Initial upload
ip used for rating: 3.136.97.64

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github