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
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
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.