Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
vim in an edit pipeline
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Art Scheel  
View profile  
 More options Oct 1 2012, 12:52 pm
From: Art Scheel <asch...@gmail.com>
Date: Mon, 1 Oct 2012 09:52:26 -0700 (PDT)
Local: Mon, Oct 1 2012 12:52 pm
Subject: vim in an edit pipeline

vim can read stdin with 'vim -' but there's currently no way to submit all edited changes to stdout (so far as I can find.)  There are plenty of scripts and plugins that allow this kind of functionality, but they all require a file to be written to disk (even if it's a RAMDISK).

Would it be worth pursuing a patch that would allow a saved file (:wq) to send the newly edited text to 'stdout'?

My particular end goal is to handle the editing of encrypted text files, hence the necessity for the inbound and outbound files to never be written to disk except for the encrypted versions of this file.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Fritz  
View profile  
 More options Oct 1 2012, 3:26 pm
From: Ben Fritz <fritzophre...@gmail.com>
Date: Mon, 1 Oct 2012 12:26:35 -0700 (PDT)
Local: Mon, Oct 1 2012 3:26 pm
Subject: Re: vim in an edit pipeline

On Monday, October 1, 2012 11:52:26 AM UTC-5, Art Scheel wrote:
> vim can read stdin with 'vim -' but there's currently no way to submit all edited changes to stdout (so far as I can find.)  There are plenty of scripts and plugins that allow this kind of functionality, but they all require a file to be written to disk (even if it's a RAMDISK).

> Would it be worth pursuing a patch that would allow a saved file (:wq) to send the newly edited text to 'stdout'?

> My particular end goal is to handle the editing of encrypted text files, hence the necessity for the inbound and outbound files to never be written to disk except for the encrypted versions of this file.

I don't think you need a patch for this.

First, Vim allows you to use the :w command to invoke any shell command with stdin taken from the current Vim buffer. So, :%w !encrypt would pass all text in the current buffer to the "encrypt" program on stdin.

Second, Vim allows you to define a BufWriteCmd autocmd, which specifies what Vim should actually do to write a file. So you could use the above method inside an autocmd to make it transparent, if desired.

Finally, Vim has strong "Blowfish" encryption built in. If you want a specific encryption scheme which you already use, this doesn't matter, but if you're only interested in general in being able to use Vim to edit encrypted files, this may be a better solution.

Do these methods meet your needs?

Be aware that Vim's swapfile, viminfo file, backup file, and possibly undo file may all contain unencrypted text. Make sure to turn these off for your encrypted edit. When using Vim's built-in encryption, the swap file and undo file are encrypted with the file so those two can still be used.

:help encryption says that filtering with :!cmd or :w !cmd do not encrypt the text which "may reveal it to others". I'm not sure under what circumstances this can happen.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Art Scheel  
View profile  
 More options Oct 1 2012, 3:41 pm
From: Art Scheel <asch...@gmail.com>
Date: Mon, 1 Oct 2012 13:38:12 -0600
Local: Mon, Oct 1 2012 3:38 pm
Subject: Re: vim in an edit pipeline

Currently, my template script creates a temporary .vimrc invoked with -u
that sets viminfo= to nothing so viminfo doesn't get saved/used.  I was
doing the same with the swap file so no swap is created in this instance.
The BufWriteCmd very well may fit the bill.

The goal is to make this user friendly so people can use it who have only
the most rudimentary of 'vi' knowledge and I think BufWriteCmd will fit the
bill in this particular case, assuming that 'gpg' can handle being passed
the data as it does in a standard pipe as in from the CLI.

As far as :w !cmd  not encrypting the text, this isn't too big of a deal so
long as it's not written to disk.  Nothing will withstand someone who has
access to read directly from memory and if it gets to that point, I have
much bigger issues on hand.

--
Molon Labe
"Come and take them"

"By divine design, fathers are to preside over their families in love and
righteousness and are responsible to provide the necessities of life and
protection for their families."

"The Marines I have seen around the world have the cleanest bodies, the
filthiest minds, the highest morale, and the lowest morals of any group of
animals I have ever seen. Thank God for the United States Marine Corps!"
-Eleanor Roosevelt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »