zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: scratchpad text
Date: Tue, 26 Oct 2010 21:47:42 -0700	[thread overview]
Message-ID: <101026214742.ZM29753@torch.brasslantern.com> (raw)
In-Reply-To: <mailbox-7340-1288114726-867790@pepper>
In-Reply-To: <mailbox-8432-1288115225-108617@pepper>

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.


  reply	other threads:[~2010-10-27  4:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-26  0:48 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 [this message]
2010-10-26 17:54             ` Mikael Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=101026214742.ZM29753@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).