From ca222a7cc0d5a55312d96000a617e11d7a9996a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Fri, 3 Apr 2015 18:39:22 +0200 Subject: Add option to display relative line numbers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit :set rnu Based on a patch by Sebastian Götte. --- vis.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'vis.c') 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; -- cgit v1.2.3