Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone know if there is a way reproducing the same behaviour many text editors provide for colour-highlighting the syntax operators such as brackets or curly brackets. It would be very useful for complex one-liners in the terminal.

Example of the functionality I am talking about (from VIM).


share|improve this question
Sorry I don't understand what do you mean... – pedrosaurio Nov 28 '12 at 11:36
I mean if it's complicated, it should be in a script editor, i.e VIM – warl0ck Nov 28 '12 at 11:38
Thanks, I see what you mean now and you are right. Nevertheless it is still very useful. Sometimes I am debugging some R code interactively, I need to paste some of the complex lines in the R-console and change some parameters. As R uses .inputrc I thought that I could make bash do these high-lightning and R could inherit. – pedrosaurio Nov 28 '12 at 12:19
You can run a terminal in Emacs. Its functions to find matching parentheses are available there. I do not know whether the same is possible in VIM. – choroba Nov 28 '12 at 12:37
I believe the term is parenthesis (or bracket) matching. For bash, you could look at blink-matching-paren: Bash readline blinking matching parentheses – Zorawar Nov 28 '12 at 14:35
up vote 4 down vote accepted

When writing complex one liners in bash, it is handy to use readline's edit-and-execute-command (bound to C-xC-e by default in emacs mode). Hitting C-xC-e opens current commandline in the editor of your choice with all its fancy features. After saving it, bash will execute the contents as shell commands.

Alternatively, issue bash's builtin fc to open last command in the editor.

share|improve this answer
Perfect. Do you have an idea if I could get the same behaviour within the R-console? I know that R uses readline. EDIT: @Zorawar 's link in the comment above solves this issue by adding set blink-matching-paren on in my .inputrc file – pedrosaurio Nov 28 '12 at 15:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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