4

I need to add some things to my inputrc. I'm using bash 4, as OS I'm using debian and OSX. My terminal emulators are rxvt-unicode-256 on debian and Terminal.app on OSX. My new macbook has no Insert/Delete, Home/End, PgUp/PgDown keys...

Could you please tell me the keystroke for "Shift-Space"? I'm trying to bind this to menu-complete-backward. Shift-Tab does menu-complete, the keystroke for this is "\e[Z".

"\e[Z": menu-complete
"(Shift-Space)": "\e-1\C-i"

Then I'd like to be able to go page up/down in my terminal. I'm not sure, how to say that. E.g. in irssi I'd like to scroll up/down in my channel log. The keys "PgUp"/"PgDn" do these, but I don't have those keys on my macbook. So I'd like an alternative, like maybe "Shift-ArrowKeyUp" and "Shift-ArrowKeyDown". Also I don't know the commands for inputrc, which I have to bind to this keystroke.

Same for "Home"/"End" keys which should go to beginning-/end-of-line. I'd like to bind that to maybe "Shift-ArrowKeyLeft"/"Shift-ArrowKeyRight".

Thanks very much for your help!

EDIT: Here's my .inputrc ... http://paste.debian.net/69454/

2
  • I am wondering the same thing. Did you ever find the solution? Commented Nov 15, 2017 at 8:29
  • i am also wondering the same thing, and the answer is incorrect
    – xdavidliu
    Commented Oct 12, 2019 at 21:32

1 Answer 1

-1

Solution

Before I start with my solution, just a quick note here. Many of the commands you listed above (such as the Page Up/Down) don't have a .inputrc variable. They also already have corresponding shortcuts (see below). Therefore, if you want to use a different shortcut, you will have to remap the menu item to a new one.

For Mac OS

Shortcuts

First of all, the Mac OS terminal has a built in keyboard shortcut for scrolling up and down the page: Command + ArrowKeyUp or Command + ArrowKeyDown. Below is a quick table highlighting some of the menu commands and their corresponding shortcuts in the Mac Terminal:

|        Function         |        Shortcut        |
+-------------------------+------------------------+
|         Page Up         |      Command + Up      |
+-------------------------+------------------------+
|        Page Down        |     Command + Down     |
+-------------------------+------------------------+
|         Line Up         |  Shift + Command + Up  |
+-------------------------+------------------------+
|        Line Down        | Shift + Command + Down |
+-------------------------+------------------------+
| Go to beginning of line |      Control + A       |
+-------------------------+------------------------+
|    Go to end of line    |      Control + B       |
+-------------------------+------------------------+

New Shortcuts

If you don't want to use the built-in shortcuts, you will have to create new ones. There are several ways to do this, but I think using the GUI (versus the CLI) is easier in this situation. On Mac OS, open System Preferences, head to the Keyboard section, and finally click open the Shortcuts tab:

Keyboard Shortcuts

On the sidebar, click the App Shortcuts tab. Below, you will find a + button. Click that, and the following will pop up:

Add Shortcut

Choose Terminal from the dropdown menu, and type in the menu item and keyboard shortcut you want to map to it. Below is an example of mapping Page Up to Shift + ArrowKeyUp:

New Shortcut

For Debian

Shortcuts

Like Mac OS, Debian already has all of the shortcuts you want built-in. Below is another table highlighting these shortcuts:

|        Function         |        Shortcut        |
+-------------------------+------------------------+
|         Page Up         |       Shift + Up       |
+-------------------------+------------------------+
|        Page Down        |      Shift + Down      |
+-------------------------+------------------------+
|         Line Up         |  Shift + Control + Up  |
+-------------------------+------------------------+
|        Line Down        | Shift + Control + Down |
+-------------------------+------------------------+
| Go to beginning of line |      Control + A       |
+-------------------------+------------------------+
|    Go to end of line    |      Control + B       |
+-------------------------+------------------------+

New Shortcuts

To create a new shortcut in Debian, use the GUI. Open up Settings, head to Devices, and then Keyboard. The following will show up:

New shortcut in Debian

Scroll down to the bottom, and click the + button. A dialog box will show up with the entry fields:

  • Name
  • Command
  • Shortcut

Fill these out, click the blue Add button, and you're done.

1
  • They're looking for "shift + space". Not "shift + up arrow".
    – Riveascore
    Commented Dec 3, 2020 at 0:55

You must log in to answer this question.

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