3

To use the Emacs transpose-words function in vi mode I have the following .inputrc:

$if mode=vi
  bind Control-b: transpose-words
$endif

Unfortunately it only works in "insert" mode. What is the trick to make it work in both "insert" and "command" modes?

I tried to use set keymap vi-command in the file, but it has no effect.

$if mode=vi
  set keymap vi-command
  bind Control-b: transpose-words
$endif

1 Answer 1

0

The "bind" keyword should not be in inputrc. The following inputrc works as intended. Ctrl-B transpose words in both insert and command mode:

set editing-mode vi
$if mode=vi
  set keymap vi-command
  Control-b: transpose-words
  set keymap vi-insert
  Control-b: transpose-words
$endif

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .