Tuesday, November 2, 2010

Re: Using Bash in Vi mode. How to map keys?

Reply to message «Re: Using Bash in Vi mode. How to map keys?»,
sent 19:15:44 02 November 2010, Tuesday
by aleCodd:

> hmm...what do you mean by 's>>' ?
Do not use google groups, it fucks up unicode symbols. It is was a ``,s''
enclosed in "\u00ab" and "\u00bb" (left and right double angle quotation marks),
googlegroups turn them into << and >>. In zshrc I have the following code:

bindkey -M evi ",h" "ins-brackets"
<...>
bindkey -M evi ",S" "ins-parentheses-escaped"

where all ins-* are custom zle widgets. It is not the right place to discuss
their implementation, but here is similar code from my vimrc:
inoremap ,ef <C-o>I{<C-m><C-o>o}<C-o>O
inoremap ,eF <C-m>{<C-m><C-o>o}<C-o>O
inoremap ,F {<C-o>o}<C-o>O
inoremap ,f {}<C-\><C-o>h
inoremap ,h []<C-\><C-o>h
inoremap ,s ()<C-\><C-o>h
inoremap ,u <LT>><C-\><C-o>h
inoremap ,es (<C-\><C-o>E<C-o>a)<C-\><C-o>h
inoremap ,H [[::]]<C-o>F:
inoremap ,eh [::]<C-o>F:
inoremap ,q «»<C-\><C-o>h
inoremap ,Q „"<C-\><C-o>h
inoremap ,eq ""<C-\><C-o>h
inoremap ,eQ ''<C-\><C-o>h
inoremap ," ""<C-\><C-o>h
inoremap ,' ''<C-\><C-o>h

Note that `,q', `,Q', `,eq' and `,eQ' lines will probably be also fucked up by
googlegroups, so it is better to view this message somewhere else, perhaps in a
mail client.

Here is from ipythonrc. Ipython uses readline, so it should be easy to port it
to .inputrc:
readline_parse_and_bind ",s": "()\C-b"
other lines are similar.

> can you please explain 1)what key do you bind 2)and how is it done in
> .inputrc
I am using zsh, so nothing is done in inputrc.

No comments:

Post a Comment