bindings: hard-bind the bookmark functions to M-Ins and M-PgUp/M-PgDn
Bind the toggling of a bookmark to <Alt+Insert>, and the jumping to the previous and next bookmark to <Alt+PageUp> and <Alt+PageDown>, so that these functions are available by default. Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>master
parent
f091c34bac
commit
9fb0beca1d
|
@ -104,7 +104,8 @@ int shiftleft, shiftright, shiftup, shiftdown;
|
||||||
int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown;
|
int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown;
|
||||||
int shiftcontrolhome, shiftcontrolend;
|
int shiftcontrolhome, shiftcontrolend;
|
||||||
int altleft, altright, altup, altdown;
|
int altleft, altright, altup, altdown;
|
||||||
int altdelete;
|
int altpageup, altpagedown;
|
||||||
|
int altinsert, altdelete;
|
||||||
int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
|
int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1203,6 +1204,9 @@ void shortcut_init(void)
|
||||||
add_to_sclist(MMAIN, "Sh-^Del", CONTROL_SHIFT_DELETE, chop_previous_word, 0);
|
add_to_sclist(MMAIN, "Sh-^Del", CONTROL_SHIFT_DELETE, chop_previous_word, 0);
|
||||||
add_to_sclist(MMAIN, "^Del", CONTROL_DELETE, chop_next_word, 0);
|
add_to_sclist(MMAIN, "^Del", CONTROL_DELETE, chop_next_word, 0);
|
||||||
add_to_sclist(MMAIN, "M-Del", ALT_DELETE, zap_text, 0);
|
add_to_sclist(MMAIN, "M-Del", ALT_DELETE, zap_text, 0);
|
||||||
|
add_to_sclist(MMAIN, "M-Ins", ALT_INSERT, bookmark, 0);
|
||||||
|
add_to_sclist(MMAIN, "M-PgUp", ALT_PAGEUP, to_prev_bookmark, 0);
|
||||||
|
add_to_sclist(MMAIN, "M-PgDn", ALT_PAGEDOWN, to_next_bookmark, 0);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_WORDCOMPLETION
|
#ifdef ENABLE_WORDCOMPLETION
|
||||||
add_to_sclist(MMAIN, "^]", 0, complete_a_word, 0);
|
add_to_sclist(MMAIN, "^]", 0, complete_a_word, 0);
|
||||||
|
|
|
@ -2310,6 +2310,10 @@ int main(int argc, char **argv)
|
||||||
altright = get_keycode("kRIT3", ALT_RIGHT);
|
altright = get_keycode("kRIT3", ALT_RIGHT);
|
||||||
altup = get_keycode("kUP3", ALT_UP);
|
altup = get_keycode("kUP3", ALT_UP);
|
||||||
altdown = get_keycode("kDN3", ALT_DOWN);
|
altdown = get_keycode("kDN3", ALT_DOWN);
|
||||||
|
|
||||||
|
altpageup = get_keycode("kPRV3", ALT_PAGEUP);
|
||||||
|
altpagedown = get_keycode("kNXT3", ALT_PAGEDOWN);
|
||||||
|
altinsert = get_keycode("kIC3", ALT_INSERT);
|
||||||
altdelete = get_keycode("kDC3", ALT_DELETE);
|
altdelete = get_keycode("kDC3", ALT_DELETE);
|
||||||
|
|
||||||
shiftaltleft = get_keycode("kLFT4", SHIFT_ALT_LEFT);
|
shiftaltleft = get_keycode("kLFT4", SHIFT_ALT_LEFT);
|
||||||
|
|
|
@ -592,6 +592,9 @@ enum
|
||||||
#define ALT_RIGHT 0x422
|
#define ALT_RIGHT 0x422
|
||||||
#define ALT_UP 0x423
|
#define ALT_UP 0x423
|
||||||
#define ALT_DOWN 0x424
|
#define ALT_DOWN 0x424
|
||||||
|
#define ALT_PAGEUP 0x427
|
||||||
|
#define ALT_PAGEDOWN 0x428
|
||||||
|
#define ALT_INSERT 0x42C
|
||||||
#define ALT_DELETE 0x42D
|
#define ALT_DELETE 0x42D
|
||||||
#define SHIFT_ALT_LEFT 0x431
|
#define SHIFT_ALT_LEFT 0x431
|
||||||
#define SHIFT_ALT_RIGHT 0x432
|
#define SHIFT_ALT_RIGHT 0x432
|
||||||
|
|
|
@ -76,7 +76,8 @@ extern int shiftcontrolup, shiftcontroldown;
|
||||||
extern int shiftcontrolhome, shiftcontrolend;
|
extern int shiftcontrolhome, shiftcontrolend;
|
||||||
extern int altleft, altright;
|
extern int altleft, altright;
|
||||||
extern int altup, altdown;
|
extern int altup, altdown;
|
||||||
extern int altdelete;
|
extern int altpageup, altpagedown;
|
||||||
|
extern int altinsert, altdelete;
|
||||||
extern int shiftaltleft, shiftaltright;
|
extern int shiftaltleft, shiftaltright;
|
||||||
extern int shiftaltup, shiftaltdown;
|
extern int shiftaltup, shiftaltdown;
|
||||||
#endif
|
#endif
|
||||||
|
|
23
src/winio.c
23
src/winio.c
|
@ -594,9 +594,14 @@ int convert_sequence(const int *seq, size_t length, int *consumed)
|
||||||
/* Esc [ 2 ~ == Insert on VT220/VT320/
|
/* Esc [ 2 ~ == Insert on VT220/VT320/
|
||||||
* Linux console/xterm/Terminal. */
|
* Linux console/xterm/Terminal. */
|
||||||
return KEY_IC;
|
return KEY_IC;
|
||||||
else if (length > 4 && seq[2] == ';' && seq[4] == '~')
|
else if (length > 4 && seq[2] == ';' && seq[4] == '~') {
|
||||||
/* Esc [ 2 ; x ~ == modified Insert on xterm. */
|
/* Esc [ 2 ; x ~ == modified Insert on xterm. */
|
||||||
*consumed = 5;
|
*consumed = 5;
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
if (seq[3] == '3')
|
||||||
|
return ALT_INSERT;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
else if (length > 5 && seq[3] == ';' && seq[5] == '~')
|
else if (length > 5 && seq[3] == ';' && seq[5] == '~')
|
||||||
/* Esc [ 2 n ; 2 ~ == F21...F24 on some terminals. */
|
/* Esc [ 2 n ; 2 ~ == F21...F24 on some terminals. */
|
||||||
*consumed = 6;
|
*consumed = 6;
|
||||||
|
@ -670,6 +675,8 @@ int convert_sequence(const int *seq, size_t length, int *consumed)
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (seq[3] == '2')
|
if (seq[3] == '2')
|
||||||
return shiftaltup;
|
return shiftaltup;
|
||||||
|
if (seq[3] == '3')
|
||||||
|
return ALT_PAGEUP;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -682,6 +689,8 @@ int convert_sequence(const int *seq, size_t length, int *consumed)
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (seq[3] == '2')
|
if (seq[3] == '2')
|
||||||
return shiftaltdown;
|
return shiftaltdown;
|
||||||
|
if (seq[3] == '3')
|
||||||
|
return ALT_PAGEDOWN;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1067,6 +1076,12 @@ int parse_kbinput(WINDOW *win)
|
||||||
return ALT_UP;
|
return ALT_UP;
|
||||||
else if (retval == altdown)
|
else if (retval == altdown)
|
||||||
return ALT_DOWN;
|
return ALT_DOWN;
|
||||||
|
else if (retval == altpageup)
|
||||||
|
return ALT_PAGEUP;
|
||||||
|
else if (retval == altpagedown)
|
||||||
|
return ALT_PAGEDOWN;
|
||||||
|
else if (retval == altinsert)
|
||||||
|
return ALT_INSERT;
|
||||||
else if (retval == altdelete)
|
else if (retval == altdelete)
|
||||||
return ALT_DELETE;
|
return ALT_DELETE;
|
||||||
else if (retval == shiftaltleft) {
|
else if (retval == shiftaltleft) {
|
||||||
|
@ -1114,6 +1129,12 @@ int parse_kbinput(WINDOW *win)
|
||||||
return ALT_UP;
|
return ALT_UP;
|
||||||
if (retval == KEY_DOWN)
|
if (retval == KEY_DOWN)
|
||||||
return ALT_DOWN;
|
return ALT_DOWN;
|
||||||
|
if (retval == KEY_PPAGE)
|
||||||
|
return ALT_PAGEUP;
|
||||||
|
if (retval == KEY_NPAGE)
|
||||||
|
return ALT_PAGEDOWN;
|
||||||
|
if (retval == KEY_IC)
|
||||||
|
return ALT_INSERT;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Is Ctrl being held? */
|
/* Is Ctrl being held? */
|
||||||
|
|
Loading…
Reference in New Issue