Code: Select all
-- home.lua
function key_macro()
	local tab   = 9
	local space = 32
	local oldpos = get_cursor_pos()
	MoveLineHome()
	local chdata = get_char_at()
	if (chdata == space) or (chdata == tab) then
		MoveLineFirst()
		if get_cursor_pos() == oldpos then
			MoveLineHome()
		end
	end
end
key_macro()
Code: Select all
-- copy.lua
function key_macro()
  -- make sure we have a document file
  if is_document() == 0 then
    message("This macro only works for document files!")
    return
  end
  -- check for a mark
  if is_marked() == 0 then
    -- try to use the current word
    MarkWordCurrent()
  end
  MarkCopy();
end
key_macro()
Code: Select all
 -- paste.lua
function key_macro()
  -- make sure we have a document file
  if is_document() == 0 then
    message("This macro only works for document files!")
    return
  end
  -- check for a mark
  if is_marked() == 0 then
    MarkWordCurrent()
  end
  MarkDelete()
  MarkPaste()
end
key_macro()
Code: Select all
-- findprev.lua
function findprev()
    local text = macro_tag("$W")
    local scope = get_search_option("Scope")
    local use_case = get_search_option("UseCase")
    local whole_word = get_search_option("WholeWord")
	local regexp = get_search_option("RegExpress")
    set_search_option("Scope", 1)
    set_search_option("UseCase", 0)
    set_search_option("WholeWord", 1)
    set_search_option("RegExpress", 0)
    set_find_text(text)
    SearchPrevious()
    set_search_option("Scope", scope)
    set_search_option("UseCase", use_case)
    set_search_option("WholeWord", whole_word)
    set_search_option("RegExpress", regexp)
end
findprev()
-Andy

