<< | Page list | >>
Modifying LyX keyboard shortcuts
This page contains some tips for modifying your keyboard bindings in LyX.
Before modifying, have a look at the KeyboardShortcuts#StandardKeybindings in LyX.KeyboardShortcuts. Maybe one of the standard files is already (close to) what you want. (See also frequently used shortcuts)
There are some blocked keyboard shortcuts that require special attention.
Remember to read the section in Customization.lyx and Appendix A -- Bindings in the Customization.lyx document (Help>Customization or excerpt below).
A practical tip
Instead of modifying any of the standard bind-files, create a new bind-file, say
# include one of the basic flavours (cua or emacs) \bind_file "cua" # add your own bindings (overwriting the included ones) \bind "C-b" "font-bold"
Then go to the preferences dialog and choose this file to be your bind-file.
Syntax of the .bind-files
The syntax of the .bind files is straightforward:
\bind <key combination> <lyx-function> # bind a key to a function \bind_file "bindfile-name" # include another bind file
This is a (possibly incomplete) list of table modifiers:
Testing revealed that the keys <a> and <A> are equivalent in some combinations, i.e.:
Precedence of keyboard bindings
Note that the latest key binding takes precedence, e.g.
\bind "C-b" "font-emph" \bind "C-b" "font-bold"
will bind "C-b" to "font-bold", since that is the last key binding command. An exception are bindings using the modifier "~S", which doesnot overide other bindings. E.g.
\bind "C-~S-a" "self-insert a"
means that both "C-a" and "C-S-a" will insert a 'a'. However, with these bind commands:
\bind "C-a" "self-insert a" \bind "C-S-A" "self-insert A" \bind "C-~S-a" "self-insert b"
You end up with these key mappings:
but you will never get 'b', i.e. the binding "C-~S-a" is never activated.
\bind "C-S-A" "self-insert A" \bind "C-~S-a" "self-insert b"
then you get these key mappings:
Below is a simple copy of section 3.3. in Customization.lyx, i.e. the section about bindings.
Bindings are used to, well, bind a function to a key. Several prepackaged binding files are available: a CUA set of bindings (familiar as the typical set of PC and CDE set of keyboard shortcuts), an Emacs set of bindings, for those of us who follow the One True Way and refuse to lower our standards,I'm kidding here, of course! as well as specialty bindings (broadway and hollywood) and other languages (French, German, etc.).
If, however, you'd like to customise the keybindings to your own exacting tastes, then copy the best-fit file in LyXDir/bind/ to your own UserDir/bind/ and modify that. Don't forget to load this new file into LyX using the Preferences dialog. (For the moment you'll have to restart LyX for these changes to take effect.)
LyX supports internationalization of the user interface (see Chapter [chap:i18n]). If your locale is set, with the environment variable $LANG, LyX will try to use bindfiles by prepending $LANG_ to their name. For example, you can put a translated copy of some standard bind file in your personal bind/ directory, and LyX will use it automatically. [Author's Note: Not sure if this is true anymore. Perhaps someone who uses such a thing could test. --- AL]
Both key combination and lyx-function (including any arguments) must be enclosed in "double quotes". All the LyX functions are listed in the Reference Guide.
List of key names
This table lists some of key names that you can use in .bind-files. (See latinkeys-bind for some more odd keys)