On Thu, Sep 07, 2000 at 07:19:11PM +0200, Wouter Hanegraaff wrote:
> On Thu, Sep 07, 2000 at 06:11:28PM +0200, Arthur Korn wrote:
> > It seems to work for me, and the .swp file is _encrypted_, no
> > need to disable them.
>
> The .swp file is definitely not encrypted. Worse, it's not possible to
> disable using a swapfile when a vim session is already started:
Well, it _is_ possible to disable a swapfile, just not with ":set uc=0"
as indicated in the manpage, but with ":set noswapfile".
After some tweaking with the autocommands, the following vimrc snippet
seems to work ok for me without creating unencrypted swap-, backup- or
tempfiles on disk.
Have fun,
Wouter
augroup encrypted
au!
" First make sure nothing is written to ~/.viminfo while editing
" an encrypted file.
autocmd BufReadPre,FileReadPre *.gpg set viminfo=
" We don't want a swap file, as it writes unencrypted data to disk
autocmd BufReadPre,FileReadPre *.gpg set noswapfile
" Switch to binary mode to read the encrypted file
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
" Switch to normal mode for editing
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")
" Convert all text to encrypted text before writing
autocmd BufWritePre,FileWritePre *.gpg '[,']!gpg -e -r Wouter 2> /dev/null
" Undo the encryption so we are back in the normal text, directly
" after the file has been written.
autocmd BufWritePost,FileWritePost *.gpg u
augroup END
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]