vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit f01d18af50fa892189e1314c9056d1408d379815
parent abbef91832a21a279d74715b46f616dd2c992bda
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Tue, 15 Mar 2016 19:25:25 +0100

vis: add support for command register ":

Diffstat:
MREADME.md | 1+
Mmain.c | 2++
Mvis-prompt.c | 1+
Mvis.h | 1+
4 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -236,6 +236,7 @@ Operators can be forced to work line wise by specifying `V`. "*, "+ system clipboard integration via shell scripts vis-{copy,paste} "0 yank register "/ search register + ": command register "_ black hole (/dev/null) register If no explicit register is specified a default register is used. diff --git a/main.c b/main.c @@ -1156,6 +1156,8 @@ static const char *key2register(Vis *vis, const char *keys, enum VisRegister *re *reg = VIS_MACRO_LAST_RECORDED; else if (keys[0] == '/') *reg = VIS_REG_SEARCH; + else if (keys[0] == ':') + *reg = VIS_REG_COMMAND; return keys+1; } diff --git a/vis-prompt.c b/vis-prompt.c @@ -14,6 +14,7 @@ bool vis_prompt_cmd(Vis *vis, const char *cmd) { case '+': case ':': { + register_put(vis, &vis->registers[VIS_REG_COMMAND], cmd+1, strlen(cmd+1)+1); bool ret = vis_cmd(vis, cmd+1); if (ret && vis->mode->visual) vis_mode_switch(vis, VIS_MODE_NORMAL); diff --git a/vis.h b/vis.h @@ -353,6 +353,7 @@ enum VisRegister { VIS_MACRO_OPERATOR, /* records entered keys after an operator */ VIS_MACRO_REPEAT, /* copy of the above macro once the recording is finished */ VIS_REG_SEARCH, /* last used search pattern "/ */ + VIS_REG_COMMAND, /* last used :-command ": */ VIS_REG_INVALID, /* has to be the last 'real' register */ VIS_REG_A, VIS_REG_B, VIS_REG_C, VIS_REG_D, VIS_REG_E, VIS_REG_F, VIS_REG_G, VIS_REG_H, VIS_REG_I, VIS_REG_J,