# How to define a hotkey in LyX to insert an inline listings?

In LyX, I can define a hot-key for listing-insert. But in this case, what appears is the \begin{lstlisting}...\end{lstlisting} environment. In fact I want to insert a inline listings command \lstinline{...}. There is no predefined lyx command for insert an inline listings. How can I do this?

-

## 1 Answer

Does the following do what you want?

command-sequence ert-insert; self-insert \lstinline{; char-forward; ert-insert; self-insert }; char-forward; word-backward


Press "alt-x" and insert that in the mini-buffer to test it. If it does what you want, make a shortcut for it.

-
This can insert ERT for inline listing. However it's not what I really want. I want the xxxx command in command-sequence listing-insert; inset-settings; xxxx; which can set "inline true" for the inset. –  goodluck Aug 30 '12 at 5:05
@goodluck, ah I see what you mean. I don't know how to automate that. –  scottkosty Aug 30 '12 at 6:19