[code] [textadept] quickly cut a whole line with Ctrl+X

From: Jeremy Clarke <geckojsc.att.gmail.com>
Date: Wed, 11 Nov 2015 16:52:49 +0000

Hi everyone, I just noticed that useful Ctrl+F auto-populate topic, and
figured I'd share this snippet that I've been using for a while.

It allows for Ctrl+X to delete a whole line when there is no selection
active.

As far as I know the editor didn't already have this feature, but let me
know if I'm mistaken!

(I put it in properties.lua, not sure if it works in init)

keys[not OSX and 'cx' or 'mx'] = function ()
    if buffer.selection_start == buffer.selection_end then
        local line = buffer:line_from_position(buffer.current_pos)
        buffer:set_selection(
            buffer:position_from_line(line),
            buffer:position_from_line(line+1))
    end
    buffer:cut()
end

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Wed 11 Nov 2015 - 11:52:49 EST

This archive was generated by hypermail 2.2.0 : Thu 12 Nov 2015 - 06:45:53 EST