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:57:06 02 November 2010, Tuesday
by aleCodd:

> just for curiosity, why do you have in the last 5 or so commands the <c-/>,
> why is not the <c-o> enough to enter a normal mode command before returning
> to insert mode..
Because it moves one character left at the end of line and does not move
anything in the middle.

> and just to make sure, bindkey is a zsh command, and if so how do you rate
> zsh vs. bash when it comes to command line editing, which is more vi-like
> configurable?
While you are using zsh, you can configure almost anything. I do not know how to
bind a key to a custom function that does something with the command line, but I
do not say that this is impossible: I switched to zsh when I had three aliases,
two binds and no functions in my bashrc, so I do not have enough experience in
configuring bash. In zsh I do not use normal/insert modes, but have some vim-
like keybindings: <C-o> that can execute some commands in «normal» mode, <C-r>*,
a bunch of «,*» mappings. If you want to compare, try asking on stackoverflow
how to imitate vim's <C-o> in bash while having a emacs keys, based on those
answers I could yield more useful comparison.

I also know, that in zsh you may setup as many modes as you want: that indicator
was based onto the fact that zsh was changing its keymap when moving between
vicmd/viins, so it is not something hard-coded like in bash.

In some recent topics discussed on zsh mailing list there was an experimental
implementation of dynamic higlighting (though it was capable almost only for
higlighting command as alias/command/builtin/function). Can you imagine
something like that implemented without patching in bash?

No comments: