Exemplo n.º 1
0
static void do_rectangle_operation(EditState *s, const char *command)
{
	if (!strcmp(command, "kill")) {
		rectangle_cut(s);
	} else if (!strcmp(command, "yank")) {
		put_status(s, "Rectangle yank not supported!");
	} else if (!strcmp(command, "insert")) {
		minibuffer_edit(NULL, "String to insert: ", NULL, NULL,
				rectangle_insert_query, (void *)s);
	} else {
		put_status(s, "%s command not supported", command);
	}
}

static CmdDef rectop_commands[] = {
    CMD2(KEY_CTRLX('r'), KEY_NONE,
	 "rectangle-operation", do_rectangle_operation, ESs,
	 "s{Rectangle Operation: }")
    CMD_DEF_END,
};

static int rectop_plugin_init(void)
{
    /* commands and default keys */
    qe_register_cmd_table(rectop_commands, NULL);

    return 0;
}

qe_module_init(rectop_plugin_init);
Exemplo n.º 2
0
          "bufed-toggle-read-only", bufed_toggle_read_only)
    CMD1( 'a', KEY_NONE,
          "bufed-toggle-all-visible", bufed_refresh, 1)
    CMD1( 'n', KEY_NONE,
          "next-line", do_up_down, 1)
    CMD1( 'p', KEY_NONE,
          "previous-line", do_up_down, -1)
    CMD1( 'r', 'g',
          "bufed-refresh", bufed_refresh, 0)
    CMD0( 'k', KEY_F8,
          "bufed-kill-buffer", bufed_kill_buffer)
    CMD_DEF_END,
};

static CmdDef bufed_global_commands[] = {
    CMD2( KEY_CTRLX(KEY_CTRL('b')), KEY_NONE,
          "list-buffers", do_list_buffers, ESi, "ui")
    CMD_DEF_END,
};

static int bufed_init(void)
{
    /* inherit from list mode */
    /* CG: assuming list_mode already initialized ? */
    memcpy(&bufed_mode, &list_mode, sizeof(ModeDef));
    bufed_mode.name = "bufed";
    bufed_mode.instance_size = sizeof(BufedState);
    bufed_mode.mode_init = bufed_mode_init;
    bufed_mode.mode_close = bufed_mode_close;
    /* CG: not a good idea, display hook has side effect on layout */
    bufed_mode.display_hook = bufed_display_hook;
Exemplo n.º 3
0
Arquivo: bufed.c Projeto: TheRohans/qi
    CMD1( KEY_CTRL('g'), KEY_NONE, "bufed-abort", do_delete_window, 0)
    CMD0( ' ', KEY_CTRL('t'), "bufed-toggle_selection", list_toggle_selection)
    /* BS should go back to previous item and unmark it */
    //CMD1( 'u', KEY_NONE, "bufed-unmark", bufed_mark, ' ')
    CMD0( '~', KEY_NONE, "bufed-clear-modified", bufed_clear_modified)
    CMD0( '%', KEY_NONE, "bufed-toggle-read-only", bufed_toggle_read_only)
    CMD1( 'a', KEY_NONE, "bufed-toggle-all-visible", bufed_refresh, 1)
    CMD1( 'n', KEY_NONE, "next-line", do_up_down, 1 )
    CMD1( 'p', KEY_NONE, "previous-line", do_up_down, -1 )
    CMD1( 'r', 'g', "bufed-refresh", bufed_refresh, 0)
    CMD0( 'k', KEY_F8, "bufed-kill-buffer", bufed_kill_buffer)
    CMD_DEF_END,
};

static CmdDef bufed_global_commands[] = {
    CMD0( KEY_CTRLX(KEY_CTRL('b')), KEY_NONE, "list-buffers", do_list_buffers)
    CMD_DEF_END,
};

int bufed_init(void)
{
    /* inherit from list mode */
    /* CG: assuming list_mode already initialized ? */
    memcpy(&bufed_mode, &list_mode, sizeof(ModeDef));
    bufed_mode.name = "bufed";
    bufed_mode.instance_size = sizeof(BufedState);
    bufed_mode.mode_init = bufed_mode_init;
    bufed_mode.mode_close = bufed_mode_close;
    bufed_mode.display_hook = bufed_display_hook;
    
    /* first register mode */
Exemplo n.º 4
0
Arquivo: shell.c Projeto: kjk/qemacs
    CMD0( KEY_CTRL('o'), KEY_NONE, "shell-toggle-input", do_shell_toggle_input)
    CMD1( '\r', KEY_NONE, "shell-return", shell_write_char, '\r')
    /* CG: should send s->kbs */
    CMD1( 127, KEY_NONE, "shell-backward-delete-char", shell_write_char, 127)
    CMD1( KEY_CTRL('c'), KEY_NONE, "shell-intr", shell_write_char, 3)
    CMD1( KEY_CTRL('d'), KEY_DELETE, "shell-delete-char", shell_write_char, 4)
    CMD1( KEY_CTRL('i'), KEY_NONE, "shell-tabulate", shell_write_char, 9)
    CMD1( KEY_CTRL('k'), KEY_NONE, "shell-kill-line", shell_write_char, 11)
    CMD1( KEY_CTRL('y'), KEY_NONE, "shell-yank", shell_write_char, 25)
    CMD_DEF_END,
};

