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
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()
screen_update_disable()
-- look for a white space (32) ascii character
if get_char_at() == 32 then
-- remove the white space
MarkColumnToggle()
MoveWordNext()
MarkDeleteEx()
end
-- position the cursor on the next line
MoveLineDown()
screen_update_enable()
screen_update()
end
key_macro() -- run the macro