2

I want my terminal to automatically close my brackets, quotation marks, etc.

For example, I want to type ( and I want it to complete to

(|) 

where | represents the mouse cursor.

Is there a way to do this? If so, how?

1
  • Reimplement GNU Readline, that's the thing that gives you history and the ability to move your cursor.
    – cat
    Mar 12, 2016 at 15:42

1 Answer 1

2

bash reads ~/.inputrc file, which allows binding certain keys to macros. In our case, we need macro that automatically types in "()" and Ctrl+b (which is move back one word ) shortcut.

Open the file with gedit or any other text editor and type in the following

 "\C-]":"()\C-b"

That will bind Ctrl + ] to do what you want. Now open terminal or call a new instance of the shell and test it out.

You can try binding it to any other keyboard short-cut, but there is only so much you can do.

You must log in to answer this question.

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