ega...@gmail.com
unread,May 14, 2016, 2:35:40 PM5/14/16Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vim_use
Hi,
it makes many years that I am using vim to open a text file which is encrypted by gpg. To this aim, in my .vimrc I have the following:
augroup encrypted
" Support for transparent editing of gpg (symmetric) encrypted files
au!
" Make sure nothing is written to ~/.viminfo while editing an encrypted file.
autocmd BufReadPre,FileReadPre *.asc,*.gpg set viminfo=
" We don't want a swap file, as it writes unencrypted data to disk
autocmd BufReadPre,FileReadPre *.asc,*.gpg set noswapfile
" Switch to binary mode to read the encrypted file
autocmd BufReadPre,FileReadPre *.asc,*.gpg set bin
autocmd BufReadPre,FileReadPre *.asc,*.gpg let ch_save = &ch|set ch=2
autocmd BufReadPost,FileReadPost *.asc,*.gpg '[,']!gpg --decrypt 2> /dev/null
" Switch to normal mode for editing
autocmd BufReadPost,FileReadPost *.asc,*.gpg set nobin
autocmd BufReadPost,FileReadPost *.asc,*.gpg set foldmethod=indent
autocmd BufReadPost,FileReadPost *.asc,*.gpg hi Folded term=standout ctermfg=2 ctermbg=0
autocmd BufReadPost,FileReadPost *.asc,*.gpg let &ch = ch_save|unlet ch_save
autocmd BufReadPost,FileReadPost *.asc,*.gpg execute ":doautocmd BufReadPost " . expand("%:r")
" Convert all text to encrypted text before writing
autocmd BufWritePre,FileWritePre *.asc %!gpg -a -c 2>/dev/null
autocmd BufWritePre,FileWritePre *.gpg %!gpg -c 2>/dev/null
" Undo the encryption so we are back in the normal text, directly after the file has been written.
autocmd BufWritePost,FileWritePost *.asc,*.gpg u
augroup END
All the above worked seamlessly throughout all the upgrades I made over the years to the underlying linux distribution.
Up to now... :(
Now I upgraded to Ubuntu 16.04 and there it does not work anymore.
To be more precise, using plain vim (my preferred), sometime it works, but most of the times it doesn't and to help debugging I can add the following: when I open my file (say: vim r.txt.asc) the prompt I get is:
"r.txt.asc" 100L, 6206C
Enter passphrase:
In this case, it doesn't work.
Sometimes I get a different prompt, which looks like an error, that is:
"r.txt.asc" 100L, 6206C
^[[2;2REnter passphrase:
In these cases, it works!
Does anybody have any hint?
Thanks