File tree 3 files changed +15
-3
lines changed
3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -13,4 +13,7 @@ maildir_format = maildir
13
13
termbox_library_path = /usr/lib/libtermbox.so
14
14
15
15
# All the colors i Hatter can be customized:
16
- colors = {foreground => green, background => black}
16
+ colors = { foreground => green, background => black }
17
+
18
+ # The keybindings for Hatter can be changed here:
19
+ keys = { q => quit, r => reply, f => forward }
Original file line number Diff line number Diff line change @@ -10,8 +10,11 @@ def initialize(terminal)
10
10
# @param key [Symbol] the key the user pressed on the keyboard.
11
11
# @return [Command] the command the user wishes to execute.
12
12
def command ( key )
13
- case key
14
- when :q
13
+ keys = configuration . instance . keys
14
+ cmd = eval "#{ keys } .#{ key } "
15
+ cmd . capitalize! << "Command"
16
+ case cmd
17
+ when /QuitCommand/
15
18
QuitCommand . new ( @terminal )
16
19
else
17
20
NoOpCommand . new
Original file line number Diff line number Diff line change @@ -18,6 +18,12 @@ class Colors < ConfigToolkit::BaseConfig
18
18
add_required_param ( :background , String )
19
19
end
20
20
21
+ class Keys < ConfigToolkit ::BaseConfig
22
+ add_required_param ( :q , String )
23
+ add_required_param ( :r , String )
24
+ add_required_param ( :f , String )
25
+ end
26
+
21
27
add_required_param ( :maildir , String )
22
28
add_required_param ( :maildir_format , String )
23
29
add_required_param ( :termbox_library_path , String )
You can’t perform that action at this time.
0 commit comments