[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [vile] Is there a way to use xvile in a pipe?
From: |
Chris Green |
Subject: |
Re: [vile] Is there a way to use xvile in a pipe? |
Date: |
Tue, 6 Oct 2015 10:57:38 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Tue, Oct 06, 2015 at 05:28:19AM -0400, Thomas Dickey wrote:
>
>
> ----- Original Message -----
> | From: "Chris Green" <address@hidden>
> | To: address@hidden
> | Sent: Tuesday, October 6, 2015 5:20:54 AM
> | Subject: [vile] Is there a way to use xvile in a pipe?
> |
> | I know I can pipe standard input into xvile but is there a way of
> | getting its saved output to standard output?
> |
> | I.e. I want to do something like:-
> |
> | decrypt something to stdout | xvile | encrypt the file again
>
> xvile can read directly from a pipe (just tested...).
> To write the encrypted file, you would have to do something with a macro
> as I did for "vile-pager". Since vile does not know about shell ">",
> you'd have to do some workaround (write to a special device) to make it
> do standard output.
>
Hmm, I looked at vile-pager, it doesn't really address the problem too
well. I'm trying to replace my use of vile's encryption with
something better but I want to keep a simple interface such that I'm
less likely to screw things up when editing an encrypted file.
At present I just have a trivial script:-
echo -n "$1 Pwd: "
stty -echo
read pwd
stty echo
vile -k $pwd /home/chris/.notes/$1
This means it feels like an ordinary edit, I save with ZZ and
everything is done.
I looked at macros/gnugpg.rc but that involves using extra commands
and one is *very* likely to just do ZZ to exit and it's all messed up!
I'm hoping to use ccrypt (*much* more straightforward to use than gpg
or openssl, no unnecessary key generation, etc.) so it's easy to pipe
the file into xvile:-
ccat <encrypted file> | xvile
No copies in temporary files etc. (OK, it's in memory somewhere but
that's inevitable if I want to edit it!). All I want is a way to be
able to hit ZZ which will squirt the file out of xvile back through
the following:-
| ccrypt > <encrypted file>
I guess the simplest way for the moment might be to create a private
RAM disk on the fly and use that, it's not ideal though.
Or, altrnatively I make a custom .vilerc that changes ZZ to encrypting
the current buffer (but I'm not sure if that's possible using ccrypt)
and then saving it.
--
Chris Green