In vim there is an option called showmatch. When you type a closing parenthesis in insert mode, this jumps the cursor to the matching opening parenthesis (at the same nesting level), then back again. This is very useful with languages like prolog and lisp, and is often present in their REPLs. Does Bash have a similar feature? I wonder if this might be part of readline, because the SWI-prolog interpreter does it, and as far as I know, also uses readline. If it is part on readline, which options do I need to set in my .inputrc?


The question https://stackoverflow.com/questions/47358440/blink-matching-paren-not-working-in-readline-prompt lists as part of the question the readline setting

set blink-matching-paren on

which I have tried, and produces the result I was expecting.

  • Very good find! Also useful, if bash is set to use vi keys, pressing Esc (to enter normal mode) and then % moves the cursor to the matching parens. Pressing again returns to the original position, just like in vi or vim. – John1024 Sep 27 '19 at 5:38

Does this help? In your ~/.inputrc

set editing-mode vi

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.