1

I created a Vim command which will invoke perl6 as a filter, analogous to :perldo, though of course it isn't as powerful as :perldo. (Being an external command rather than an internal interpreter, there is no access to Vim's API and no memory of previous state.)

The command is defined as:

command! -nargs=1 -range=% Perl6do exec "<line1>,<line2>!perl6 -pe " . shellescape(<q-args>, 1)

It seems to work, but when I make a typo, the error output is inserted into the buffer. How do I make the filter abort if the external command gives an error? Do I need to make a helper function which emulates the "!" behavior and does its own error checking?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.