/* compilation commands */
static CmdDef compile_commands[] = {
    CMD_( KEY_CTRLXRET('\r'), KEY_NONE, "shell", do_shell, "i")
    CMD_( KEY_CTRLX(KEY_CTRL('e')), KEY_NONE, "compile", do_compile,
          "s{Compile command: }|compile|")
    CMD1( KEY_CTRLX(KEY_CTRL('p')), KEY_NONE, "previous-error", 
          do_compile_error, -1)
    CMD1( KEY_CTRLX(KEY_CTRL('n')), KEY_NONE, "next-error", 
          do_compile_error, 1)
    CMD_DEF_END,
};

static int shell_init(void)
{
    /* first register mode */
    memcpy(&shell_mode, &text_mode, sizeof(ModeDef));
    shell_mode.name = "shell";
    shell_mode.mode_probe = NULL;
    shell_mode.mode_init = shell_mode_init;
Exemplo n.º 5
0
/* specific shell commands */
static CmdDef shell_commands[] = {
    CMD0( KEY_NONE, KEY_NONE, "shell", do_shell)
    CMD0( KEY_CTRL('o'), KEY_NONE, "shell-toggle-input", do_shell_toggle_input)
    CMD1( '\r', KEY_NONE, "shell-return", shell_write_char, '\r')
    CMD1( 127, KEY_NONE, "shell-backward-delete-char", shell_write_char, 127)
    CMD1( KEY_CTRL('d'), KEY_DELETE, "shell-delete-char", shell_write_char, 4)
    CMD1( KEY_CTRL('i'), KEY_NONE, "shell-tabulate", shell_write_char, 9)
    CMD1( KEY_CTRL('k'), KEY_NONE, "shell-kill-line", shell_write_char, 11)
    CMD_DEF_END,
};

/* compilation commands */
static CmdDef compile_commands[] = {
    CMD( KEY_CTRLX(KEY_CTRL('e')), KEY_NONE, "compile\0s{Compile command: }", do_compile)
    CMD1( KEY_CTRLX(KEY_CTRL('p')), KEY_NONE, "previous-error", 
          do_compile_error, -1)
    CMD1( KEY_CTRLX(KEY_CTRL('n')), KEY_NONE, "next-error", 
          do_compile_error, 1)
    CMD_DEF_END,
};

static int shell_init(void)
{
    /* first register mode */
    memcpy(&shell_mode, &text_mode, sizeof(ModeDef));
    shell_mode.name = "shell";
    shell_mode.mode_probe = NULL;
    shell_mode.mode_init = shell_mode_init;
    shell_mode.move_left_right =  shell_move_left_right;
Exemplo n.º 6
0
 /* Editing */
 CMD2( KEY_CTRLC(KEY_CTRL('t')), KEY_NONE,   /* C-c C-t */
       "org-todo", do_org_todo, ES, "*")
 CMD3( KEY_NONE, KEY_NONE,    /* indirect through M-RET */
       "org-insert-heading", do_org_insert_heading, ESi, 0, "*v")
 CMD3( KEY_NONE, KEY_NONE,    /* actually M-S-RET and C-c C-x M */
       "org-insert-todo-heading", do_org_insert_heading, ESi, 1, "*v")
 CMD3( KEY_CTRL('j'), KEY_NONE,    /* actually C-RET */
       "org-insert-heading-respect-content", do_org_insert_heading, ESi, 2, "*v")
 CMD3( KEY_NONE, KEY_NONE,    /* actually C-S-RET */
       "org-insert-todo-heading-respect-content", do_org_insert_heading, ESi, 3, "*v")
 CMD3( KEY_NONE, KEY_NONE,
       "org-do-demote", do_org_promote, ESi, -1, "*v")
 CMD3( KEY_NONE, KEY_NONE,
       "org-do-promote", do_org_promote, ESi, +1, "*v")
 CMD3( KEY_CTRLX('>'), KEY_NONE,    /* actually M-S-right | C-c C-x R */
       "org-demote-subtree", do_org_promote_subtree, ESi, -1, "*v")
 CMD3( KEY_CTRLX('<'), KEY_NONE,    /* actually M-S-left | C-c C-x L */
       "org-promote-subtree", do_org_promote_subtree, ESi, +1, "*v")
 CMD3( KEY_NONE, KEY_NONE,
       "org-move-subtree-down", do_org_move_subtree, ESi, +1, "*v")
 CMD3( KEY_NONE, KEY_NONE,
       "org-move-subtree-up", do_org_move_subtree, ESi, -1, "*v")
 CMD2( KEY_META(KEY_RET), KEY_NONE,    /* Actually M-RET | C-c C-x m */
       "org-meta-return", do_org_meta_return, ES, "*")
 CMD2( KEY_ESC, KEY_LEFT,    /* actually M-left | C-c C-x l */
       "org-metaleft", do_org_metaleft, ES, "")
 CMD2( KEY_ESC, KEY_RIGHT,    /* actually M-right | C-c C-x r */
       "org-metaright", do_org_metaright, ES, "")
 CMD2( KEY_ESC, KEY_DOWN,    /* actually M-down | C-c C-x d */
       "org-metadown", do_org_metadown, ES, "")