zsh-users
 help / color / mirror / code / Atom feed
* scratchpad text
@ 2010-10-26  0:48 Eric Smith
  2010-10-26  6:29 ` Bart Schaefer
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Smith @ 2010-10-26  0:48 UTC (permalink / raw)
  To: Zsh Users

I want to on the commandline write some text to guide a task. Then I 
can go like pushline with <esc>-q to move it away and work on my task. 
Then to bring back the "scratchpad" for reading or editing, I go 
<cntrl>-C.

But I could forget to pushline the scratchpad text again and 
just <cntrl>-c it away.

Is there a way to make this "scratchpad"  unlosable, like possibly 
writing it to the history or something even more weird and useful? 


-- 
- Eric Smith


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scratchpad text
  2010-10-26  0:48 scratchpad text Eric Smith
@ 2010-10-26  6:29 ` Bart Schaefer
  2010-10-26  7:40   ` Eric Smith
  0 siblings, 1 reply; 10+ messages in thread
From: Bart Schaefer @ 2010-10-26  6:29 UTC (permalink / raw)
  To: Zsh Users

On Oct 26,  2:48am, Eric Smith wrote:
}
} Is there a way to make this "scratchpad"  unlosable, like possibly 
} writing it to the history or something even more weird and useful? 

Like Functions/Misc/sticky-note, maybe?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scratchpad text
  2010-10-26  6:29 ` Bart Schaefer
@ 2010-10-26  7:40   ` Eric Smith
  2010-10-26  7:45     ` Mikael Magnusson
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Smith @ 2010-10-26  7:40 UTC (permalink / raw)
  To: zsh-users


> Like Functions/Misc/sticky-note, maybe?

Thanks Bart.

I guess I am dreaming a bit, looking for something lighter and 
even simpler.

Looking for just some light RAM space to supplement my own consciousness.
Ideally would like to write to some buffer space in physical top 
corner of screen. Even if editing is not possible. These points
would just supplement my current task or daily todo stuff or whatever.

Possible something like this could be implemented with virtual 
terminals like screen or tmux.

Eric


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scratchpad text
  2010-10-26  7:40   ` Eric Smith
@ 2010-10-26  7:45     ` Mikael Magnusson
  2010-10-26 11:37       ` Eric Smith
  0 siblings, 1 reply; 10+ messages in thread
From: Mikael Magnusson @ 2010-10-26  7:45 UTC (permalink / raw)
  To: zsh-users

On 26 October 2010 09:40, Eric Smith <es@fruitcom.com> wrote:
>
>> Like Functions/Misc/sticky-note, maybe?
>
> Thanks Bart.
>
> I guess I am dreaming a bit, looking for something lighter and
> even simpler.
>
> Looking for just some light RAM space to supplement my own consciousness.
> Ideally would like to write to some buffer space in physical top
> corner of screen. Even if editing is not possible. These points
> would just supplement my current task or daily todo stuff or whatever.
>
> Possible something like this could be implemented with virtual
> terminals like screen or tmux.

What about putting it in your RPS1 or something?

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scratchpad text
  2010-10-26  7:45     ` Mikael Magnusson
@ 2010-10-26 11:37       ` Eric Smith
  2010-10-26 15:16         ` Bart Schaefer
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Smith @ 2010-10-26 11:37 UTC (permalink / raw)
  To: zsh-users


-- 
- Eric Smith
Mikael Magnusson said:
> On 26 October 2010 09:40, Eric Smith <es@fruitcom.com> wrote:
> >
> >> Like Functions/Misc/sticky-note, maybe?
> >
> > Thanks Bart.
> >
> > I guess I am dreaming a bit, looking for something lighter and
> > even simpler.
> >
> > Looking for just some light RAM space to supplement my own consciousness.
> > Ideally would like to write to some buffer space in physical top
> > corner of screen. Even if editing is not possible. These points
> > would just supplement my current task or daily todo stuff or whatever.
> >
> > Possible something like this could be implemented with virtual
> > terminals like screen or tmux.
> 
> What about putting it in your RPS1 or something?

Cool idea, nicer if I could have  aright justify, trid using ^M for a 
newline and it puts the newline on the left.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scratchpad text
  2010-10-26 11:37       ` Eric Smith
@ 2010-10-26 15:16         ` Bart Schaefer
  2010-10-26 17:43           ` Eric Smith
  0 siblings, 1 reply; 10+ messages in thread
From: Bart Schaefer @ 2010-10-26 15:16 UTC (permalink / raw)
  To: zsh-users

On Oct 26,  1:37pm, Eric Smith wrote:
}
} Mikael Magnusson said:
} > On 26 October 2010 09:40, Eric Smith <es@fruitcom.com> wrote:
} > >
} > > Looking for just some light RAM space to supplement my own consciousness.
} > > Ideally would like to write to some buffer space in physical top
} > > corner of screen. Even if editing is not possible. These points
} > > would just supplement my current task or daily todo stuff or whatever.
} > 
} > What about putting it in your RPS1 or something?
} 
} Cool idea, nicer if I could have  aright justify, trid using ^M for a 
} newline and it puts the newline on the left.

How about:

    zle-line-init() {
      print -nR $terminfo[sc]$terminfo[home]"$REMINDER"$terminfo[rc]
    }
    zle -N zle-line-init

Then anything stored in the shell parameter REMINDER will be shown at
the top left of the screen.  Of course it'll begin to scroll off if you
have a multi-line command.

Replace sc/rc with tsl/fsl to use the status line if your terminal has
one (which you can test for by examining $terminfo[hs]).


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scratchpad text
  2010-10-26 15:16         ` Bart Schaefer
