Skip to content

Commit

Permalink
vis: remove v and V in operator pending mode
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed May 16, 2018
1 parent 55ea139 commit e34b829
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 31 deletions.
7 changes: 0 additions & 7 deletions config.def.h
Expand Up @@ -188,12 +188,6 @@ static const KeyBinding bindings_operators[] = {
{ 0 /* empty last element, array terminator */ },
};

static const KeyBinding bindings_operator_options[] = {
{ "v", ACTION(MOTION_CHARWISE) },
{ "V", ACTION(MOTION_LINEWISE) },
{ 0 /* empty last element, array terminator */ },
};

static const KeyBinding bindings_normal[] = {
{ "a", ACTION(APPEND_CHAR_NEXT) },
{ "A", ACTION(APPEND_LINE_END) },
Expand Down Expand Up @@ -347,7 +341,6 @@ static const KeyBinding bindings_replace[] = {
* one array the first definition is used and further ones are ignored. */
static const KeyBinding **default_bindings[] = {
[VIS_MODE_OPERATOR_PENDING] = (const KeyBinding*[]){
bindings_operator_options,
bindings_operators,
bindings_textobjects,
bindings_motions,
Expand Down
19 changes: 0 additions & 19 deletions main.c
Expand Up @@ -97,8 +97,6 @@ static const char *count(Vis*, const char *keys, const Arg *arg);
/* move to the count-th line or if not given either to the first (arg->i < 0)
* or last (arg->i > 0) line of file */
static const char *gotoline(Vis*, const char *keys, const Arg *arg);
/* set motion type either LINEWISE or CHARWISE via arg->i */
static const char *motiontype(Vis*, const char *keys, const Arg *arg);
/* make the current action use the operator indicated by arg->i */
static const char *operator(Vis*, const char *keys, const Arg *arg);
/* blocks to read a key and performs movement indicated by arg->i which
Expand Down Expand Up @@ -321,8 +319,6 @@ enum {
VIS_ACTION_TEXT_OBJECT_INDENTATION,
VIS_ACTION_TEXT_OBJECT_SEARCH_FORWARD,
VIS_ACTION_TEXT_OBJECT_SEARCH_BACKWARD,
VIS_ACTION_MOTION_CHARWISE,
VIS_ACTION_MOTION_LINEWISE,
VIS_ACTION_UNICODE_INFO,
VIS_ACTION_UTF8_INFO,
VIS_ACTION_NOP,
Expand Down Expand Up @@ -1199,16 +1195,6 @@ static const KeyAction vis_action[] = {
VIS_HELP("The next search match in backward direction")
textobj, { .i = VIS_TEXTOBJECT_SEARCH_BACKWARD }
},
[VIS_ACTION_MOTION_CHARWISE] = {
"vis-motion-charwise",
VIS_HELP("Force motion to be charwise")
motiontype, { .i = VIS_MOTIONTYPE_CHARWISE }
},
[VIS_ACTION_MOTION_LINEWISE] = {
"vis-motion-linewise",
VIS_HELP("Force motion to be linewise")
motiontype, { .i = VIS_MOTIONTYPE_LINEWISE }
},
[VIS_ACTION_UNICODE_INFO] = {
"vis-unicode-info",
VIS_HELP("Show Unicode codepoint(s) of character under cursor")
Expand Down Expand Up @@ -1909,11 +1895,6 @@ static const char *gotoline(Vis *vis, const char *keys, const Arg *arg) {
return keys;
}

static const char *motiontype(Vis *vis, const char *keys, const Arg *arg) {
vis_motion_type(vis, arg->i);
return keys;
}

static const char *operator(Vis *vis, const char *keys, const Arg *arg) {
vis_operator(vis, arg->i);
return keys;
Expand Down
2 changes: 1 addition & 1 deletion vis-lua.c
Expand Up @@ -1016,7 +1016,7 @@ static size_t motion_lua(Vis *vis, Win *win, void *data, size_t pos) {
static int motion_register(lua_State *L) {
Vis *vis = obj_ref_check(L, 1, "vis");
const void *func = func_ref_new(L, 2);
int id = vis_motion_register(vis, 0, (void*)func, motion_lua);
int id = vis_motion_register(vis, (void*)func, motion_lua);
lua_pushinteger(L, id);
return 1;
}
Expand Down
3 changes: 1 addition & 2 deletions vis-motions.c
Expand Up @@ -232,14 +232,13 @@ void vis_motion_type(Vis *vis, enum VisMotionType type) {
vis->action.type = type;
}

int vis_motion_register(Vis *vis, enum VisMotionType type, void *data, VisMotionFunction *motion) {
int vis_motion_register(Vis *vis, void *data, VisMotionFunction *motion) {

Movement *move = calloc(1, sizeof *move);
if (!move)
return -1;

move->user = motion;
move->type = type;
move->data = data;

if (array_add_ptr(&vis->motions, move))
Expand Down
2 changes: 1 addition & 1 deletion vis.c
Expand Up @@ -822,11 +822,11 @@ void vis_do(Vis *vis) {
count = 1; /* count should apply to inserted text not motion */
bool repeatable = a->op && !vis->macro_operator && !vis->win->parent;
bool multiple_cursors = view_selections_count(view) > 1;

bool linewise = !(a->type & CHARWISE) && (
a->type & LINEWISE || (a->movement && a->movement->type & LINEWISE) ||
vis->mode == &vis_modes[VIS_MODE_VISUAL_LINE]);


Register *reg = a->reg;
size_t reg_slot = multiple_cursors ? EPOS : 0;
size_t last_reg_slot = reg_slot;
Expand Down
2 changes: 1 addition & 1 deletion vis.h
Expand Up @@ -562,7 +562,7 @@ typedef size_t (VisMotionFunction)(Vis*, Win*, void *context, size_t pos);
* @return Motion ID. Negative values indicate an error, positive ones can be
* used with `vis_motion`.
*/
int vis_motion_register(Vis*, enum VisMotionType, void *context, VisMotionFunction*);
int vis_motion_register(Vis*, void *context, VisMotionFunction*);

/**
* @}
Expand Down

0 comments on commit e34b829

Please sign in to comment.