tags:

views:

54

answers:

1

Hi,

I just discover the magic of using vi style in bash. Immediately, I'm trying to use C-c to escape from insert mode (into what's called movement mode) as I'm used to C-c to escape to command mode in vim.

I searched around and found the command to rebind key in bash:

"bind -m vi-insert C-c:vi-movement-mode"

Then, I used "bind -P" to check the binding status and it showed:

"..."
"vi-movement-mode can be found on "\C-c", "\e"."

However, when I tried to escape from insert mode, it cleared the entire line instead (the default behavior), instead of escape to movement mode... Any thought how can I use C-c to escape from insert mode?

Thanks in advance.

+2  A: 

You can rebind the interrupt key:

stty intr ^X

Now to interrupt something that's executing you'll have to press Ctrl-x. I don't know if changing this might have other side effects.

The reason that vim can do that is that it traps the Ctrl-c interrupt.

Dennis Williamson