Skip to content

Instantly share code, notes, and snippets.

@rgieseke
Created June 1, 2010 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgieseke/421382 to your computer and use it in GitHub Desktop.
Save rgieseke/421382 to your computer and use it in GitHub Desktop.
Rectangular selection for Textadept
local KEYSYMS = textadept.keys.KEYSYMS
keys.ar = {function()
local t = _G.textadept
t.statusbar_text = 'Rectangular selection'
t.events.handle('update_ui')
t.events.add_handler('keypress', function(code, shift, control, alt)
if alt and KEYSYMS[code] == 'left' then
buffer:char_left_rect_extend()
return true
elseif alt and KEYSYMS[code] == 'up' then
buffer:line_up_rect_extend()
return true
elseif alt and KEYSYMS[code] == 'right' then
buffer:char_right_rect_extend()
return true
elseif alt and KEYSYMS[code] == 'down' then
buffer:line_down_rect_extend()
return true
else
table.remove(textadept.events['keypresss'], 1)
t.statusbar_text = ''
t.events.handle('update_ui')
return
end
end
, 1)
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment