aboutsummaryrefslogtreecommitdiffstats
path: root/build/4coder_byp/4coder_byp_bindings.cpp
blob: 3ef276cab7594d9f0c1fa72d4e027f401bbd7d01 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
function void
byp_essential_mapping(Mapping *mapping, i64 global_id, i64 file_id, i64 code_id){
 MappingScope();
 SelectMapping(mapping);

 SelectMap(global_id);
 BindCore(byp_startup, CoreCode_Startup);
 BindCore(byp_try_exit, CoreCode_TryExit);
 BindCore(clipboard_record_clip, CoreCode_NewClipboardContents);
 BindMouseWheel(mouse_wheel_scroll);
 BindMouseWheel(mouse_wheel_change_face_size, KeyCode_Control);

 SelectMap(file_id);
 ParentMap(global_id);
 BindTextInput(byp_write_text_input);
 BindMouse(click_set_cursor_and_mark, MouseCode_Left);
 BindMouseRelease(click_set_cursor, MouseCode_Left);
 BindCore(click_set_cursor_and_mark, CoreCode_ClickActivateView);
 BindMouseMove(click_set_cursor_if_lbutton);

 SelectMap(code_id);
 ParentMap(file_id);
 }

 function void
 byp_vim_bindings(Application_Links *app){

 #define N bit_1
 #define I bit_2
 #define V bit_3
 #define MAP 0
 u32 Ctl = KeyMod_Ctl;
 u32 Sft = KeyMod_Sft;
 u32 Alt = KeyMod_Alt;

 VimBind(N|MAP, vim_line_start,                               (Sft|KeyCode_0));
 VimBind(N|MAP, move_line_up,                                 (Alt|KeyCode_K));
 VimBind(N|MAP, move_line_down,                               (Alt|KeyCode_J));

 VimBind(N|MAP, goto_next_jump,                               (Alt|KeyCode_N));
 VimBind(N|MAP, goto_prev_jump,                               (Alt|Sft|KeyCode_N));
 VimBind(N|MAP, goto_first_jump,                              (Alt|Sft|KeyCode_M));

 VimBind(N|MAP, vim_switch_lister,                            (Alt|Sft|KeyCode_P));
 VimBind(N|MAP, interactive_switch_buffer,                    (Alt|KeyCode_P));

 VimBind(N|MAP, format_all_buffers,                           SUB_Leader, KeyCode_K);
 VimBind(N|MAP, toggle_filebar,                               SUB_Leader, KeyCode_T);

 //- panels
 VimBind(N|MAP, open_panel_vsplit,                            (Alt|KeyCode_V));
 VimBind(N|MAP, open_panel_hsplit,                            (Alt|KeyCode_H));
 VimBind(N|MAP, close_panel,                                  (Alt|KeyCode_Q));
 VimBind(N|MAP, swap_panels,                                  (Ctl|KeyCode_P));

 //- tabs
 VimBind(N|MAP, tab_next,                                     SUB_G, KeyCode_T);
 VimBind(N|MAP, tab_prev,                                     SUB_G, (Sft|KeyCode_T));
 VimBind(N|MAP, tab_new,                                      SUB_Leader, KeyCode_N);
 VimBind(N|MAP, tab_close,                                    SUB_Leader, KeyCode_W);

 VimBind(N|V|MAP, byp_open_current_peek,                      (Alt|KeyCode_Return));

 VimBind(N|V|MAP, byp_find_divider_up,                        (Ctl|Sft|KeyCode_LeftBracket));
 VimBind(N|V|MAP, byp_find_divider_down,                      (Ctl|Sft|KeyCode_RightBracket));

 VimBind(N|V|MAP, byp_request_title,                          SUB_Leader, (Sft|KeyCode_U));

 VimBind(I|MAP, byp_auto_complete_bracket,                    KeyCode_Return);
 VimBind(I|MAP, byp_auto_complete_bracket,                    (Sft|KeyCode_Return));

 VimBind(N|MAP, vim_interactive_open_or_new,                  (Alt|Sft|KeyCode_O));
 VimBind(N|MAP, interactive_open_or_new,                      (Alt|KeyCode_O));

 VimBind(N|MAP, interactive_kill_buffer,                      SUB_Leader, KeyCode_Q);
 VimBind(N|MAP, load_project,                                 (Alt|KeyCode_A));

 VimBind(N|MAP, byp_goto,                                     (Ctl|KeyCode_W));

 VimBind(N|MAP, jump_to_last_point,                           SUB_Leader, KeyCode_B);
 VimBind(N|V|I|MAP, delete_range,                             (Alt|KeyCode_D));

 VimBind(N|MAP, list_all_functions_all_buffers_lister,        SUB_Leader, KeyCode_F);
 VimBind(N|MAP, list_all_locations,                           (Alt|KeyCode_F));

 VimBind(N|V|MAP, command_lister, (Sft|KeyCode_Semicolon));

 #undef I
 #undef N
 #undef V
 #undef MAP
 }

 function void
 byp_default_bindings(Mapping *mapping, i64 global_id, i64 file_id, i64 code_id){
 MappingScope();
 SelectMapping(mapping);

 SelectMap(global_id);

 Bind(project_go_to_root_directory,  KeyCode_H, KeyCode_Control);
 Bind(save_all_dirty_buffers,        KeyCode_S, KeyCode_Control, KeyCode_Shift);

 Bind(byp_build_project,             KeyCode_B, KeyCode_Alt);
 Bind(build_in_build_panel,          KeyCode_M, KeyCode_Alt);
 Bind(close_build_panel,             KeyCode_M, KeyCode_Control);

 Bind(execute_any_cli,               KeyCode_Z, KeyCode_Alt);
 Bind(execute_previous_cli,          KeyCode_Z, KeyCode_Alt, KeyCode_Shift);
 Bind(quick_swap_buffer,             KeyCode_Tab, KeyCode_Control);
 Bind(exit_4coder,                   KeyCode_F4, KeyCode_Alt);

 Bind(byp_project_fkey_command, KeyCode_F1);
 Bind(byp_project_fkey_command, KeyCode_F2);
 Bind(byp_project_fkey_command, KeyCode_F3);
 Bind(byp_project_fkey_command, KeyCode_F4);
 Bind(byp_project_fkey_command, KeyCode_F5);
 Bind(byp_project_fkey_command, KeyCode_F6);
 Bind(byp_project_fkey_command, KeyCode_F7);
 Bind(byp_project_fkey_command, KeyCode_F8);
 Bind(byp_project_fkey_command, KeyCode_F9);
 Bind(byp_project_fkey_command, KeyCode_F10);
 Bind(byp_project_fkey_command, KeyCode_F12);
 Bind(byp_project_fkey_command, KeyCode_F13);
 Bind(byp_project_fkey_command, KeyCode_F14);
 Bind(byp_project_fkey_command, KeyCode_F15);
 Bind(byp_project_fkey_command, KeyCode_F16);

 Bind(toggle_fullscreen, KeyCode_F11);

 Bind(increase_face_size,                            KeyCode_Equal, KeyCode_Control);
 Bind(decrease_face_size,                            KeyCode_Minus, KeyCode_Control);
 Bind(byp_reset_face_size,                           KeyCode_0, KeyCode_Control);
 Bind(vim_proj_cmd_lister,                           KeyCode_X, KeyCode_Alt, KeyCode_Shift);
 Bind(byp_toggle_set_col_ruler,                      KeyCode_BackwardSlash, KeyCode_Control, KeyCode_Shift);

 Bind(toggle_virtual_whitespace,                     KeyCode_0, KeyCode_Control, KeyCode_Shift);

 SelectMap(file_id);
 ParentMap(global_id);

 Bind(delete_char,                                   KeyCode_Delete);
 Bind(backspace_char,                                KeyCode_Backspace);

 Bind(seek_end_of_line,                              KeyCode_End);
 Bind(right_adjust_view,                             KeyCode_Home);
 Bind(move_up_to_blank_line_end,                     KeyCode_Up, KeyCode_Control);
 Bind(move_down_to_blank_line_end,                   KeyCode_Down, KeyCode_Control);
 Bind(backspace_alpha_numeric_boundary,              KeyCode_Backspace, KeyCode_Control);
 Bind(delete_alpha_numeric_boundary,                 KeyCode_Delete, KeyCode_Control);
 Bind(snipe_backward_whitespace_or_token_boundary,   KeyCode_Backspace, KeyCode_Alt);
 Bind(snipe_forward_whitespace_or_token_boundary,    KeyCode_Delete, KeyCode_Alt);

 Bind(set_mark,                                      KeyCode_Space, KeyCode_Control);

 Bind(snippet_lister,                                KeyCode_J, KeyCode_Control);

 Bind(query_replace,                                 KeyCode_Q, KeyCode_Control);
 Bind(query_replace_identifier,                      KeyCode_Q, KeyCode_Control, KeyCode_Shift);
 Bind(replace_in_range,                              KeyCode_Q, KeyCode_Alt);

 Bind(search_identifier,                             KeyCode_T, KeyCode_Control);

 Bind(paste_and_indent,                              KeyCode_V, KeyCode_Control);

 Bind(cut,                                           KeyCode_X, KeyCode_Control);
 Bind(redo,                                          KeyCode_Y, KeyCode_Control);
 Bind(undo,                                          KeyCode_Z, KeyCode_Control);
 Bind(copy,                                          KeyCode_C, KeyCode_Control);

 Bind(view_jump_list_with_lister,                    KeyCode_Period, KeyCode_Control, KeyCode_Shift);

 SelectMap(code_id);
 ParentMap(file_id);

 Bind(word_complete,                                 KeyCode_Tab);
}