Re: [code] Parenthesis and selection

From: Pedro Andres Aranda Gutierrez <paaguti.att.gmail.com>
Date: Thu, 29 Sep 2016 08:52:47 +0200

Hey Mitchell,

Curious behaviour|feature|bug... works fine in my LinuxVM in OSX, doesn't
on my native OSX... Will check this afternoon with native Linux @ home...

Best, /PA

On 28 September 2016 at 17:07, Mitchell <m.att.foicica.com> wrote:

> Hi Pedro,
>
> On Wed, 28 Sep 2016, Pedro Andres Aranda Gutierrez wrote:
>
> Hi,
>>
>> I was wondering how to make Textadept put parenthesis around the selection
>> when I'm in Latex mode (for example). When I have a word and I want to put
>> it in italics, it's like
>>
>> \textit{word}
>>
>> If I'm modifying an exisiting document, the easiest way would be to write
>> '\textit' before it, then select the zone I want on italics and then just
>> press '{' to put the selection between {}
>>
>> Currently, pressing { will replace the selection with {}...
>>
>
> The function you want is `textadept.editing.enclose()`[1]. Then you'll
> want to override the '{' key. Something like this in your
> `~/.textadept/init.lua` will work:
>
> keys['{'] = function()
> if buffer.selection_empty then return false end -- default { insert
> textadept.editing.enclose('{', '}')
> return true -- prevent default { insert
> end
>
> Cheers,
> Mitchell
>
> [1]: http://foicica.com/textadept/api.html#textadept.editing.enclose
> --
> 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.
>
>

-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellet zu werden
Gerog Kreisler
-- 
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 Thu 29 Sep 2016 - 02:52:47 EDT

This archive was generated by hypermail 2.2.0 : Thu 29 Sep 2016 - 06:25:39 EDT