mirror of
https://github.com/irssi/irssi.git
synced 2025-04-30 23:41:12 -05:00
updated /BIND help, removed special_char bind command and added insert_text.
It can be used to add text to entry line, $variables also works with it (eg. /BIND ^T /TOPIC $topic) git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1476 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
c7274cb00e
commit
4e06d50255
@ -1,27 +1,42 @@
|
|||||||
|
|
||||||
@SYNTAX:bind@
|
@SYNTAX:bind@
|
||||||
|
|
||||||
Bind some action to specified keystroke.
|
Bind some action to specified keystroke. Remember that all characters
|
||||||
|
in keystrokes are case-sensitive! Uppercase letter usually means that
|
||||||
|
you need to keep SHIFT pressed to get the key to work.
|
||||||
|
|
||||||
Keystroke can have modifiers:
|
Most most commonly used keystrokes are:
|
||||||
|
|
||||||
ctrl-x
|
^X - Ctrl-X
|
||||||
alt-x
|
meta-x - Meta-x (Meta is quite often Alt-key in PCs, ESC-x works too)
|
||||||
alt-shift-x
|
|
||||||
|
|
||||||
Where x being either a single character, or one of the special keys:
|
Irssi has by default also defined several other keys which you can use:
|
||||||
|
|
||||||
Backspace Delete
|
return - The return/enter key
|
||||||
Home End Prior Next
|
up, down, left, right - Arrow keys
|
||||||
Up Down Left Right
|
home, end, prior, next - prior = Page Up, next = Page Down
|
||||||
Insert Return Tab
|
insert, delete
|
||||||
|
|
||||||
|
The keystroke can contain as many key presses as you want, and you can
|
||||||
|
define names for different key sequences to use them more easily (the
|
||||||
|
keys above are done like that). For example, you may want to manage
|
||||||
|
windows with ^W key, so that ^W^C creates new window, ^W^K kills the
|
||||||
|
active window, etc. you may do it like:
|
||||||
|
|
||||||
|
/BIND ^W^C /WINDOW NEW HIDE
|
||||||
|
/BIND ^W^K /WINDOW KILL
|
||||||
|
|
||||||
|
But maybe you wish to give these binds to other people who want to use
|
||||||
|
some other key than ^W, then it would be better done as:
|
||||||
|
|
||||||
|
/BIND ^W key window
|
||||||
|
/BIND window-^C /WINDOW NEW HIDE
|
||||||
|
/BIND window-^K /WINDOW KILL
|
||||||
|
|
||||||
(these key specifications will some day change to be more epic-like
|
|
||||||
when I have time to implement it)
|
|
||||||
|
|
||||||
Command can be one of:
|
Command can be one of:
|
||||||
|
|
||||||
command - Run any IRC command (you could use /command directly without
|
command - Run any /COMMAND (you could use /COMMAND directly without
|
||||||
specifying this)
|
specifying this)
|
||||||
|
|
||||||
(Cursor movement)
|
(Cursor movement)
|
||||||
@ -73,14 +88,13 @@ Command can be one of:
|
|||||||
refresh_screen
|
refresh_screen
|
||||||
yank_from_cutbuffer - "Undelete" line
|
yank_from_cutbuffer - "Undelete" line
|
||||||
transpose_characters - Swap current and previous character
|
transpose_characters - Swap current and previous character
|
||||||
special_char - Insert special character, data specifies the character.
|
insert_text - Insert data to entry line, data may contain $variables.
|
||||||
This is used mostly for setting bold, underline, color, etc.
|
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
Clear screen:
|
Clear screen:
|
||||||
/BIND Alt-C /CLEAR
|
/BIND meta-c /CLEAR
|
||||||
|
|
||||||
People with qwertz layout probably want to swap Alt-Y and Alt-Z:
|
People with qwertz layout probably want to swap meta-y and meta-z:
|
||||||
/BIND Alt-Z change_window 16
|
/BIND meta-z change_window 16
|
||||||
/BIND -delete Alt-Y
|
/BIND -delete meta-y
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "signals.h"
|
#include "signals.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
#include "special-vars.h"
|
||||||
|
|
||||||
#include "completion.h"
|
#include "completion.h"
|
||||||
#include "command-history.h"
|
#include "command-history.h"
|
||||||
@ -447,8 +448,10 @@ static void key_next_window_item(void)
|
|||||||
SERVER_REC *server;
|
SERVER_REC *server;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
if (active_win->items != NULL)
|
if (active_win->items != NULL) {
|
||||||
signal_emit("command window item next", 3, "", active_win->active_server, active_win->active);
|
signal_emit("command window item next", 3, "",
|
||||||
|
active_win->active_server, active_win->active);
|
||||||
|
}
|
||||||
else if (servers != NULL) {
|
else if (servers != NULL) {
|
||||||
/* change server */
|
/* change server */
|
||||||
if (active_win->active_server == NULL)
|
if (active_win->active_server == NULL)
|
||||||
@ -458,13 +461,19 @@ static void key_next_window_item(void)
|
|||||||
server = index > 0 ? g_slist_nth(servers, index-1)->data :
|
server = index > 0 ? g_slist_nth(servers, index-1)->data :
|
||||||
g_slist_last(servers)->data;
|
g_slist_last(servers)->data;
|
||||||
}
|
}
|
||||||
signal_emit("command window server", 3, server->tag, active_win->active_server, active_win->active);
|
signal_emit("command window server", 3, server->tag,
|
||||||
|
active_win->active_server, active_win->active);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_addchar(const char *data)
|
static void key_insert_text(const char *data)
|
||||||
{
|
{
|
||||||
gui_entry_insert_char(*data);
|
char *str;
|
||||||
|
|
||||||
|
str = parse_special_string(data, active_win->active_server,
|
||||||
|
active_win->active, "", NULL, 0);
|
||||||
|
gui_entry_insert_text(str);
|
||||||
|
g_free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_window_auto_changed(void)
|
static void sig_window_auto_changed(void)
|
||||||
@ -589,12 +598,7 @@ void gui_readline_init(void)
|
|||||||
key_bind("scroll_end", "End of the window", "", NULL, (SIGNAL_FUNC) key_scroll_end);
|
key_bind("scroll_end", "End of the window", "", NULL, (SIGNAL_FUNC) key_scroll_end);
|
||||||
|
|
||||||
/* inserting special input characters to line.. */
|
/* inserting special input characters to line.. */
|
||||||
key_bind("special_char", "Insert special character", "^B", "\002", (SIGNAL_FUNC) key_addchar);
|
key_bind("insert_text", "Append text to line", NULL, NULL, (SIGNAL_FUNC) key_insert_text);
|
||||||
key_bind("special_char", NULL, "^-", "\037", NULL);
|
|
||||||
key_bind("special_char", NULL, "^C", "\003", NULL);
|
|
||||||
key_bind("special_char", NULL, "^V", "\026", NULL);
|
|
||||||
key_bind("special_char", NULL, "^G", "\007", NULL);
|
|
||||||
key_bind("special_char", NULL, "^O", "\017", NULL);
|
|
||||||
|
|
||||||
key_bind("multi", NULL, "return", "check_replaces;send_line", NULL);
|
key_bind("multi", NULL, "return", "check_replaces;send_line", NULL);
|
||||||
|
|
||||||
@ -656,7 +660,7 @@ void gui_readline_deinit(void)
|
|||||||
key_unbind("scroll_start", (SIGNAL_FUNC) key_scroll_start);
|
key_unbind("scroll_start", (SIGNAL_FUNC) key_scroll_start);
|
||||||
key_unbind("scroll_end", (SIGNAL_FUNC) key_scroll_end);
|
key_unbind("scroll_end", (SIGNAL_FUNC) key_scroll_end);
|
||||||
|
|
||||||
key_unbind("special_char", (SIGNAL_FUNC) key_addchar);
|
key_unbind("insert_text", (SIGNAL_FUNC) key_insert_text);
|
||||||
key_unbind("change_window", (SIGNAL_FUNC) key_change_window);
|
key_unbind("change_window", (SIGNAL_FUNC) key_change_window);
|
||||||
keyboard_destroy(keyboard);
|
keyboard_destroy(keyboard);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user