aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-04-03 18:39:22 +0200
committerMarc André Tanner <mat@brain-dump.org>2015-04-03 23:55:22 +0200
commitca222a7cc0d5a55312d96000a617e11d7a9996a1 (patch)
treee5aee5e31ac06ff8bc81d587687ae874602577d2 /vis.c
parent9915b9fd0b8e59bda9e334eb9485c473b06055c9 (diff)
downloadvis-ca222a7cc0d5a55312d96000a617e11d7a9996a1.tar.gz
vis-ca222a7cc0d5a55312d96000a617e11d7a9996a1.tar.xz
Add option to display relative line numbers
:set rnu Based on a patch by Sebastian Götte.
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/vis.c b/vis.c
index 22b61bb..6a7a4ef 100644
--- a/vis.c
+++ b/vis.c
@@ -1377,6 +1377,7 @@ static bool cmd_set(Filerange *range, enum CmdOpt cmdopt, const char *argv[]) {
OPTION_TABWIDTH,
OPTION_SYNTAX,
OPTION_NUMBER,
+ OPTION_NUMBER_RELATIVE,
};
static OptionDef options[] = {
@@ -1385,6 +1386,7 @@ static bool cmd_set(Filerange *range, enum CmdOpt cmdopt, const char *argv[]) {
[OPTION_TABWIDTH] = { "^(tabwidth|tw)$", OPTION_TYPE_NUMBER },
[OPTION_SYNTAX] = { "^(syntax|syn?)$", OPTION_TYPE_STRING },
[OPTION_NUMBER] = { "^(numbers?|nu)$", OPTION_TYPE_BOOL },
+ [OPTION_NUMBER_RELATIVE] = { "^(relativenumbers?|rnu)$", OPTION_TYPE_BOOL },
};
static bool init = false;
@@ -1474,6 +1476,10 @@ static bool cmd_set(Filerange *range, enum CmdOpt cmdopt, const char *argv[]) {
editor_window_options(vis->win, arg.b ? UI_OPTION_LINE_NUMBERS_ABSOLUTE :
UI_OPTION_LINE_NUMBERS_NONE);
break;
+ case OPTION_NUMBER_RELATIVE:
+ editor_window_options(vis->win, arg.b ? UI_OPTION_LINE_NUMBERS_RELATIVE :
+ UI_OPTION_LINE_NUMBERS_NONE);
+ break;
}
return true;