WalaWiki content from p1k3.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
974 B

  1. WareLogging, VimEditor, PerlLanguage.
  2. = perl compatible regular expressions =
  3. [http://vim.sourceforge.net/tips/tip.php?tip_id=393 Perl compatible regular expressions]. For most of the one-off expressions you'll ever write, there's a way to do what you want in vim. That said, if you're used to Perl, translating between the two dialects becomes painful for anything much beyond a simple search and replace. Instead:
  4. # Verify in :ver that +perl or +perl/dyn is compiled in.
  5. # Install Perl if necessary. On Windows, ActivePerl is required.
  6. # Type :perldo s/searchme/replaceme/g
  7. Or:
  8. :%!perl -pi -e 's/<text>/\n/'
  9. On Debian, you can
  10. apt-get install vim-perl
  11. <[Brennen]> When using perldo to perform substitutions, keep in mind that $_ is set to the current line ''without'' a newline - so if you're expecting whitespace at the end of the line, you may not find it.
  12. This works, though:
  13. :perldo s/(http\S+?)(\s|$)/"$1"$2/g
  14. Note the (\s|$).