map jj to Esc in inputrc (readline)

前端 未结 1 770
不思量自难忘°
不思量自难忘° 2021-02-01 03:18

How can I map jj to Esc in inputrc so it gets picked up by apps using GNU Readline (python, mongoshell, ...)

all works fine on zsh using:



        
相关标签:
1条回答
  • 2021-02-01 03:54

    You should rearrange the inputrc so the commented line comes after set keymap vi-insert.

    Like this:

    set bell-style none
    $if mode=vi
        set keymap vi-command
        "gg": beginning-of-history
        "G": end-of-history
        set keymap vi-insert       #notice how the "jj" movement is
        "jj": vi-movement-mode     #after 'set keymap vi-insert'?
        "\C-w": backward-kill-word
        "\C-p": history-search-backward
    $endif
    
    0 讨论(0)
提交回复
热议问题