5

As we know, after changed the Readline mode to vi by command set -o vi and set editing-mod vi, press the key v can into an temp file to edit command (here more details). I want to disable that function.

I tried to re-map v in ~/.inputrc likes:

"v": 

but the character v cannot be inputed, even if at the insert mode (vim cannot be inputed also. =.=!).

How should I do? And how to re-map the shortcut-keys and do NOT effect the input-mode against VI Editing Mode?

3

You need to change the binding only for the correct mode (vi-command, not vi-insert), and you need to provide a right-hand-side to the rule:

set keymap vi-command                                                                            
v: ""
  • Nop.. if input v: "", char v cannot be input in insert mode, and command v still can open the vim to edit the command. – Marslo May 2 '13 at 12:15
  • Did you add both lines, in that order? If yes, is there anything else in your .inputrc, and if there is, can you add the whole thing to your question? – Gabe May 2 '13 at 15:34
  • yes!! it works!! I added the both line in .inputrc, and delete set keymap vi-insert, then, it works!! Thanks!! – Marslo May 16 '13 at 11:59
  • I think I got it. I will set the 'v' to idle in command mode. So I should use vi-command as keymap mode. Am I right? – Marslo May 16 '13 at 12:03
  • You can have custom mappings for all modes in the same file. The important thing to know is that lines are processed strictly in order: after a set keymap line, all mappings apply to that mode, until the next set keymap line, and any mappings after that will apply to the new mode. – Gabe May 16 '13 at 16:08

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.