[clug] transparent gpg in vim [answer]

Eyal Lebedinsky eyal at eyal.emu.id.au
Sun Apr 3 06:41:21 UTC 2016


On 14/02/16 19:06, Eyal Lebedinsky wrote:
> I am using this feature for a few years happily. My .vimrc was from here (a long time ago):
>      http://blog.endpoint.com/2012/05/vim-working-with-encryption.html
>
> Today I found that I have a problem when I used it in a VM, where I thought it worked before.
>
> I can easily open a gpg encrypted file. No problem.
> When I write the file the prompts for a passphrase come up as expected. However, the saved file is much larger
> than I expected. running 'file' on it says 'data' while on a proper gpg file it knows it is.
>
> When I open the saved file it does not ask for the passphrase, but shows
>      "test.gpg" 3L, 759C
>      shell returned 2
>      3 lines filtered
>      Press ENTER or type command to continue
>
> The opened file is empty.
> The original file has only two words, gpg encrypted it is about 80 bytes, the badly saved one is 77 bytes.
>
> Another point. Initially even this did not work. I did not have any pub/sec keyrings, so when saving (in vim) I got a prompt
> (probably from gpg):
>      You did not specify a user ID, (you may use "-r")
>      Current recipients:
>      Enter the user ID, End with an empty line:
>
> I did not know how to respond. Do I did a 'gpg --gen-key' with fake data and got the behavior described at the top.
>
> Finally, should I switch to using 'vim -x' with 'cryptmetod="blowfish2"'? I use it to keep my passwords file
> (no need to discuss other ways of addressing this need). The nice thing about what I use is that I can always
> {en,de}crypt with 'gpg' when I do not have access to vi.

Seems that no one is interested...

Now that I am back from my travels, and having spent some time looking at the vim and gpg
configurations, it turned out to be unrelated to these.

What I needed is a setting of "LC_ALL=C" which I have on my desktop but not on my portable
system (my laptop). I had this set many years ago or else sort order (e.g. in 'ls') is not
what I was (am) used to.

-- 
Eyal Lebedinsky (eyal at eyal.emu.id.au)



More information about the linux mailing list