Skip to content

Instantly share code, notes, and snippets.

@mattn
Created February 24, 2012 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/1899106 to your computer and use it in GitHub Desktop.
Save mattn/1899106 to your computer and use it in GitHub Desktop.
diff -r 9140571d01ab runtime/doc/options.txt
--- a/runtime/doc/options.txt Mon Feb 06 00:13:22 2012 +0100
+++ b/runtime/doc/options.txt Sun Feb 26 22:04:20 2012 +0900
@@ -2961,6 +2961,7 @@
vert:c '|' vertical separators |:vsplit|
fold:c '-' filling 'foldtext'
diff:c '-' deleted lines of the 'diff' option
+ num:c ' ' separator of 'number' option
Any one that is omitted will fall back to the default. For "stl" and
"stlnc" the space will be used when there is highlighting, '^' or '-'
@@ -2980,6 +2981,7 @@
vert:c VertSplit |hl-VertSplit|
fold:c Folded |hl-Folded|
diff:c DiffDelete |hl-DiffDelete|
+ num:c LineNr |hl-LineNr|
*'fkmap'* *'fk'* *'nofkmap'* *'nofk'*
'fkmap' 'fk' boolean (default off) *E198*
diff -r 9140571d01ab runtime/syntax/2html.vim
--- a/runtime/syntax/2html.vim Mon Feb 06 00:13:22 2012 +0100
+++ b/runtime/syntax/2html.vim Sun Feb 26 22:04:20 2012 +0900
@@ -746,6 +746,10 @@
if s:difffillchar == ''
let s:difffillchar = '-'
endif
+let s:numfillchar = &fillchars[matchend(&fillchars, 'num:')]
+if s:numfillchar == ''
+ let s:numfillchar = ' '
+endif
let s:foldId = 0
@@ -792,7 +796,7 @@
" Start the line with the line number.
if s:settings.number_lines
- let s:numcol = repeat(' ', s:margin - 1 - strlen(s:lnum)) . s:lnum . ' '
+ let s:numcol = repeat(' ', s:margin - 1 - strlen(s:lnum)) . s:lnum . s:numfillchar
else
let s:numcol = ""
endif
diff -r 9140571d01ab src/globals.h
--- a/src/globals.h Mon Feb 06 00:13:22 2012 +0100
+++ b/src/globals.h Sun Feb 26 22:04:20 2012 +0900
@@ -1161,6 +1161,7 @@
EXTERN int fill_fold INIT(= '-');
EXTERN int fill_diff INIT(= '-');
#endif
+EXTERN int fill_num INIT(= ' ');
#ifdef FEAT_VISUAL
/* Whether 'keymodel' contains "stopsel" and "startsel". */
diff -r 9140571d01ab src/option.c
--- a/src/option.c Mon Feb 06 00:13:22 2012 +0100
+++ b/src/option.c Sun Feb 26 22:04:20 2012 +0900
@@ -7142,6 +7142,7 @@
{&fill_vert, "vert"},
{&fill_fold, "fold"},
{&fill_diff, "diff"},
+ {&fill_num, "num"},
};
#endif
static struct charstab lcstab[] =
diff -r 9140571d01ab src/screen.c
--- a/src/screen.c Mon Feb 06 00:13:22 2012 +0100
+++ b/src/screen.c Sun Feb 26 22:04:20 2012 +0900
@@ -3483,8 +3483,26 @@
/* 'relativenumber', don't use negative numbers */
num = labs((long)get_cursor_rel_lnum(wp, lnum));
- sprintf((char *)extra, "%*ld ",
- number_width(wp), num);
+ sprintf((char *)extra, "%*ld%c",
+ number_width(wp), num, fill_num);
+ if (wp->w_skipcol > 0)
+ for (p_extra = extra; *p_extra == ' '; ++p_extra)
+ *p_extra = '-';
+#ifdef FEAT_RIGHTLEFT
+ if (wp->w_p_rl) /* reverse line numbers */
+ rl_mirror(extra);
+#endif
+ p_extra = extra;
+ c_extra = NUL;
+ }
+ else if (wp->w_p_nu && fill_num != ' ')
+ {
+ int n;
+ for (n = 0; n < number_width(wp); n++)
+ extra[n] = ' ';
+ extra[n++] = fill_num;
+ extra[n] = 0;
+
if (wp->w_skipcol > 0)
for (p_extra = extra; *p_extra == ' '; ++p_extra)
*p_extra = '-';
@koron
Copy link

koron commented Feb 24, 2012

86, 87行目の else if はなんで2行にまたがってるん?

@koron
Copy link

koron commented Feb 24, 2012

76~78は95以降のコピペみたいだけど…実は79行目以降もそのあとのコピペなのかしら?

だとしたらちょっと気持ち悪いわねぇ。

@mattn
Copy link
Author

mattn commented Feb 24, 2012

1個目のコメントなおした。
2個目、こうしないと速度が落ちそう。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment