aboutsummaryrefslogtreecommitdiff
path: root/config/ecexrc.c
diff options
context:
space:
mode:
authorDavid Moc <personal@cdatgoose.org>2026-05-31 03:47:04 +0200
committerDavid Moc <personal@cdatgoose.org>2026-05-31 03:47:04 +0200
commit6aeaa171dc1ca43392f53cbd02097f76e1b1c5a0 (patch)
treeb16f559f5a701123ebe7b15ecebb9325263b4a3c /config/ecexrc.c
parente930cc6bdc7f62befac063d7d9d016ffb0a64f1a (diff)
Hardened API, tetris, MD-View
Diffstat (limited to 'config/ecexrc.c')
-rw-r--r--config/ecexrc.c55
1 files changed, 33 insertions, 22 deletions
diff --git a/config/ecexrc.c b/config/ecexrc.c
index db4b6b9..1d13f18 100644
--- a/config/ecexrc.c
+++ b/config/ecexrc.c
@@ -1,8 +1,13 @@
#include "ecex.h"
#include "buffers.h"
-#define C(x) ((float)(x) / 255.0f)
-#define RGB(r, g, b) C(r), C(g), C(b)
+#define ECEX_NO_STANDALONE_CONFIG
+#include "render_demo.c"
+#include "tetris.c"
+#include "markdown_plugin.c"
+#undef ECEX_NO_STANDALONE_CONFIG
+
+#define RGB(r, g, b) ECEX_RGB8(r, g, b)
/* Gruvbox dark palette */
#define GB_DARK0_HARD RGB(0x1d, 0x20, 0x21)
@@ -93,7 +98,23 @@ static int demo_interactive_command(ecex_t *ed) {
return 0;
}
-int ecex_config_init(ecex_t *ed) {
+static const ecex_config_command_t config_commands[] = {
+ {"hello", hello_command},
+ {"make-notes", make_notes_command},
+ {"demo-interactive", demo_interactive_command},
+};
+
+static const ecex_config_keybind_t config_binds[] = {
+ {"C-h", "hello"},
+ {"C-m", "make-notes"},
+ {"F2", "list-commands"},
+ {"F3", "list-buffers"},
+ {"F4", "demo-interactive"},
+ {"C-q", "quit"},
+ {"C-x h", "beginning-of-buffer"},
+};
+
+ECEX_CONFIG_BEGIN
ecex_set_font_size(ed, 20.0f);
ecex_set_bg_color(ed, GB_DARK0_HARD);
@@ -115,28 +136,18 @@ int ecex_config_init(ecex_t *ed) {
ecex_set_cursor_color(ed, GB_AQUA);
ecex_set_region_bg_color(ed, GB_DARK2);
- ecex_register_command(ed, "hello", hello_command);
- ecex_register_command(ed, "make-notes", make_notes_command);
- ecex_register_command(ed, "demo-interactive", demo_interactive_command);
-
- ecex_bind_key(ed, "C-h", "hello");
- ecex_bind_key(ed, "C-m", "make-notes");
- ecex_bind_key(ed, "F2", "list-commands");
- ecex_bind_key(ed, "F3", "list-buffers");
- ecex_bind_key(ed, "F4", "demo-interactive");
- ecex_bind_key(ed, "C-q", "quit");
- ecex_bind_key(ed, "C-x h", "beginning-of-buffer");
-
- ecex_bind_key(ed, "C-x b n", "next-buffer");
- ecex_bind_key(ed, "C-x b p", "previous-buffer");
+ ECEX_CONFIG_COMMANDS(config_commands);
+ ECEX_CONFIG_BINDS(config_binds);
+ ECEX_CONFIG_INCLUDE(ecex_render_demo_plugin);
+ ECEX_CONFIG_INCLUDE(ecex_tetris_plugin);
+ ECEX_CONFIG_INCLUDE(ecex_markdown_plugin);
buffer_t *scratch = ecex_current_buffer(ed);
- buffer_insert(scratch, "ecex config loaded with Gruvbox colors!\n");
- buffer_insert(scratch, "Try F1 M-x, C-x C-f, C-x C-s, F2 commands, F3 buffers, F4 demo menu, C-x b n/p.\n");
- buffer_insert(scratch, "Eval live C snippets with C-x C-e (line), C-x e r (marked region), C-x e b (buffer), C-x e f (file).\n");
+ buffer_insert(scratch, "ecex config loaded !\n");
+ buffer_insert(scratch, "Try F1, C-x C-f, C-x C-s, C-x d file browser, F2 commands, F3 buffers, F4 demo menu, C-x b.\n");
+ buffer_insert(scratch, "Run M-x render-demo for a custom renderer demo, or M-x tetris for Tetris.\n");
buffer_insert(scratch, "Example line to edit then C-x C-e: ecex_set_font_size(ed, 28.0f);\n");
buffer_insert(scratch, "Example relative change: ecex_adjust_font_size(ed, 2.0f);\n\n");
- return 0;
-}
+ECEX_CONFIG_END