On Fri, Nov 18, 2011 at 09:53:02AM -0800, Parag Kalra wrote: > Hi, Hello:
> I generally use vi/vim for my day to day Perl scripts.
Same. B-)
> For example - it should be able inform me about the known
> syntax errors like - variables not declared, missing braces or
> semicolons etc something which Eclipse done.
The best I can come up with is a key mapping to execute perl to
check the syntax. Perhaps something like this:
:map K :!perl -c %<cr>
Then type K in normal mode to have your current buffer checked
for syntax by perl (I used K because some random guide online
said it was unbound by default). I just tried this out now and it
actually works surprisingly well. Of course, it's not real-time,
but for that you'd need to interact with Vim to figure out how to
show the errors to the user unintrusively. I think it's nicer to
let the user invoke it. You could use a similar mapping to
actually run the program as well.
I guess if you wanted to get really fancy you could map a custom
program to invoke with a key mapping that would overwrite the
existing buffer, parsing the output from "perl -c" and embedding
the errors within the buffer around implicated lines, but that's
probably getting too complicated to do well without a lot of
effort.
Sometimes it's best to just keep it simple. :)
Regards,
--
Brandon McCaig <[email protected]> <[email protected]>
Castopulence Software <https://www.castopulence.org/>
Blog <http://www.bamccaig.com/>
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'
signature.asc
Description: Digital signature
