On Feb 6, 2008 1:53 PM, Steve Hall <digitect@dancingpaper.com> wrote:
From: "Dave (My-IOP)", Tue, February 05, 2008 11:41 pm

> 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
 imap <silent> <c><s> <C-b>:call MyFunction()<CR>
 vmap <silent> <c><s> :<C-u>call MyFunction()<CR>

Make sense?
The use of a function call makes perfect sense. (The details of the mappings don't.) Here's what I get out of the above:
some_stuff_I_dont_understand:call GPG_clearsign()<CR>

I looked up imap and vmap. I think imap maps a key combination in insert mode, and vmap does the same in visual mode, right?

For <silent> I see that it does execute {command} silently - makes sense.

For <c><s> This is confusing even after reading what you wrote below and searching on Google.

<C-b> -- I see you said, For insert mode, "<C-b>:" drops to command line for one call. That leaves me wondering how the selected text is passed to gpg and back...

I'm lost on most of this.

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>.

Hmmm, I can't say I understand that.

At this early stage of learning Vim/Cream I think I'm getting in too deep. I'm trying to learn Linux, Vim, gpg and a bunch of other productivity apps all at the same time so I can switch from Windows immediately. I'm trying to do it now so I can switch from QuickBooks before getting too far into a new year. (And now I'm realizing that I should have used Ubuntu x86 rather than x64 because I don't see an x64 version of TrueCrypt... so probably need to reinstall the OS now.)

It would help a lot if I could just start using Cream and learn more about the underlying power of Vim over time. To get started, I just need two customizations:
1. decrypt/encrypt selected text via mapped shortcut keys using gpg and my default gpg key (or a gpg key specified in the script).
2. open URLs in default browser (which was working until I started messing with the encryption)

The encryption stuff is important because I'm maintaining financial info for relatives. I couldn't find Linux apps to replace several of my Windows apps, but then it occurred to me that the above two customizations I can do it all in Cream and I'll be set to ditch Windows.

As far as the key bindings, are Ctrl-E (encrypt selected text) and Ctrl-D (decrypt selected text) good choices?
How would the code look if I were using those key bindings? I would be very appreciative if someone could offer a complete script to implement these two customizations! I realize that's asking a lot. What can I do in return? Thanks.