Re: [code] Parenthesis and selection

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

More to it: maybe t is the convoluted way of handling some non-English
keyboards, but

keys[OSX and 'a{' or '{'] = function() ... end

does the trick on my spanish Mac OSX keyboard.

Time to make sure that the character (sequence) you intent to produce is
the character you actually see in the code? I mean, I don't know how it is
in other foreign keyboards, but if you type '{' and need a modifier because
your keyboard says so, the code should only see the '{' without the
modifiers you needed to press to get it.

If not, sharing configs among users or simple code snippets will be a pain.

/PA

On 29 September 2016 at 08:52, Pedro Andres Aranda Gutierrez <
paaguti.att.gmail.com> wrote:

> 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
>

-- 
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 - 04:44:47 EDT

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