On my system a .bind
file was created in the user folder of LyX. You can find out where this folder is located by choosing Help --> About LyX, where the path to the User directory is given.
Here (in Kubuntu) the folder is located in ~/.lyx
, and there is a file called user.bind
in ~/.lyx/bind/
.
Go to View > Messages Pane:

Then click on the "Settings" tab in the bottom right corner:

Then click on the "Selected" radio button:

Then double click on "User commands" so that "no" turns to "yes":

Then click on the "Output" tab:

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:

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:

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
By default Ctrl+I may be set to "inset-toggle" which in regular use doesn't apply, while Ctrl+U should be set to "font-underline" (as is Alt+C U).
You are able to change the key binding sequences to suit your needs. Under Tools > Preferences > Editing > Shortcuts, activate the keys that you're interested in using as shortcut combinations. Specifically, find "font-ital" and "font-underline" under Font, Layouts and Textclasses:
If a bind is already used elsewhere, you can overwrite this to suit your personal needs.