2017-01-29 00:03:23 +00:00
|
|
|
/*
|
|
|
|
4coder_default_bidings.cpp - Supplies the default bindings used for default 4coder behavior.
|
|
|
|
|
|
|
|
TYPE: 'build-target'
|
|
|
|
*/
|
2016-03-15 14:12:06 +00:00
|
|
|
|
2016-03-21 22:27:27 +00:00
|
|
|
// TOP
|
|
|
|
|
2017-01-29 00:03:23 +00:00
|
|
|
#if !defined(FCODER_DEFAULT_BINDINGS)
|
2016-06-28 22:58:50 +00:00
|
|
|
#define FCODER_DEFAULT_BINDINGS
|
|
|
|
|
2016-05-06 16:45:50 +00:00
|
|
|
#include "4coder_default_include.cpp"
|
2016-03-15 14:12:06 +00:00
|
|
|
|
2016-05-12 02:15:54 +00:00
|
|
|
void
|
2016-05-19 16:23:12 +00:00
|
|
|
default_keys(Bind_Helper *context){
|
2016-03-15 14:12:06 +00:00
|
|
|
begin_map(context, mapid_global);
|
2016-06-03 16:20:45 +00:00
|
|
|
|
2017-02-03 00:52:39 +00:00
|
|
|
bind(context, 'p', MDFR_CTRL, open_panel_vsplit);
|
|
|
|
bind(context, '_', MDFR_CTRL, open_panel_hsplit);
|
|
|
|
bind(context, 'P', MDFR_CTRL, close_panel);
|
2016-07-12 19:16:48 +00:00
|
|
|
bind(context, ',', MDFR_CTRL, change_active_panel);
|
2017-02-12 23:04:50 +00:00
|
|
|
bind(context, '<', MDFR_CTRL, change_active_panel_backwards);
|
2016-07-12 19:16:48 +00:00
|
|
|
|
2017-01-23 06:19:43 +00:00
|
|
|
bind(context, 'n', MDFR_CTRL, interactive_new);
|
2017-03-27 22:36:42 +00:00
|
|
|
bind(context, 'o', MDFR_CTRL, interactive_open_or_new);
|
2016-07-12 19:16:48 +00:00
|
|
|
bind(context, 'o', MDFR_ALT, open_in_other);
|
2017-01-23 06:19:43 +00:00
|
|
|
bind(context, 'k', MDFR_CTRL, interactive_kill_buffer);
|
|
|
|
bind(context, 'i', MDFR_CTRL, interactive_switch_buffer);
|
2016-07-12 19:16:48 +00:00
|
|
|
bind(context, 'w', MDFR_CTRL, save_as);
|
2017-06-20 20:37:45 +00:00
|
|
|
bind(context, 'h', MDFR_CTRL, project_go_to_root_directory);
|
2017-06-30 01:26:02 +00:00
|
|
|
bind(context, 'S', MDFR_CTRL, save_all_dirty_buffers);
|
2016-07-12 19:16:48 +00:00
|
|
|
|
2017-01-29 00:03:23 +00:00
|
|
|
bind(context, 'c', MDFR_ALT, open_color_tweaker);
|
|
|
|
bind(context, 'd', MDFR_ALT, open_debug);
|
2016-06-03 16:20:45 +00:00
|
|
|
|
2016-07-12 18:20:06 +00:00
|
|
|
bind(context, '.', MDFR_ALT, change_to_build_panel);
|
|
|
|
bind(context, ',', MDFR_ALT, close_build_panel);
|
2016-08-22 19:31:19 +00:00
|
|
|
bind(context, 'n', MDFR_ALT, goto_next_error);
|
|
|
|
bind(context, 'N', MDFR_ALT, goto_prev_error);
|
2016-07-12 18:20:06 +00:00
|
|
|
bind(context, 'M', MDFR_ALT, goto_first_error);
|
2016-09-01 19:40:25 +00:00
|
|
|
bind(context, 'm', MDFR_ALT, build_in_build_panel);
|
2016-07-12 19:16:48 +00:00
|
|
|
|
2016-03-15 14:12:06 +00:00
|
|
|
bind(context, 'z', MDFR_ALT, execute_any_cli);
|
2016-05-10 17:36:53 +00:00
|
|
|
bind(context, 'Z', MDFR_ALT, execute_previous_cli);
|
2016-06-03 16:20:45 +00:00
|
|
|
|
2016-07-12 19:16:48 +00:00
|
|
|
bind(context, 'x', MDFR_ALT, execute_arbitrary_command);
|
|
|
|
|
|
|
|
bind(context, 's', MDFR_ALT, show_scrollbar);
|
|
|
|
bind(context, 'w', MDFR_ALT, hide_scrollbar);
|
2017-03-30 15:18:16 +00:00
|
|
|
bind(context, 'b', MDFR_ALT, toggle_filebar);
|
2016-07-12 19:16:48 +00:00
|
|
|
|
2017-02-06 13:49:00 +00:00
|
|
|
bind(context, '@', MDFR_ALT, toggle_mouse);
|
2016-09-01 03:06:46 +00:00
|
|
|
bind(context, key_page_up, MDFR_CTRL, toggle_fullscreen);
|
2016-09-10 15:22:25 +00:00
|
|
|
bind(context, 'E', MDFR_ALT, exit_4coder);
|
2016-06-29 19:11:37 +00:00
|
|
|
|
2016-12-26 22:49:01 +00:00
|
|
|
bind(context, key_f1, MDFR_NONE, project_fkey_command);
|
|
|
|
bind(context, key_f2, MDFR_NONE, project_fkey_command);
|
|
|
|
bind(context, key_f3, MDFR_NONE, project_fkey_command);
|
|
|
|
bind(context, key_f4, MDFR_NONE, project_fkey_command);
|
|
|
|
|
|
|
|
bind(context, key_f5, MDFR_NONE, project_fkey_command);
|
|
|
|
bind(context, key_f6, MDFR_NONE, project_fkey_command);
|
|
|
|
bind(context, key_f7, MDFR_NONE, project_fkey_command);
|
|
|
|
bind(context, key_f8, MDFR_NONE, project_fkey_command);
|
|
|
|
|
|
|
|
bind(context, key_f9, MDFR_NONE, project_fkey_command);
|
|
|
|
bind(context, key_f10, MDFR_NONE, project_fkey_command);
|
|
|
|
bind(context, key_f11, MDFR_NONE, project_fkey_command);
|
|
|
|
bind(context, key_f12, MDFR_NONE, project_fkey_command);
|
|
|
|
|
|
|
|
bind(context, key_f13, MDFR_NONE, project_fkey_command);
|
|
|
|
bind(context, key_f14, MDFR_NONE, project_fkey_command);
|
|
|
|
bind(context, key_f15, MDFR_NONE, project_fkey_command);
|
|
|
|
bind(context, key_f16, MDFR_NONE, project_fkey_command);
|
|
|
|
|
2016-03-15 14:12:06 +00:00
|
|
|
end_map(context);
|
2016-05-23 11:37:12 +00:00
|
|
|
|
2017-01-29 00:03:23 +00:00
|
|
|
begin_map(context, default_code_map);
|
2016-06-03 16:20:45 +00:00
|
|
|
|
2017-01-29 00:03:23 +00:00
|
|
|
// NOTE(allen|a3.1): Set this map (default_code_map == mapid_user_custom) to
|
2016-03-15 14:12:06 +00:00
|
|
|
// inherit from mapid_file. When searching if a key is bound
|
|
|
|
// in this map, if it is not found here it will then search mapid_file.
|
|
|
|
//
|
|
|
|
// If this is not set, it defaults to mapid_global.
|
|
|
|
inherit_map(context, mapid_file);
|
2016-06-03 16:20:45 +00:00
|
|
|
|
2016-03-15 14:12:06 +00:00
|
|
|
// NOTE(allen|a3.1): Children can override parent's bindings.
|
|
|
|
bind(context, key_right, MDFR_CTRL, seek_alphanumeric_or_camel_right);
|
|
|
|
bind(context, key_left, MDFR_CTRL, seek_alphanumeric_or_camel_left);
|
2016-06-03 16:20:45 +00:00
|
|
|
|
2016-03-15 14:12:06 +00:00
|
|
|
// NOTE(allen|a3.2): Specific keys can override vanilla keys,
|
|
|
|
// and write character writes whichever character corresponds
|
|
|
|
// to the key that triggered the command.
|
|
|
|
bind(context, '\n', MDFR_NONE, write_and_auto_tab);
|
2016-07-12 18:20:06 +00:00
|
|
|
bind(context, '\n', MDFR_SHIFT, write_and_auto_tab);
|
2016-03-15 14:12:06 +00:00
|
|
|
bind(context, '}', MDFR_NONE, write_and_auto_tab);
|
|
|
|
bind(context, ')', MDFR_NONE, write_and_auto_tab);
|
|
|
|
bind(context, ']', MDFR_NONE, write_and_auto_tab);
|
|
|
|
bind(context, ';', MDFR_NONE, write_and_auto_tab);
|
|
|
|
bind(context, '#', MDFR_NONE, write_and_auto_tab);
|
2016-06-03 16:20:45 +00:00
|
|
|
|
2016-07-11 16:15:37 +00:00
|
|
|
bind(context, '\t', MDFR_NONE, word_complete);
|
2016-06-13 16:56:33 +00:00
|
|
|
bind(context, '\t', MDFR_CTRL, auto_tab_range);
|
2016-03-15 14:12:06 +00:00
|
|
|
bind(context, '\t', MDFR_SHIFT, auto_tab_line_at_cursor);
|
2016-06-03 16:20:45 +00:00
|
|
|
|
2017-07-11 21:41:25 +00:00
|
|
|
bind(context, 'h', MDFR_ALT, write_hack);
|
|
|
|
bind(context, 'r', MDFR_ALT, write_block);
|
2017-01-29 00:03:23 +00:00
|
|
|
bind(context, 't', MDFR_ALT, write_todo);
|
|
|
|
bind(context, 'y', MDFR_ALT, write_note);
|
2016-03-15 14:12:06 +00:00
|
|
|
bind(context, '[', MDFR_CTRL, open_long_braces);
|
|
|
|
bind(context, '{', MDFR_CTRL, open_long_braces_semicolon);
|
|
|
|
bind(context, '}', MDFR_CTRL, open_long_braces_break);
|
|
|
|
bind(context, 'i', MDFR_ALT, if0_off);
|
|
|
|
bind(context, '1', MDFR_ALT, open_file_in_quotes);
|
2017-02-06 13:49:00 +00:00
|
|
|
bind(context, '2', MDFR_ALT, open_matching_file_cpp);
|
2016-05-19 01:22:35 +00:00
|
|
|
bind(context, '0', MDFR_CTRL, write_zero_struct);
|
2017-01-29 00:03:23 +00:00
|
|
|
bind(context, 'I', MDFR_CTRL, list_all_functions_current_buffer);
|
2016-06-03 16:20:45 +00:00
|
|
|
|
2016-03-15 14:12:06 +00:00
|
|
|
end_map(context);
|
2016-06-03 16:20:45 +00:00
|
|
|
|
|
|
|
|
2016-03-15 14:12:06 +00:00
|
|
|
begin_map(context, mapid_file);
|
2016-06-03 16:20:45 +00:00
|
|
|
|
2016-03-15 14:12:06 +00:00
|
|
|
// NOTE(allen|a3.4.4): Binding this essentially binds
|
|
|
|
// all key combos that would normally insert a character
|
|
|
|
// into a buffer. If the code for the key is not an enum
|
|
|
|
// value such as key_left or key_back then it is a vanilla key.
|
|
|
|
// It is possible to override this binding for individual keys.
|
2016-06-03 16:20:45 +00:00
|
|
|
bind_vanilla_keys(context, write_character);
|
|
|
|
|
2016-06-10 23:46:30 +00:00
|
|
|
// NOTE(allen|a4.0.7): You can now bind left and right clicks.
|
|
|
|
// They only trigger on mouse presses. Modifiers do work
|
|
|
|
// so control+click shift+click etc can now have special meanings.
|
|
|
|
bind(context, key_mouse_left, MDFR_NONE, click_set_cursor);
|
|
|
|
bind(context, key_mouse_right, MDFR_NONE, click_set_mark);
|
|
|
|
|
2016-09-09 17:14:38 +00:00
|
|
|
// NOTE(allen|a4.0.11): You can now bind left and right mouse
|
2017-06-20 20:37:45 +00:00
|
|
|
// button releases. Modifiers do work so control+release shift+release
|
2016-09-09 17:14:38 +00:00
|
|
|
// etc can now have special meanings.
|
|
|
|
bind(context, key_mouse_left_release, MDFR_NONE, click_set_mark);
|
|
|
|
|
2016-06-03 16:20:45 +00:00
|
|
|
bind(context, key_left, MDFR_NONE, move_left);
|
|
|
|
bind(context, key_right, MDFR_NONE, move_right);
|
|
|
|
bind(context, key_del, MDFR_NONE, delete_char);
|
2016-11-18 17:28:55 +00:00
|
|
|
bind(context, key_del, MDFR_SHIFT, delete_char);
|
2016-06-03 16:20:45 +00:00
|
|
|
bind(context, key_back, MDFR_NONE, backspace_char);
|
2016-11-18 17:28:55 +00:00
|
|
|
bind(context, key_back, MDFR_SHIFT, backspace_char);
|
2016-06-03 16:20:45 +00:00
|
|
|
bind(context, key_up, MDFR_NONE, move_up);
|
|
|
|
bind(context, key_down, MDFR_NONE, move_down);
|
2016-06-06 18:41:17 +00:00
|
|
|
bind(context, key_end, MDFR_NONE, seek_end_of_line);
|
|
|
|
bind(context, key_home, MDFR_NONE, seek_beginning_of_line);
|
2016-07-04 20:40:57 +00:00
|
|
|
bind(context, key_page_up, MDFR_NONE, page_up);
|
|
|
|
bind(context, key_page_down, MDFR_NONE, page_down);
|
2016-06-03 16:20:45 +00:00
|
|
|
|
2016-03-15 14:12:06 +00:00
|
|
|
bind(context, key_right, MDFR_CTRL, seek_whitespace_right);
|
|
|
|
bind(context, key_left, MDFR_CTRL, seek_whitespace_left);
|
2016-06-28 19:48:12 +00:00
|
|
|
bind(context, key_up, MDFR_CTRL, seek_whitespace_up_end_line);
|
|
|
|
bind(context, key_down, MDFR_CTRL, seek_whitespace_down_end_line);
|
2016-06-03 16:20:45 +00:00
|
|
|
|
2016-03-15 14:12:06 +00:00
|
|
|
bind(context, key_up, MDFR_ALT, move_up_10);
|
|
|
|
bind(context, key_down, MDFR_ALT, move_down_10);
|
2016-06-03 16:20:45 +00:00
|
|
|
|
2016-03-15 14:12:06 +00:00
|
|
|
bind(context, key_back, MDFR_CTRL, backspace_word);
|
2016-06-10 15:19:29 +00:00
|
|
|
bind(context, key_del, MDFR_CTRL, delete_word);
|
2016-03-15 14:12:06 +00:00
|
|
|
bind(context, key_back, MDFR_ALT, snipe_token_or_word);
|
2017-11-07 21:35:26 +00:00
|
|
|
bind(context, key_del, MDFR_ALT, snipe_token_or_word_right);
|
2016-06-03 16:20:45 +00:00
|
|
|
|
|
|
|
bind(context, ' ', MDFR_CTRL, set_mark);
|
2016-05-12 02:15:54 +00:00
|
|
|
bind(context, 'a', MDFR_CTRL, replace_in_range);
|
2016-06-14 14:20:15 +00:00
|
|
|
bind(context, 'c', MDFR_CTRL, copy);
|
2016-06-03 16:20:45 +00:00
|
|
|
bind(context, 'd', MDFR_CTRL, delete_range);
|
2016-07-12 18:20:06 +00:00
|
|
|
bind(context, 'e', MDFR_CTRL, center_view);
|
|
|
|
bind(context, 'E', MDFR_CTRL, left_adjust_view);
|
2016-05-12 02:15:54 +00:00
|
|
|
bind(context, 'f', MDFR_CTRL, search);
|
2016-07-12 18:20:06 +00:00
|
|
|
bind(context, 'F', MDFR_CTRL, list_all_locations);
|
2016-07-18 18:36:53 +00:00
|
|
|
bind(context, 'F', MDFR_ALT, list_all_substring_locations_case_insensitive);
|
2016-05-12 02:15:54 +00:00
|
|
|
bind(context, 'g', MDFR_CTRL, goto_line);
|
2016-07-05 13:11:26 +00:00
|
|
|
bind(context, 'j', MDFR_CTRL, to_lowercase);
|
2017-01-29 00:03:23 +00:00
|
|
|
bind(context, 'K', MDFR_CTRL, kill_buffer);
|
2016-07-04 20:40:57 +00:00
|
|
|
bind(context, 'l', MDFR_CTRL, toggle_line_wrap);
|
2016-06-06 18:41:17 +00:00
|
|
|
bind(context, 'm', MDFR_CTRL, cursor_mark_swap);
|
2017-01-29 00:03:23 +00:00
|
|
|
bind(context, 'O', MDFR_CTRL, reopen);
|
2016-05-12 02:15:54 +00:00
|
|
|
bind(context, 'q', MDFR_CTRL, query_replace);
|
2017-03-29 16:32:06 +00:00
|
|
|
bind(context, 'Q', MDFR_CTRL, query_replace_identifier);
|
2016-05-12 02:15:54 +00:00
|
|
|
bind(context, 'r', MDFR_CTRL, reverse_search);
|
2017-01-29 00:03:23 +00:00
|
|
|
bind(context, 's', MDFR_CTRL, save);
|
2017-03-29 16:32:06 +00:00
|
|
|
bind(context, 't', MDFR_CTRL, search_identifier);
|
2016-09-23 17:50:55 +00:00
|
|
|
bind(context, 'T', MDFR_CTRL, list_all_locations_of_identifier);
|
2016-07-05 13:11:26 +00:00
|
|
|
bind(context, 'u', MDFR_CTRL, to_uppercase);
|
2016-07-17 02:24:13 +00:00
|
|
|
bind(context, 'v', MDFR_CTRL, paste_and_indent);
|
2016-10-05 06:08:23 +00:00
|
|
|
bind(context, 'v', MDFR_ALT, toggle_virtual_whitespace);
|
2016-07-17 02:24:13 +00:00
|
|
|
bind(context, 'V', MDFR_CTRL, paste_next_and_indent);
|
2016-06-14 14:20:15 +00:00
|
|
|
bind(context, 'x', MDFR_CTRL, cut);
|
2017-01-29 00:03:23 +00:00
|
|
|
bind(context, 'y', MDFR_CTRL, redo);
|
|
|
|
bind(context, 'z', MDFR_CTRL, undo);
|
2016-05-12 02:15:54 +00:00
|
|
|
|
2016-09-20 19:48:02 +00:00
|
|
|
bind(context, '2', MDFR_CTRL, decrease_line_wrap);
|
|
|
|
bind(context, '3', MDFR_CTRL, increase_line_wrap);
|
|
|
|
|
2016-07-04 20:40:57 +00:00
|
|
|
bind(context, '?', MDFR_CTRL, toggle_show_whitespace);
|
2016-07-09 04:39:14 +00:00
|
|
|
bind(context, '~', MDFR_CTRL, clean_all_lines);
|
2016-07-12 18:20:06 +00:00
|
|
|
bind(context, '\n', MDFR_NONE, newline_or_goto_position);
|
2017-03-29 16:32:06 +00:00
|
|
|
bind(context, '\n', MDFR_SHIFT, newline_or_goto_position_same_panel);
|
2016-06-03 16:20:45 +00:00
|
|
|
bind(context, ' ', MDFR_SHIFT, write_character);
|
2016-05-12 02:15:54 +00:00
|
|
|
|
|
|
|
end_map(context);
|
|
|
|
}
|
2016-03-24 01:05:28 +00:00
|
|
|
|
2016-08-22 19:31:19 +00:00
|
|
|
#ifndef NO_BINDING
|
2016-08-29 02:14:02 +00:00
|
|
|
extern "C" int32_t
|
|
|
|
get_bindings(void *data, int32_t size){
|
2016-05-12 02:15:54 +00:00
|
|
|
Bind_Helper context_ = begin_bind_helper(data, size);
|
|
|
|
Bind_Helper *context = &context_;
|
|
|
|
|
2017-01-29 00:03:23 +00:00
|
|
|
set_all_default_hooks(context);
|
2016-05-12 02:15:54 +00:00
|
|
|
default_keys(context);
|
2016-05-07 17:25:45 +00:00
|
|
|
|
2016-08-29 02:14:02 +00:00
|
|
|
int32_t result = end_bind_helper(context);
|
2016-05-07 17:25:45 +00:00
|
|
|
return(result);
|
2016-03-15 14:12:06 +00:00
|
|
|
}
|
2016-06-28 22:58:50 +00:00
|
|
|
#endif //NO_BINDING
|
|
|
|
|
|
|
|
#endif //FCODER_DEFAULT_BINDINGS
|
2016-05-12 02:15:54 +00:00
|
|
|
|
2016-03-21 22:27:27 +00:00
|
|
|
// BOTTOM
|
2017-01-29 00:03:23 +00:00
|
|
|
|