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: Steve H. <dig...@da...> - 2008-02-06 18:53:10
|
From: "Dave (My-IOP)", Tue, February 05, 2008 11:41 pm > > I just found this info that might address my last question: > http://www.savvyadmin.com/2007/10/08/perform-gnupg-functions-within-vim/#comments > > ---- Simply add the following to your "~/.vimrc" file: > > :cmap cs %!gpg --clearsign > :cmap es %!gpg -seat > :cmap ee %!gpg -eat > :cmap de %!gpg -d > > Is ':set textwidth=70' required for gpg in this situation? I wouldn't think so, at least I wouldn't design it that way myself. > How would I bind these commands to shortcut keys in Cream? Cream relies on a slightly more complex method of mapping to keep everything portable. Essentially EVERYTHING is in a function, and all keys map to a function call. Using your statements above: function! GPG_clearsign() %!gpg --clearsign endfunction imap <silent> <c><s> <C-b>:call MyFunction()<CR> vmap <silent> <c><s> :<C-u>call MyFunction()<CR> Make sense? I would recommend not using typical characters though, by doing this Vim will hesitate &timeoutlen (Cream default is 300ms) every time a "c" is typed. Just to clarify about mappings, the idea is that for insert mode, "<C-b>:" drops to command line for one call. For visual mappings ":<C-u>" drops to the command line, with the range being removed by the <C-u>. > Maybe I could use this together with the 'set noswapfile' command > for a fairly complete solution. Would it be as simple as the code > shown below? > > 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 > augroup END I think that's about it. Cream has to manage mappings and modes with a bit of discipline since some Vim keys act differently in normal mode than insert mode (like <Esc>). But everything else is straight Vim. > I realize I'm asking a lot of newbie questions. Hope it isn't > irritating. I appreciate the help! No problem at all, I'm always happy to help anyone interested in understanding the project, getting it to work for them, and being able to implement features that others may be interested in. -- Steve Hall [ digitect dancingpaper com ] :: Cream... usability for Vim :: http://cream.sourceforge.net |