[Tex/LaTex] Customizing LyX Shortcuts

keyboardlyx

I am using LyX 2.0.6 on my macbook and would like to define a few custom shortcuts to make my life easier. In particular, I'd like to add the following command:

controlfa should insert an algorithm float.

LyX is installed in /Applications and uses /Applications/LyX/Contents/Resources/bin/mac.bind as it's keyboard shortcuts config file
So I looked at the syntax in in there and came up with the following custom.bind:

# Command - C 
# Option  - A 
# Control - M 
# Shift   - S 

Format 1

\bind "C-S-r"                       "dialog-show-new-inset ref"
\bind "C-A-c"                       "citation insert"
\bind "C-A-t"                       "citation insert"
\bind "M-f ~S-a"                    "float-insert algorithm"
\bind "M-f ~S-f"                    "float-insert figure"
\bind "M-f ~S-t"                    "float-insert table"

Now, this custom.bind lives at ~/.config/LyX/custom.bind, so I added the following line to my mac.bind:

\bind_file ~/.config/LyX/custom.bind

But I am unable to use the float command that I have defined in custom.bind. Thinking that this was an error in my syntax, I copied that line into menus.bind (and changed the bind file in LyX) and it did indeed work.

So why don't the commands in my custom.bind work?

Technical Specs:

  • mac OSX 10.9.4 (Mavericks)
  • LyX 2.0.6

Best Answer

I do not know how the custom .bind files work on Mac, so I can offer no insights about that.

However, seeing that the shortcut you want to define begins with Ctrl + f, your problem might have arisen due to a binding conflict. On Ubuntu, for example, Ctrl + f is by default bound to dialog-show findreplace. I've heard rumors that on Mac it is bound char-forward ;)

You can check whether the initial segment of your shortcut is already used by going to Tools > Preferences > Editing > Shortcuts and there search for ctrl+f (or whatever other shortcut you have problems getting to work).

If the initial segment is bound to something, then either choose a different shortcut, or remove the default binding.

Best of luck!