<<< Date Index >>>     <<< Thread Index >>>

Re: Attachment reminders



On 02Dec2006 22:44, Todd Zullinger <tmz@xxxxxxxxx> wrote:
| Cameron Simpson wrote:
| > [...] Adding an "Attach:" header with a file pathname [...]
| > To make this convenient, I have ctrl-A in my editor (vi) mapped to:
| > 
| > 1G}-:.r!exec </dev/tty 2>/dev/tty; readline 'Attach: '<CR>IAttach: <Esc>
| > 
| > Those are real Enter and Escape codes, BTW. This prepares an Attach:
| > header, calling readline to let you enter the filename with file
| > completion.
| 
| Hmmm, I'm feeling dense.  I added a line to my .vimrc to test this
| method and I always have some remnants of the exec command left on the
| line as I enter the filename.  The prompt looks like this to start:
| 
| Attach: </dev/tty 2>/dev/tty; readline "Attach: "

Yeah, tacky. I'll modify the readline script [...hacks...] Ok,
please refetch the "readline" script. Then modify your macro to call
readline with the -B option. It looks cleaner at this end now.

| If I type something and backspace, the extra command text disappears
| and leaves only the intended "Attach: " portion.

Probably an artifact of the line redrawing in use in your terminal.
Should be irrelevant now.

| map! <F4> <ESC>1G}-:r!exec </dev/tty 2>/dev/tty; readline "Attach: 
"<CR>IAttach:
| (I'm using Vim 7.0.)

It's not vim, it's my readline. The new script above should help.
Change:

  readline "Attach:

into:

  readline -B "Attach:

| > "readline"'s a little bash script I have:
| >   http://www.cskk.ezoshosting.com/cs/css/bin/readline
[...]
| Yes, very handy and likely all the more I'll need to avoid sending too
| many emails with missing attachments.

I use this pretty extensively in several scripts that prompt for things
these days, just for the command line editing. And of course sometimes for
the filename completion (eg in apphelper).

See how it goes now. Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

Old age may seem unappealing, but consider the alternative.