summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcos <cos>2018-07-02 09:26:37 +0200
committercos <cos>2018-07-02 09:26:37 +0200
commitd4c0e355c779cb6b91391f7a1133708d1bbfc107 (patch)
tree2cdb0ad98f6b57fa3c57b35aa2d57d076dffd708
parentade55787978e15fe57c5cedf38c9f85bfe1d983c (diff)
downloadvim-d4c0e355c779cb6b91391f7a1133708d1bbfc107.zip
Allow setting 'numberwidth' to 0
Disable printing of line numbers when nuw=0. Allows e.g. uncluttered consistent text alignment when used in combination with 'cpoptions=n', 'showbreak', 'breakindent' and 'breakindentopt=shift:-1'.
-rw-r--r--runtime/doc/options.txt2
-rw-r--r--src/option.c2
-rw-r--r--src/screen.c4
3 files changed, 7 insertions, 1 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 65a9d17ea..ba321c995 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -5621,6 +5621,8 @@ A jump table for the options with a short description can be found at |Q_op|.
is set. Thus with the Vim default of 4 there is room for a line number
up to 999. When the buffer has 1000 lines five columns will be used.
The minimum value is 1, the maximum value is 10.
+ Setting to the special value 0 disables showing line numbers, while
+ maintaining the one space before the buffer text.
NOTE: This option is set to the Vi default value when 'compatible' is
set and to the Vim default value when 'compatible' is reset.
diff --git a/src/option.c b/src/option.c
index 50d42ebf7..e60bbee5f 100644
--- a/src/option.c
+++ b/src/option.c
@@ -9219,7 +9219,7 @@ set_num_option(
/* 'numberwidth' must be positive */
else if (pp == &curwin->w_p_nuw)
{
- if (curwin->w_p_nuw < 1)
+ if (curwin->w_p_nuw < 0)
{
errmsg = e_positive;
curwin->w_p_nuw = 1;
diff --git a/src/screen.c b/src/screen.c
index 954beef95..ebc4b2411 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -3901,6 +3901,7 @@ win_line(
#ifdef FEAT_DIFF
+ filler_lines
#endif
+ && wp->w_p_nuw
)
{
long num;
@@ -11141,6 +11142,9 @@ number_width(win_T *wp)
int n;
linenr_T lnum;
+ if (wp->w_p_nuw == 0)
+ return 0;
+
if (wp->w_p_rnu && !wp->w_p_nu)
/* cursor line shows "0" */
lnum = wp->w_height;