@ 2010-10-26 17:43           ` Eric Smith
  2010-10-26 17:50             ` Eric Smith
  2010-10-26 17:54             ` Mikael Magnusson
  0 siblings, 2 replies; 10+ messages in thread
From: Eric Smith @ 2010-10-26 17:43 UTC (permalink / raw)
  To: zsh-users

> How about:
> 
>     zle-line-init() {
>       print -nR $terminfo[sc]$terminfo[home]"$REMINDER"$terminfo[rc]
>     }
>     zle -N zle-line-init
> 
> Then anything stored in the shell parameter REMINDER will be shown at
> the top left of the screen.  Of course it'll begin to scroll off if you
> have a multi-line command.

Nice, I like.
I tried to have a multi-line display (as you pre-empted).
And using ^M as the newline car.
But the second line actually overprints the first line.

This would be a nice to ahve, but the idea is great I will use - it 
thanks.

> Replace sc/rc with tsl/fsl to use the status line if your terminal has
> one (which you can test for by examining $terminfo[hs]).

[eric@pepper ~] $ echo $terminfo[hs]
no

How would I change this?

Eric


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scratchpad text
  2010-10-26 17:43           ` Eric Smith
@ 2010-10-26 17:50             ` Eric Smith
  2010-10-27  4:47               ` Bart Schaefer
  2010-10-26 17:54             ` Mikael Magnusson
  1 sibling, 1 reply; 10+ messages in thread
From: Eric Smith @ 2010-10-26 17:50 UTC (permalink / raw)
  To: zsh-users


> > How about:
> > 
> >     zle-line-init() {
> >       print -nR $terminfo[sc]$terminfo[home]"$REMINDER"$terminfo[rc]
> I tried to have a multi-line display (as you pre-empted).
> And using ^M as the newline car.
> But the second line actually overprints the first line.
> 
Kill this question, it works great wrapping to more lines if you just
build a long string and use no newline chars.
I find the scratchpad stand out and more readable when I pad the 
string thus:
print -nR $terminfo[sc]$terminfo[home]"| $REMINDER                         |"$terminfo[rc]

Getting greedy now:
May we have colours?

And a nice easy way to recall the scratchpad text to edit at will.

Thanks for this Bart, its great!

Eric


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scratchpad text
  2010-10-26 17:43           ` Eric Smith
  2010-10-26 17:50             ` Eric Smith
@ 2010-10-26 17:54             ` Mikael Magnusson
  1 sibling, 0 replies; 10+ messages in thread
From: Mikael Magnusson @ 2010-10-26 17:54 UTC (permalink / raw)
  To: zsh-users

On 26 October 2010 19:43, Eric Smith <es@fruitcom.com> wrote:
>> How about:
>>
>>     zle-line-init() {
>>       print -nR $terminfo[sc]$terminfo[home]"$REMINDER"$terminfo[rc]
>>     }
>>     zle -N zle-line-init
>>
>> Then anything stored in the shell parameter REMINDER will be shown at
>> the top left of the screen.  Of course it'll begin to scroll off if you
>> have a multi-line command.
>
> Nice, I like.
> I tried to have a multi-line display (as you pre-empted).
> And using ^M as the newline car.
> But the second line actually overprints the first line.

^M is carriage return, ie go to beginning of line. Try echo hello^V^My
for example. If you want to enter literal newlines somewhere, try
^V^J.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scratchpad text
  2010-10-26 17:50             ` Eric Smith
@ 2010-10-27  4:47               ` Bart Schaefer
  0 siblings, 0 replies; 10+ messages in thread
From: Bart Schaefer @ 2010-10-27  4:47 UTC (permalink / raw)
  To: zsh-users

On Oct 26,  7:43pm, Eric Smith wrote:
}
} > Replace sc/rc with tsl/fsl to use the status line if your terminal has
} > one (which you can test for by examining $terminfo[hs]).
} 
} [eric@pepper ~] $ echo $terminfo[hs]
} no
} 
} How would I change this?

Use a different terminal emulator ...


On Oct 26,  7:50pm, Eric Smith wrote:
}
} Getting greedy now:
} May we have colours?
} 
} And a nice easy way to recall the scratchpad text to edit at will.

Well ... combining this with my previous suggestion ...

    autoload -Uz sticky-note
    zle -N sticky-note
    sticky-note -b

    zle-line-init() {
      local STICKYFILE=${STICKYFILE:-$HOME/.zsticky}
      local STICKYSIZE=${STICKYSIZE:-1000}

      if [[ -n "$STICKYFILE" && -s "$STICKYFILE" ]]
      then
	fc -ap $STICKYFILE $STICKYSIZE $STICKYSIZE
	print -nr "$terminfo[sc]$terminfo[home]"
	print -nr "$bg[yellow]$fg[black]"
	print -n -- "$(fc -n -l -1)"
	print -nr "$reset_color$terminfo[rc]"
      fi
    }
    zle -N zle-line-init

The print -n -- "$(fc ...)" is there to convert e.g. "\n" in the stored
history into a real newline in the display.  I may need to fix that in
sticky-note itself.

You can pick your own keybinding to invoke sticky-note as a widget,
e.g.

    bindkey ^X^Y sticky-note

You can then move up and down through previous notes to edit.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-10-27  4:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-26  0:48 scratchpad text Eric Smith
2010-10-26  6:29 ` Bart Schaefer
2010-10-26  7:40   ` Eric Smith
2010-10-26  7:45     ` Mikael Magnusson
2010-10-26 11:37       ` Eric Smith
2010-10-26 15:16         ` Bart Schaefer
2010-10-26 17:43           ` Eric Smith
2010-10-26 17:50             ` Eric Smith
2010-10-27  4:47               ` Bart Schaefer
2010-10-26 17:54             ` Mikael Magnusson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).