Align Text Macro

This forum allows you to share scripts with other Zeus users. Please do not post bug reports, feature requests or questions to this forum, but rather use it exclusively for posting scripts or for the discussion of scripts that have been posted.
Post Reply
Site Admin
Posts: 2432
Joined: Fri Aug 13, 2004 5:10 pm

Align Text Macro

Post by jussij » Fri Jan 30, 2009 4:43 am

This script below will align code to a given vertical cursor location. specified.

For example assume you code looks like this where | is used to indicate the cursor location:

Code: Select all

        Some |            text
        that      is 
        all    over 
        the           place
Putting the cursor at the | location and running the macro four times gives you the nicely aligned code shown below:

Code: Select all

        Some text
        that is 
        all  over 
        the  place

Code: Select all

--        Name: Align  Macro
--      Author: Omer Kircher
--    Language: Lua Macro
-- Description: This function facilitates lining up columns of text. 
--              To use, load the macro (i.e. F9 key), position the cursor
--              and then run macro using the Macro Execute (i.e. F8 key)
--              Alternatively you can bind the macro to the keyboard.
--              Blank spaces between the cursor and the next word will 
--              be deleted.
--              The cursor is then moved to the next line ready for 
--              another operation.

function key_macro()

    -- look for a white space (32) ascii character
    if get_char_at() == 32 then
        -- remove the white space

    -- position the cursor on the next line

key_macro() -- run the macro

Post Reply
kuchnie warszawa opinie

Who is online

Users browsing this forum: No registered users and 2 guests