aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vis-cmds.c5
-rw-r--r--vis-core.h6
-rw-r--r--vis.c13
-rw-r--r--vis.h4
4 files changed, 22 insertions, 6 deletions
diff --git a/vis-cmds.c b/vis-cmds.c
index b69fc21..cdff8c0 100644
--- a/vis-cmds.c
+++ b/vis-cmds.c
@@ -683,6 +683,11 @@ static bool cmd_help(Vis *vis, Win *win, Command *cmd, const char *argv[], Curso
text_appendf(txt, "\n :-Commands\n\n");
map_iterate(vis->cmds, print_cmd, txt);
+ text_appendf(txt, "\n Marks\n\n");
+ text_appendf(txt, " a-z General purpose marks\n");
+ for (size_t i = 0; i < LENGTH(vis_marks); i++)
+ text_appendf(txt, " %c %s\n", vis_marks[i].name, vis_marks[i].help);
+
text_appendf(txt, "\n :set command options\n\n");
for (int i = 0; i < LENGTH(options); i++) {
char names[256];
diff --git a/vis-core.h b/vis-core.h
index 292584b..982cda3 100644
--- a/vis-core.h
+++ b/vis-core.h
@@ -209,12 +209,18 @@ enum VisEvents {
bool vis_event_emit(Vis*, enum VisEvents, ...);
+typedef struct {
+ char name;
+ const char *help;
+} MarkDef;
+
/** stuff used by multiple of the vis-* files */
extern Mode vis_modes[VIS_MODE_INVALID];
extern const Movement vis_motions[VIS_MOVE_INVALID];
extern const Operator vis_operators[VIS_OP_INVALID];
extern const TextObject vis_textobjects[VIS_TEXTOBJECT_INVALID];
+extern const MarkDef vis_marks[VIS_MARK_a];
void macro_operator_stop(Vis *vis);
void macro_operator_record(Vis *vis);
diff --git a/vis.c b/vis.c
index 43534a2..1cd5b8f 100644
--- a/vis.c
+++ b/vis.c
@@ -29,6 +29,11 @@
#include "vis-core.h"
#include "sam.h"
+const MarkDef vis_marks[] = {
+ [VIS_MARK_SELECTION_START] = { '<', "Last selection start" },
+ [VIS_MARK_SELECTION_END] = { '>', "Last selection end" },
+};
+
static Macro *macro_get(Vis *vis, enum VisRegister);
static void macro_replay(Vis *vis, const Macro *macro);
static void vis_keys_push(Vis *vis, const char *input, size_t pos, bool record);
@@ -1262,10 +1267,10 @@ void vis_repeat(Vis *vis) {
enum VisMark vis_mark_from(Vis *vis, char mark) {
if (mark >= 'a' && mark <= 'z')
return VIS_MARK_a + mark - 'a';
- else if (mark == '<')
- return VIS_MARK_SELECTION_START;
- else if (mark == '>')
- return VIS_MARK_SELECTION_END;
+ for (size_t i = 0; i < LENGTH(vis_marks); i++) {
+ if (vis_marks[i].name == mark)
+ return i;
+ }
return VIS_MARK_INVALID;
}
diff --git a/vis.h b/vis.h
index 7d909b5..04d54fb 100644
--- a/vis.h
+++ b/vis.h
@@ -383,14 +383,14 @@ int vis_textobject_register(Vis*, int type, void *data,
enum VisMark {
+ VIS_MARK_SELECTION_START, /* '< */
+ VIS_MARK_SELECTION_END, /* '> */
VIS_MARK_a, VIS_MARK_b, VIS_MARK_c, VIS_MARK_d, VIS_MARK_e,
VIS_MARK_f, VIS_MARK_g, VIS_MARK_h, VIS_MARK_i, VIS_MARK_j,
VIS_MARK_k, VIS_MARK_l, VIS_MARK_m, VIS_MARK_n, VIS_MARK_o,
VIS_MARK_p, VIS_MARK_q, VIS_MARK_r, VIS_MARK_s, VIS_MARK_t,
VIS_MARK_u, VIS_MARK_v, VIS_MARK_w, VIS_MARK_x, VIS_MARK_y,
VIS_MARK_z,
- VIS_MARK_SELECTION_START, /* '< */
- VIS_MARK_SELECTION_END, /* '> */
VIS_MARK_INVALID, /* has to be the last enum member */
};