evil-qemacs/plugins/my_plugin.c
Charlie Gordon 3bbee69742 Multiple improvements
improve command and bindings registration:
- simplify command and binding registration APIs
- add bindings member in ModeDef structures
- rename qe_register_cmd_table() as qe_register_commands(), change API
- add qe_register_bindings() taking mode, command-name and bindings string
- rename qe_mode_set_key() as qe_register_command_binding()

improve buffer listing:
- add BF_SHELL buffer flag for shell buffers
- show current directory of shell buffers in bufed

improve dired:
- add dired-hide-details-mode on "("
- use details_mask to control long listing

improve trace doctor:
- add EB_TRACE_DEBUG trace flag for debugging traces
- add do_set_trace_flags()
- change do_start_trace_mode() to do_toggle_trace_mode() with arg

misc:
- fix make_user_path() for pathnames without a trailing slash
- use separate commands for prefix_argument handling
- improve strstart(), strend(), pstrcpy(), pstrncpy(), get_dirname()
- add strmatchword() like strstart with check for word boundary
- bumped version to 5.3.3d
2022-08-22 17:13:26 +02:00

24 lines
553 B
C

/*
* Simple plugin example
*/
#include "qe.h"
/* insert 'hello' at the current cursor position */
static void insert_hello(EditState *s)
{
s->offset += eb_insert_str(s->b, s->offset, "Hello world\n");
}
static const CmdDef my_commands[] = {
CMD2( "insert-hello", "C-c h",
"Insert the string Hello world\\n",
insert_hello, ES, "*")
};
static int my_plugin_init(void) {
/* commands and default keys */
qe_register_commands(NULL, my_commands, countof(my_commands));
return 0;
}
qe_module_init(my_plugin_init);