Skip to content

Commit

Permalink
vis: implement yank register "0
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Feb 10, 2016
1 parent 528c418 commit 66a56c8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,8 @@ static const char *key2register(Vis *vis, const char *keys, enum VisRegister *re
*reg = VIS_REG_CLIPBOARD;
else if (keys[0] == '_')
*reg = VIS_REG_BLACKHOLE;
else if (keys[0] == '0')
*reg = VIS_REG_ZERO;
return keys+1;
}

Expand Down
2 changes: 2 additions & 0 deletions vis-operators.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ static size_t op_change(Vis *vis, Text *txt, OperatorContext *c) {
static size_t op_yank(Vis *vis, Text *txt, OperatorContext *c) {
c->reg->linewise = c->linewise;
register_put(vis, c->reg, txt, &c->range);
if (c->reg == &vis->registers[VIS_REG_DEFAULT])
register_put(vis, &vis->registers[VIS_REG_ZERO], txt, &c->range);
return c->pos;
}

Expand Down
1 change: 1 addition & 0 deletions vis.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ enum VisRegister {
VIS_REG_u, VIS_REG_v, VIS_REG_w, VIS_REG_x, VIS_REG_y,
VIS_REG_z,
VIS_REG_DEFAULT, /* used when no other register is specified */
VIS_REG_ZERO, /* yank register */
VIS_REG_BLACKHOLE, /* /dev/null register */
VIS_REG_CLIPBOARD, /* system clipboard register */
VIS_REG_PROMPT, /* internal register which shadows DEFAULT in PROMPT mode */
Expand Down

0 comments on commit 66a56c8

Please sign in to comment.