You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 12, 2023. It is now read-only.
| F8 | Move to the next line |[next](/docs/commands/next)|
15
17
| F9, Ctrl+D | Continue the execution of your program until exit, or stop at the next break point |[continue](/docs/commands/continue)|
16
18
17
-
**Note**: Key binding customization is coming in a future version.
19
+
You can always customize the key bindings set by putting a simple setting in the [configuration file](/docs/guides/configurations). The list of natively supported key binding is defined in [this file](https://github.com/nguyenquangminh0711/ruby_jard/blob/master/lib/ruby_jard/keys.rb).
20
+
21
+
```ruby
22
+
config.key_bindings = {
23
+
RubyJard::Keys::CTRL_N => 'jard filter switch',
24
+
RubyJard::Keys::META_L => 'list',
25
+
RubyJard::Keys::CTRL_F1 => 'up',
26
+
RubyJard::Keys::CTRL_SHIFT_F1 => 'down',
27
+
RubyJard::Keys::META_D => 'step',
28
+
RubyJard::Keys::META_O => 'step-out',
29
+
RubyJard::Keys::CTRL_META_N => 'next',
30
+
RubyJard::Keys::META_F1 => 'continue',
31
+
RubyJard::Keys::META_SHIFT_F1 => 'continue',
32
+
RubyJard::Keys::CTRL_C => 'interrupt'
33
+
}
34
+
```
35
+
36
+
Jard also supports non-traditional and machine-dependent key bindings. For example, to map the `Ctrl+Home` key combination to the `next` command, you first need to get the code sequences of this combination. Let's run the following ruby program inside your terminal, press `Ctrl+Home`, copy the output, then put it into the configuration file.
37
+
38
+
```ruby
39
+
require'io/console'
40
+
41
+
STDOUT.raw!
42
+
begin
43
+
loopdo
44
+
begin
45
+
data =STDIN.read_nonblock(255)
46
+
exitif data =="\u0003"
47
+
print data.inspect
48
+
rescueIO::WaitReadable; sleep0.1; end
49
+
end
50
+
ensure
51
+
STDOUT.cooked!
52
+
end
53
+
```
54
+
55
+
<LinkedImagelink="/img/guides/key-bindings.png"alt="Capture raw key sequences"/>
56
+
57
+
In my machine, the above program prints `"\e[1;5H"`. My configuration to map `Ctrl+Home` to `next` command looks like this:
58
+
59
+
```ruby
60
+
config.key_bindings = {
61
+
"\e[1;5H" => 'next'
62
+
}
63
+
```
64
+
65
+
If the above program doesn't print any output, it means the key combination is conflicted or already handled by some programs in your environment. Please pick another one.
0 commit comments