Skip to content

Commit

Permalink
vis: implement gU using tr(1)
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed May 16, 2018
1 parent 6d02c89 commit f9d0d91
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 11 deletions.
2 changes: 1 addition & 1 deletion config.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ static const KeyBinding bindings_operators[] = {
{ "gp", ACTION(PUT_AFTER_END) },
{ "gP", ACTION(PUT_BEFORE_END) },
{ "gu", ALIAS(":|tr '[:upper:]' '[:lower:]'<Enter>")},
{ "gU", ACTION(OPERATOR_CASE_UPPER) },
{ "gU", ALIAS(":|tr '[:lower:]' '[:upper:]'<Enter>")},
{ "p", ACTION(PUT_AFTER) },
{ "P", ACTION(PUT_BEFORE) },
{ "y", ACTION(OPERATOR_YANK) },
Expand Down
6 changes: 0 additions & 6 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ enum {
VIS_ACTION_OPERATOR_YANK,
VIS_ACTION_OPERATOR_SHIFT_LEFT,
VIS_ACTION_OPERATOR_SHIFT_RIGHT,
VIS_ACTION_OPERATOR_CASE_UPPER,
VIS_ACTION_OPERATOR_CASE_SWAP,
VIS_ACTION_COUNT,
VIS_ACTION_INSERT_NEWLINE,
Expand Down Expand Up @@ -778,11 +777,6 @@ static const KeyAction vis_action[] = {
VIS_HELP("Shift right operator")
operator, { .i = VIS_OP_SHIFT_RIGHT }
},
[VIS_ACTION_OPERATOR_CASE_UPPER] = {
"vis-operator-case-upper",
VIS_HELP("Uppercase operator")
operator, { .i = VIS_OP_CASE_UPPER }
},
[VIS_ACTION_OPERATOR_CASE_SWAP] = {
"vis-operator-case-swap",
VIS_HELP("Swap case operator")
Expand Down
3 changes: 0 additions & 3 deletions vis-operators.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ static size_t op_case_change(Vis *vis, Text *txt, OperatorContext *c) {
if (isascii(ch)) {
if (c->arg->i == VIS_OP_CASE_SWAP)
*cur = islower(ch) ? toupper(ch) : tolower(ch);
else if (c->arg->i == VIS_OP_CASE_UPPER)
*cur = toupper(ch);
}
}

Expand Down Expand Up @@ -266,7 +264,6 @@ bool vis_operator(Vis *vis, enum VisOperator id, ...) {
case VIS_OP_MODESWITCH:
vis->action.mode = va_arg(ap, int);
break;
case VIS_OP_CASE_UPPER:
case VIS_OP_CASE_SWAP:
vis->action.arg.i = id;
id = VIS_OP_CASE_SWAP;
Expand Down
1 change: 0 additions & 1 deletion vis.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@ enum VisOperator {
VIS_OP_CASE_SWAP,
VIS_OP_INVALID, /* denotes the end of the "real" operators */
/* pseudo operators: keep them at the end to save space in array definition */
VIS_OP_CASE_UPPER,
VIS_OP_CURSOR_EOL,
VIS_OP_PUT_AFTER_END,
VIS_OP_PUT_BEFORE,
Expand Down

0 comments on commit f9d0d91

Please sign in to comment.