Skip to content

Instantly share code, notes, and snippets.

@rgieseke
Created June 1, 2010 19:44
Show Gist options
  • 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
-- Rectangular selection
-- Add the following to your init.lua
keys.ar = { function()
local events = events
local gui = gui
local KEYSYMS = _m.textadept.keys.KEYSYMS
gui.statusbar_text = 'Rectangular selection'
events.emit('update_ui')
rselect = events.connect('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
events.disconnect('keypress', rselect)
gui.statusbar_text = ''
events.emit('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