Add support for copy/paste registers

This adds support for vim-style copy/paste registers which allows
cutting and copying multiple items without having to overwrite the
copy/paste buffer. Registers can be specified using the quote key ('"').
To access a register, type '"x' before a command where "x" is the name
of a register. If you want to copy the currently selected item into
register 1, type '"1c'.

Valid registers are 0-9, a-z, "-" and "_". Note that the latter is the
so-called black hole register, which works similar to the black hole
register in vim.

The register prefix key is currently hardcoded and cannot be configured.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer
2012-07-07 00:53:09 +02:00
parent dd059ca812
commit 69345edd77
7 changed files with 63 additions and 38 deletions

View File

@@ -226,7 +226,7 @@ void custom_layout_config(void)
display_layout_config(&conf_win, mark, cursor);
clear();
while ((ch = keys_getch(win[STA].p, NULL)) != KEY_GENERIC_QUIT) {
while ((ch = keys_getch(win[STA].p, NULL, NULL)) != KEY_GENERIC_QUIT) {
need_reset = 0;
switch (ch) {
case KEY_GENERIC_HELP:
@@ -310,7 +310,7 @@ void custom_sidebar_config(void)
bindings_size, NULL);
wins_doupdate();
while ((ch = keys_getch(win[STA].p, NULL)) != KEY_GENERIC_QUIT) {
while ((ch = keys_getch(win[STA].p, NULL, NULL)) != KEY_GENERIC_QUIT) {
switch (ch) {
case KEY_MOVE_UP:
wins_sbar_winc();
@@ -528,7 +528,7 @@ void custom_color_config(void)
theme_changed);
clear();
while ((ch = keys_getch(win[STA].p, NULL)) != KEY_GENERIC_QUIT) {
while ((ch = keys_getch(win[STA].p, NULL, NULL)) != KEY_GENERIC_QUIT) {
need_reset = 0;
theme_changed = 0;
@@ -921,7 +921,7 @@ void custom_keys_config(void)
for (;;) {
int ch;
ch = keys_getch(win[STA].p, NULL);
ch = keys_getch(win[STA].p, NULL, NULL);
switch (ch) {
case KEY_MOVE_UP:
if (selrow > 0) {