If you look at the status bar (bottom of the LyX window) when you click the appropriate menu item, you'll see the function appear there for a second or two. The two functions you're after are
script-insert superscript
script-insert subscript
Go to View > Messages Pane:
![enter image description here](https://i.stack.imgur.com/kbULH.png)
Then click on the "Settings" tab in the bottom right corner:
![enter image description here](https://i.stack.imgur.com/5c89Y.png)
Then click on the "Selected" radio button:
![enter image description here](https://i.stack.imgur.com/yuY1o.png)
Then double click on "User commands" so that "no" turns to "yes":
![enter image description here](https://i.stack.imgur.com/MfxeQ.png)
Then click on the "Output" tab:
![enter image description here](https://i.stack.imgur.com/4oPfV.png)
Then do the action that you want to copy the shortcut of. In this case, insert your horizontal line. In the output tab at the bottom, you will see:
![enter image description here](https://i.stack.imgur.com/Mj291.png)
This tell us that the correct command is:
inset-insert line CommandInset line LatexCommand rule offset "0.5ex" width "100col%" height "1pt" \end_inset
Verify that the command is correct by inserting it directly into the mini buffer (Alt + X or View > Toolbars > Command Buffer) at the bottom of the screen:
![enter image description here](https://i.stack.imgur.com/LrDZQ.png)
Run the command by pressing return. If it has the desired effect, then you know you have the right command and can create the shortcut in the usual way.
Note that you can have one shortcut do multiple commands by using command-sequence
.
Best Answer
Short answer:
The following command sequence inserts a
\medskip
in your document, you just have to bind it to the shortcut you prefer:inset-insert vspace medskip
.General answer:
At times it is a bit tricky to figure out what LyX commands one actually has to bind to a shortcut to achieve the desired behavior. While for most commands LyX shows the last executed command in the status bar, this does not help for commands that open a dialog for further settings. In the following, I describe the approach I used to figure this one out, so you could apply it for other questions in this respect:
(1) Start Lyx with the
-dbg action
option (that is, run/path/to/lyx-binary/lyx -dbg action
from a console window).(2) Execute the command for which you want to figure out the command sequence. LyX lists the actions in the debug output in the console. The following shows the relevant output for Insert->Formatting->Vertical Space... with selecting MedSkip:
(3) Usually the last command executed by some dialog-based action is the one you are looking for. In this case it is the line with
[inset-insert]
and the argumentsvspace medskip
.(4) Use the LyX Mini-Command Buffer (View -> Toolbars -> Command Buffer) to manually test the command:
inset-insert vspace medskip
If the result is what you want to achieve, you are done and have found the command sequence to bind to the shortcut. Otherwise you have to experiment more :-)
Update: General answer using the GUI only
For those who do not feel comfortable with starting LyX from a console window, there is also a GUI-only way to figure out the commands (thanks to Dominik for the hint!):
(1a) In LyX, open the debug Console by selecting View –> Message Pane
(1b) Configure the settings on the Settings page, so that User commands and External control interface are set to Yes:
(2) Switch on the Output pane and execute the command for which you want to figure out the command sequence. The following shows the relevant output for Insert->Formatting->Vertical Space... with selecting DefSkip:
(3) Proceed as above.