Re: [cream] integrating and using WoC
Cream is a free, easy-to-use configuration of the Vim text editor
Brought to you by:
digitect
From: Dave (My-IOP) <da...@my...> - 2008-02-06 04:26:57
|
It seems to work (except I got a message about an incomplete last line when saving the test text file), but it doesn't exactly fit my needs. I am hoping for a solution more like the text encyrption plugin for gedit. With that plugin, I can create a text file like what is shown below by highlighting the lines I want to encrypt and selecting a menu command. I can decrypt just by selecting the text and picking decrypt from the edit menu. This is what I would like to do in Cream (but binding the command to a key combination would be ideal). Any suggestions for me? Thanks. This is a test of gpg with gedit. This is my document. It includes a few lines that are encrypted. —–BEGIN PGP MESSAGE—– Version: GnuPG v1.4.6 (GNU/Linux) hQIOA70D9kgXrV4FEAf/Uy9wLsazJ6mi+Ncmi11SwmyzNhoSpfbKnaVFGwzLGvmp x/X0dkXzmsnT0rnAoTJAKf5NLsxDtTH6hxNG9NjQ77nmKmftZQLz5kQvkN4zDDLN RFUhH+Rb4VqZr6CT5+XQcAWQtysMTu0CRh+91auwSBudhu0uY0YOetvvnI+WOqO1 0ygJ1/Pkr4zxX3RnmqRa23vWedfdB4ePHgvk4pjX5QveNB2/IhEH1gKFTAhjlxQc pNJWAT8DJBKMcgHDxpro2ndEg6YshF0oORpcC4o3Ln+b+rsPQGnzSlb+6buLp85Z pc+BFYkJcuT3wJ3alhKiHjkxIUAtw3O5YtgxktPMyf3jxadSS/39hxM= =MZGO —–END PGP MESSAGE—– Cream is great! end of my text doc. On Feb 5, 2008 10:53 PM, Steve Hall <dig...@da...> wrote: > > That might work ok, just put it in your cream-user as Cream will not > load the vimrc. > > > On Tue, 2008-02-05 at 22:38 -0500, Dave (My-IOP) wrote: > > Hi Steve, > > Thanks for your reply. I just figured out that the double quote was > > the comment char! :) > > > > The gpg integration I'm trying is described here: > > http://www.mail-archive.com/deb...@li.../msg506098.html > > > > They say this goes in vimrc. I'm just getting ready to try it. It > > should work with Cream, right? > > augroup encrypted > > au! > > " First make sure nothing is written to ~/.viminfo while editing > > > > " an encrypted file. > > autocmd BufReadPre,FileReadPre,BufNewFile *.gpg,*.asc set > viminfo= > > " We don't want a swap file, as it writes unencrypted data to > disk. > > autocmd BufReadPre,FileReadPre,BufNewFile *.gpg,*.asc set > > > > noswapfile > > " Switch to binary mode to read the encrypted file. > > autocmd BufReadPre,FileReadPre *.gpg set bin > > autocmd BufReadPre,FileReadPre *.gpg,*.asc let ch_save = > &ch|set > > > > ch=2 > > autocmd BufReadPost,FileReadPost *.gpg,*.asc > > \ '[,']!sh -c 'gpg --decrypt 2> /dev/null' > > " Switch to normal mode for editing > > autocmd BufReadPost,FileReadPost *.gpg set nobin > > > > autocmd BufReadPost,FileReadPost *.gpg,*.asc let &ch = > ch_save|unlet > > ch_save > > autocmd BufReadPost,FileReadPost *.gpg,*.asc > > \ execute ":doautocmd BufReadPost " . expand("%:r") > > > > " Convert all text to encrypted text before writing > > autocmd BufWritePre,FileWritePre *.gpg set bin > > autocmd BufWritePre,FileWritePre *.gpg > > \ '[,']!sh -c 'gpg --default-recipient-self -e > 2>/dev/null' > > > > autocmd BufWritePre,FileWritePre *.asc > > \ '[,']!sh -c 'gpg --default-recipient-self -e -a > 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,*.asc u > > autocmd BufWritePost,FileWritePost *.gpg set nobin > > augroup END > > > > > > On Feb 5, 2008 10:31 PM, Steve Hall <dig...@da...> wrote: > > On Tue, 2008-02-05 at 22:05 -0500, Dave (My-IOP) wrote: > > > On Feb 5, 2008 9:13 PM, Steve Hall <digitect dancingpaper > > com> wrote: > > > > On Mon, 2008-02-04 at 22:22 -0500, Dave (My-IOP) wrote: > > > > > > > > > > > > I want to have URLs (hyperlinks) in plain text docs. > > > > > > > > > > I just committed an update that might help, copy this file > > over > > > > yours of the same name: > > > > > > > > > > http://cream.cvs.sourceforge.net/cream/cream/cream-lib.vim > > > > > > > > Hi Steve, > > > I tested it and this works great. Thanks! > > > > > > I think I want to go one step further and tweak it to > > recognize a > > > URL if it includes "www." but not "http://". Do you have any > > tips to > > > get me started? I've never worked with vim scripts before. > > Is the > > > follow code all I would have to change (around line 1559)? > > > > > > "if match(myfile, "http://", 0) == 0 > > > " let isURL = 1 > > > "elseif match(myfile, "www.", 0) == 0 > > > " let isURL = 1 > > > > > > Yes, although make sure you're editing the "live" code, down > > under > > OPTION 2. (Your lines above are commented by the double-quote > > chars, I > > think from the first, obsolete OPTION 1 section.) > > > > I'll add this to the project, although it does mean files can > > not > > begin with "www.". > > > > > One of my next tasks is to integrate gpg with Cream. I have > > found > > > some examples of how to do that with Vim. Will they work > > with Cream > > > too? Does Cream already have some support for gpg built in > > that I'm > > > not aware of? > > > > > > Cream has everything built-in that Vim does, but I don't find > > any > > references to gpg (or pgp) in the Vim help. As long as the > > functionality is in the base Vim and is handled behind the > > usual > > dialogs, options, and autocmds you should have no problem. But > > if it > > is implemented in a script overlay, it could require a bit of > > work to > > make sure Cream uses it properly. > > > > > > > > > > > > |