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
  • 1
    So, just to be clear, this is a question about why your approach does not work, not how to customize shortcuts in general, right? Because for that you could also use the GUI interface available under Tools > Preferences > Editing > Shortcuts
    – Rasmus
    Aug 13 '14 at 6:25
  • @inspectorG4dget did you try what Rasmus suggested? Also, consider updating your LyX installation (although make sure everything is backed up). 2.0.6 is now considered old.
    – scottkosty
    Aug 21 '14 at 12:48
  • @Rasmus: I have had trouble finding the right shortcut itself, in the GUI (Some are menu shortcuts that don't appear in Tools > Preferences > ... . Further, every time I update my installation, I would lose my custom shortcuts. Aug 21 '14 at 21:00
  • 1
    @inspectorG4dget: When a function does not appear in the list, you can click New to add it if you know the function to call -- I just tried adding a shortcut with function float-insert algorithm from your Q, and that worked on LyX 2.1 (under Ubuntu). That your custom settings are overridden on update sounds like a bug -- at least that does not happen under Ubuntu.
    – Rasmus
    Aug 25 '14 at 16:48
  • 1
    @Rasmus: ctrl+f is mapped to char-forward, which I never use. Deleting it and remapping float-insert algorithm to ctrl+f a got me exactly what I needed. If you consolidate the comments into an answer, I would gladly accept and give you the rep Aug 28 '14 at 21:26

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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.