tags:

views:

333

answers:

3

I'm trying to configure my Terminal and I would like to insert @{} at one key-stroke. This works with the following code

# .inputrc
"\e\"": "@{}"

But I also want the cursor to end up inside the braces. How can I do this? The following doesn't work.

# .inputrc
"\e\"": "@{}": backward-char
A: 

I can't say I have an answer, but I am curious why you're trying to do this.

elliottcable
One thing I could think of are Git revisions from the reflog: They are referenced with “HEAD@{1}” and such.
Bombe
This is exactly why I wanted it. On a Swedish keyboard the character @ and {} are on the alt key making them a bit painful to type. I can think of others to as soon as I get it working the way I want, such as $().
andersjanmyr
A: 

My immediate way to fix your overall goal (not really answering your question, but hopefully helping you anyway): write a bash alias or function for it. grev() perhaps, or something similar - at least, this is what I would do were I in your situation.

I am interested to see if what you originally asked is possible, however, so voting up your question in hopes that you can get a 'real answer'!

elliottcable
+4  A: 

Try:

"\e\"": "@{}\e[D"
Antibaddy
Beautiful, thank you. Where did you find the char code for the left arrow?
andersjanmyr
If you type CTRl-V in the terminal it will display the escape code for the next key you type.
Antibaddy