Re: [code] look and feel and xsel with textadept.

From: Mitchell <m.att.foicica.com>
Date: Mon, 6 Apr 2015 10:05:10 -0400 (EDT)

Hi Joe,

On Sat, 4 Apr 2015, Joseph McDonald wrote:

>
> Hi, loving textadept and tweaking it, have a few questions:
>
> 1) Look and feel:
> the code folding markers are overlapping with my text
> by a pixel or so in curses textadept. I'd like some
> more space to the right of them So I made it 3 for the
> console in my init.lua:
>
> buffer.margin_width_n[2] = not CURSES and 24 or 3
>
> but it doesn't take effect unless I do a "reset()" while
> the buffer is active, and then sometimes if I switch away
> from that buffer and back to it, it loses the margin again.

This should be set in your ~/.textadept/properties.lua. The contents of
that file are executed for every new buffer. Putting your stuff in
init.lua only changes the first buffer.

> -- how to get cursor to blink in console?
> buffer.caret_style = buffer.CARETSTYLE_BLOCK
> buffer.caret_period = 300 -- doesn't work in console

This is not possible right now.

> -- how to change cursor color in console? (to orange for instance?)

Have you tried setting the `buffer.caret_fore` property in your theme?

> -- how to highlite current line in console?

Similarly, set `buffer.caret_line_back` in your theme and enable
`buffer.caret_line_visible` in your properties.lua. (I'm not entirely sure
this is supported though.)

> 2) I'd like textadept to work with my system clipboard, so
> that the textadept clipboard can be pasted to any app and
> vice versa. I think "xsel" is the way to go for that:
>
> https://hugoheden.wordpress.com/2009/03/08/copypaste-with-emacs-in-terminal/
>
> So I have this function:
> xsel_outgoing = function()
> proc = spawn('xsel --clipboard --input', nil, nil)
> proc:write(ui.clipboard_text)
> proc:close()
> end
>
> and I hooked it up to a few keystrokes that I use for
> cutting and copying text, but how do I make it more universal?
> That is, anytime something goes onto ui.clipboard text
> the xsel function is called?

No. The best you can do is ensure anywhere you (or Textadept) copies
clipbaord text, that text is sent to xsel via your function. This may
involve redefining some of the functions mapped to keys to call that
original function and then your xsel function.

> BTW, to let xsel work on
> a remote host with textadept-curses, ssh in with: ssh -X.
>
> for yanking text in from xsel, I'm not sure how to get
> the output of a shell command, what to call?:
>
> xsel_in = function()
> -- XXX how to call shell and get output?
> data = shell('xsel --clipboard --output')
> end

You can probably get away with Lua's `io.popen()`. No need for spawn since
you care about synchronous output.

Cheers,
Mitchell

-- 
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 Mon 06 Apr 2015 - 10:05:10 EDT

This archive was generated by hypermail 2.2.0 : Tue 07 Apr 2015 - 06:31:08 EDT