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:
![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
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.