jEdit Macros make life easy

David Gluzman July 6th, 2005

I’ve recently discovered the power of ‘regular expression’ find and replace. Huh? Well, instead of searching for a particular string of text, I can define the start and end of lines and do something for each.


Search for: ^ (this means start of new line)
Replace with: “< p>” (without spaces mind you)

And BLAM! It will put a paragraph tag to the start of every new line (to either the entire document, or just your selection).


Combine regular expressions with the power of jEdit (this is my full time text editor of choice, which runs on any OS since it’s Java based); and you can do some seriously cool stuff (Geek alert). But seriously I’ve made a few macros that will go thru a document (such as a submitted article to R4NT) and format all the paragraphs within a literal blink of an eye! Oh man, this is gonna make my life way easier.

So here are two .bsh (BeanScript) macro files I’ve created that I’d like to share to anyone that might be interested.

Paragraph Formatter
List Item Formatter

Just dump these files into your Macro directory (normally in your documents and settings directory), make some keyboard short cuts, and you’ll be formatting documents faster than ever.

Hmm.. Now if I could only write a macro to deploy the magazine each month.. Hmm…

  • D4V

    It seems that I may not have been entirely detailed on what the macros do. So let me quickly explain in greater detail..

    The script:

    Runs thru finds all new lines adds
    Finds all end of lines and adds
    then goes thru and find all the lines that were blank (and had both tags back to back, say on an empty line [such as ] and deletes them all.

    Hope that makes that a bit clearer.. ;)

  • Re: Shoe

    Welcome to the ex editor in UNIX, circa 1978.

    g/D4V/ .s:.*::