Created
June 1, 2010 19:44
-
-
Save rgieseke/421382 to your computer and use it in GitHub Desktop.
Rectangular selection for Textadept
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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