Debian Codegraph @

geanylua/docs/geanylua-keys.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
2 <html>
3 <head>
4 <title>Lua plugin for Geany - Keybindings</title>
5 </head>
6 <body style="margin: 32px 25% 24px 5%">
7 <hr><h2>How to assign custom key bindings to scripts</h2><hr>
8 Beginning with Geany version 0.14, it is now possible to integrate plugin
9 key bindings with Geany's built-in preferences system. &nbsp; This allows for
10 much easier configuration, and also helps to resolve conflicts between
11 the editor's bindings and the bindings associated with plugins.</p>
12 <p>
13 To use the new method, you simply create a plain text file named
14 "<tt><b>hotkeys.cfg</b></tt>" and place it your <b>/plugins/geanylua/</b>
15 folder. &nbsp; In this file you will list any scripts that you want to configure
16 keybindings for. &nbsp; The scripts should be listed one per line and may be
17 specified either by using an absolute path, or with a path relative
18 to your <b>/plugins/geanylua/</b> folder.</p><p>
19 After reloading the plugin (or restarting Geany) the scripts will
20 appear in Geany's &nbsp; <b>Edit->Preferences->Keybindings</b> &nbsp; dialog.
21 &nbsp; The names appearing in the dialog are derived from the filenames in a
22 manner similar to the way menu items are created from filenames.
23 <br><br>
24 </p>
25 <hr>
26 <h3>(The old way)</h3>
27 <p>
28 <b>Important:</b> The technique described below has been deprecated in favor
29 of Geany's built-in keybinding API. It is still working for now, however
30 you are strongly urged to convert your scripts over to the new method. &nbsp;
31 The reference below is provided mainly for historical reasons...
32
33 </p>
34 <p>
35 Before we begin, it is assumed that you are comfortable with your current
36 keybindings in the editor itself. If you are the sort who
37 likes to tweak your editor keybindings on a daily basis, adding script keybindings
38 into the mix will likely be an exercise in frustration!&nbsp; This is because there is
39 absolutely no coordinated way to detect conflicts between the Geany keybindings
40 and script keybindings, or even between the individual scripts.&nbsp; So you
41 are the only one responsible to insure that such conflicts don't occur, or at
42 least that they don't cause you any major problems.
43 </p><p>
44 The syntax for enabling a keybinding is quite simple, but it <i>must</i> be the very first line in the script file.
45 The line should begin with a double dash (the standard single-line Lua comment marker) followed by a space and the string &nbsp;<tt><b>@ACCEL@</b></tt>&nbsp; followed by another space and then the accelerator specification in standard
46 <a href="http://www.gtk.org/api/2.6/gtk/gtk-Keyboard-Accelerators.html#gtk-accelerator-parse">GTK syntax</a>.
47 </p><p>
48 For example, to launch a script by pressing the keys <b>&nbsp;<u>[Ctrl]</u>&nbsp; <u>[Shift]</u>&nbsp; <u>[J]</u>&nbsp;</b> you could write this as the first line of your script:<br>
49 <h3><tt>-- @ACCEL@ &lt;Control&gt;&lt;Shift&gt;j</tt></h3>
50 <p>Note that such tags are scanned once only when the plugin is loaded, so any changes require reloading the plugin before the change will take effect.
51 &nbsp; The plugin can be reloaded either by restarting Geany, or
52 by toggling it OFF/ON via Geany's Plugin Manager,
53 or by calling the <tt>rescan()</tt> function from inside a script.
54 </p>
55 <br><hr>
56 </body>
57 </html>