[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Editing and storing encrypted files


I've played a bit with autocommands in vim (the first time ever
I looked at them), and came up with this (shamelessly stolen
from the default vimrc, there it handles *.bz2):

augroup encrypted

    autocmd BufReadPre,FileReadPre        *.gpg set bin
    autocmd BufReadPre,FileReadPre        *.gpg let ch_save = &ch|set ch=2
    autocmd BufReadPost,FileReadPost      *.gpg '[,']!gpg --decrypt 2> /dev/null
    autocmd BufReadPost,FileReadPost      *.gpg set nobin
    autocmd BufReadPost,FileReadPost      *.gpg let &ch = ch_save|unlet ch_save
    autocmd BufReadPost,FileReadPost      *.gpg execute ":doautocmd BufReadPost " . expand("%:r")

    autocmd BufWritePre,FileWritePre    *.gpg   '[,']!gpg --encrypt 2> /dev/null
augroup END

It seems to work for me, and the .swp file is _encrypted_, no
need to disable them.

Could somebody more familiar with vim than me please tell me
(us) wheter this writes anything unencrypted onto disk? If not,
shall I file a wishlist bug against vim-rt to include this?

ciao, 2ri
Note that there are two possible orientations of the log. If the end with the
larger diameter is facing downstream, the log is said to be big-endian;
otherwise, it is little-endian.
	    -- Philip Willoughby <pwillo@microsith.com> on Segfault.org

Reply to: