2004-05-29 10:17:37 +00:00
|
|
|
/*
|
|
|
|
|
* Simple plugin example
|
|
|
|
|
*/
|
|
|
|
|
#include "qe.h"
|
|
|
|
|
|
|
|
|
|
/* insert 'hello' at the current cursor position */
|
|
|
|
|
static void insert_hello(EditState *s)
|
|
|
|
|
{
|
2014-01-11 14:38:30 +00:00
|
|
|
s->offset += eb_insert_str(s->b, s->offset, "Hello world\n");
|
2004-05-29 10:17:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static CmdDef my_commands[] = {
|
2014-01-11 14:38:30 +00:00
|
|
|
CMD2( KEY_CTRLC('h'), KEY_NONE, /* C-c h */
|
Improve command argument parsing
- add description placeholders to all CMDx definitions
- swap arguments to qe_split_window() and do_split_window()
- pass iteration count based on universal argument to
do_up_down(), do_left_right(), do_word_right(), do_kill_word(),
do_forward_paragraph(), do_kill_paragraph(), do_c_forward_conditional(),
do_forward_block(), do_kill_block(),
- remove do_backward_paragraph()
- add int eb_prev_paragraph(EditBuffer *b, int offset);
- dont call command on 0 universal prefix
2020-11-01 19:03:20 +01:00
|
|
|
"insert-hello", insert_hello, ES, "*",
|
|
|
|
|
"")
|
2004-05-29 10:17:37 +00:00
|
|
|
CMD_DEF_END,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static int my_plugin_init(void)
|
|
|
|
|
{
|
|
|
|
|
/* commands and default keys */
|
|
|
|
|
qe_register_cmd_table(my_commands, NULL);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qe_module_init(my_plugin_init);
|