#ifndef CONFIG_H
#define CONFIG_H


#include "app.h"
#include "buffer.h"
#include "keybind.h"


void config(struct app *app);
void config(struct app *app) {
	/* app_add_global_keybing(app, "C-u", keybing_universal_cmd, -1); */
	app_add_global_keybind(app, "C-d", keybind_delete_char, DIR_FORWARD);
	app_add_global_keybind(app, "A-d", keybind_delete_word, DIR_FORWARD);

	app_add_global_keybind(app, "C-e", keybind_mv_cur_end_line, DIR_NO);
	app_add_global_keybind(app, "C-a", keybind_mv_cur_beg_line, DIR_NO);
	app_add_global_keybind(app, "A-b", keybind_mv_cur_word, DIR_BACKWARD);
	app_add_global_keybind(app, "A-f", keybind_mv_cur_word, DIR_FORWARD);

	app_add_global_keybind(app, "C-s", keybind_save_buffer, DIR_NO);

	char *k = calloc(sizeof(char), 2);
	for ( char c = 32; c < 127; ++c) {
		k[0] = c;
		app_add_global_keybind(app, k,
				       keybind_insert_last_pressed_key, DIR_NO);
	}
	/* app_add_global_keybind(app, "C-s", keybind_save_buffer, DIR_NO); */
	/* app_add_mode_keybing(app, BUFFER_MODE_TEXT, "<delete>", */
	/* 		     keybing_delete_char, DIR_FORWARD); */
	/* app_add_mode_keybing(app, BUFFER_MODE_TEXT, "<return>", */
	/* 		     keybing_insert_newline, 0); */
	/* printf("config\n"); */
	/* exit(1); */
}



/* #define KEYBINDS_MAX_SIZE 1048 */
/* #define KMS KEYBINDS_MAX_SIZE */
/* static struct keybinds keybinds[KMS] = { */
/* 	[SDLK_LEFT % KMS] = { */
/* 		.size = 1, */
/* 		.binds = { */
/* 			{KMOD_NONE, keybind_mv_cur_char, {.dir = DIR_BACKWARD}} */
/* 		} */
/* 	}, */
/* 	[SDLK_RIGHT % KMS] = { */
/* 		.size = 1, */
/* 		.binds = { */
/* 			{KMOD_NONE, keybind_mv_cur_char, {.dir = DIR_FORWARD}} */
/* 		} */
/* 	}, */
/* 	[SDLK_DELETE % KMS] = { */
/* 		.size = 1, */
/* 		.binds = { */
/* 			{KMOD_NONE, keybind_delete_char, {.dir = DIR_FORWARD}}, */
/* 		} */
/* 	}, */
/* 	[SDLK_UP % KMS] = { */
/* 		.size = 1, */
/* 		.binds = { */
/* 			{KMOD_NONE, keybind_mv_cur_line, {.dir = DIR_BACKWARD}} */
/* 		} */
/* 	}, */
/* 	[SDLK_DOWN % KMS] = { */
/* 		.size = 1, */
/* 		.binds = { */
/* 			{KMOD_NONE, keybind_mv_cur_line, {.dir = DIR_FORWARD}} */
/* 		} */
/* 	}, */
/* 	[SDLK_RETURN % KMS] = { */
/* 		.size = 1, */
/* 		.binds = { */
/* 			{KMOD_NONE, keybind_insert_newline, {.ptr = NULL}} */
/* 		} */
/* 	}, */
/* 	[SDLK_BACKSPACE % KMS] = { */
/* 		.size = 2, */
/* 		.binds = { */
/* 			{KMOD_NONE, keybind_delete_char, {.dir = DIR_BACKWARD}}, */
/* 			{KMOD_CTRL, keybind_delete_word, {.dir = DIR_BACKWARD}} */
/* 		} */
/* 	}, */
/* 	[SDLK_PERIOD % KMS] = { */
/* 		.size = 1, */
/* 		.binds = { */
/* 			{KMOD_ALT | KMOD_SHIFT, keybind_mv_cur_end_buffer, */
/* 			 {.dir = DIR_FORWARD}} */
/* 		} */
/* 	}, */
/* 	[SDLK_COMMA % KMS] = { */
/* 		.size = 1, */
/* 		.binds = { */
/* 			{KMOD_ALT | KMOD_SHIFT, keybind_mv_cur_end_buffer, */
/* 			 {.dir = DIR_BACKWARD}} */
/* 		} */
/* 	}, */
/* }; */


/* #undef KMS */

#endif
