]> git.pld-linux.org Git - packages/vim.git/blob - vim-relativenumber.patch
- new
[packages/vim.git] / vim-relativenumber.patch
1 Index: runtime/doc/quickref.txt
2 ===================================================================
3 *** runtime/doc/quickref.txt    (revision 1159)
4 --- runtime/doc/quickref.txt    (working copy)
5 ***************
6 *** 817,822 ****
7 --- 817,823 ----
8   'pumheight'     'ph'      maximum height of the popup menu
9   'quoteescape'   'qe'      escape characters used in a string
10   'readonly'      'ro'      disallow writing the buffer
11 + 'relativenumber'  'rnu'           print relative line number in front of each line
12   'redrawtime'    'rdt'     timeout for 'hlsearch' and |:match| highlighting
13   'remap'                           allow mappings to work recursively
14   'report'                  threshold for reporting nr. of lines changed
15 Index: runtime/doc/version7.txt
16 ===================================================================
17 *** runtime/doc/version7.txt    (revision 1159)
18 --- runtime/doc/version7.txt    (working copy)
19 ***************
20 *** 638,645 ****
21   'maxmempattern'               maximum amount of memory to use for pattern matching
22   'mkspellmem'          parameters for |:mkspell| memory use
23   'mzquantum'           Time in msec to schedule MzScheme threads.
24 ! 'numberwidth'         Minimal width of the space used for the 'number'
25 !                       option. (Emmanuel Renieris)
26   'omnifunc'            The name of the function used for omni completion.
27   'operatorfunc'                function to be called for |g@| operator
28   'printmbcharset'      CJK character set to be used for :hardcopy
29 --- 638,645 ----
30   'maxmempattern'               maximum amount of memory to use for pattern matching
31   'mkspellmem'          parameters for |:mkspell| memory use
32   'mzquantum'           Time in msec to schedule MzScheme threads.
33 ! 'numberwidth'         Minimal width of the space used for the 'number' and
34 !                       'relativenumber' option. (Emmanuel Renieris)
35   'omnifunc'            The name of the function used for omni completion.
36   'operatorfunc'                function to be called for |g@| operator
37   'printmbcharset'      CJK character set to be used for :hardcopy
38 Index: runtime/doc/options.txt
39 ===================================================================
40 *** runtime/doc/options.txt     (revision 1159)
41 --- runtime/doc/options.txt     (working copy)
42 ***************
43 *** 1874,1881 ****
44                         parenthesis match.  When included "%" ignores
45                         backslashes, which is Vi compatible.
46                                                                 *cpo-n*
47 !               n       When included, the column used for 'number' will also
48 !                       be used for text of wrapped lines.
49                                                                 *cpo-o*
50                 o       Line offset to search command is not remembered for
51                         next search.
52 --- 1874,1882 ----
53                         parenthesis match.  When included "%" ignores
54                         backslashes, which is Vi compatible.
55                                                                 *cpo-n*
56 !               n       When included, the column used for 'number' and
57 !                       'relativenumber' will also be used for text of wrapped
58 !                       lines.
59                                                                 *cpo-o*
60                 o       Line offset to search command is not remembered for
61                         next search.
62 ***************
63 *** 3577,3583 ****
64         |hl-Search|      l  last search pattern highlighting (see 'hlsearch')
65         |hl-MoreMsg|     m  |more-prompt|
66         |hl-ModeMsg|     M  Mode (e.g., "-- INSERT --")
67 !       |hl-LineNr|      n  line number for ":number" and ":#" commands
68         |hl-Question|    r  |hit-enter| prompt and yes/no questions
69         |hl-StatusLine|  s  status line of current window |status-line|
70         |hl-StatusLineNC| S  status lines of not-current windows
71 --- 3578,3585 ----
72         |hl-Search|      l  last search pattern highlighting (see 'hlsearch')
73         |hl-MoreMsg|     m  |more-prompt|
74         |hl-ModeMsg|     M  Mode (e.g., "-- INSERT --")
75 !       |hl-LineNr|      n  line number for ":number" and ":#" commands, and
76 !                           when 'number' or 'relativenumber' option is set.
77         |hl-Question|    r  |hit-enter| prompt and yes/no questions
78         |hl-StatusLine|  s  status line of current window |status-line|
79         |hl-StatusLineNC| S  status lines of not-current windows
80 ***************
81 *** 4834,4839 ****
82 --- 4836,4842 ----
83         When a long, wrapped line doesn't start with the first character, '-'
84         characters are put before the number.
85         See |hl-LineNr| for the highlighting used for the number.
86 +       When setting this option, 'relativenumber' is being reset.
87   
88                                                 *'numberwidth'* *'nuw'*
89   'numberwidth' 'nuw'   number  (Vim default: 4  Vi default: 8)
90 ***************
91 *** 4842,4854 ****
92                         {only available when compiled with the |+linebreak|
93                         feature}
94         Minimal number of columns to use for the line number.  Only relevant
95 !       when the 'number' option is set or printing lines with a line number.
96 !       Since one space is always between the number and the text, there is
97 !       one less character for the number itself.
98         The value is the minimum width.  A bigger width is used when needed to
99 !       fit the highest line number in the buffer.  Thus with the Vim default
100 !       of 4 there is room for a line number up to 999.  When the buffer has
101 !       1000 lines five columns will be used.
102         The minimum value is 1, the maximum value is 10.
103         NOTE: 'numberwidth' is reset to 8 when 'compatible' is set.
104   
105 --- 4845,4858 ----
106                         {only available when compiled with the |+linebreak|
107                         feature}
108         Minimal number of columns to use for the line number.  Only relevant
109 !       when the 'number' or 'relativenumber' option is set or printing lines
110 !       with a line number. Since one space is always between the number and
111 !       the text, there is one less character for the number itself.
112         The value is the minimum width.  A bigger width is used when needed to
113 !       fit the highest line number in the buffer respectively the number of
114 !       rows in the window, depending on whether 'number' or 'relativenumber'
115 !       is set. Thus with the Vim default of 4 there is room for a line number
116 !       up to 999. When the buffer has 1000 lines five columns will be used.
117         The minimum value is 1, the maximum value is 10.
118         NOTE: 'numberwidth' is reset to 8 when 'compatible' is set.
119   
120 ***************
121 *** 5222,5227 ****
122 --- 5226,5250 ----
123         matches will be highlighted.  This is used to avoid that Vim hangs
124         when using a very complicated pattern.
125   
126 +               *'relativenumber'* *'rnu'* *'norelativenumber'* *'nornu'*
127 + 'relativenumber' 'rnu'        boolean (default off)
128 +                       local to window
129 +                       {not in Vi}
130 +       Print the line number relative to the line with the cursor in front of
131 +       each line. Relative line numbers help you using the |count| you can
132 +       precede some vertival motion commands (e.g. j k + -) with, without
133 +       having to calculate it by yourself. Especially useful in combination
134 +       with other commands (e.g. y d c < > gq gw =).
135 +       When the 'n' option is excluded from 'cpoptions' a wrapped
136 +       line will not use the column of line numbers (this is the default when
137 +       'compatible' isn't set).
138 +       The 'numberwidth' option can be used to set the room used for the line
139 +       number.
140 +       When a long, wrapped line doesn't start with the first character, '-'
141 +       characters are put before the number.
142 +       See |hl-LineNr| for the highlighting used for the number.
143 +       When setting this option, 'number' is being reset.
144
145                                                 *'remap'* *'noremap'*
146   'remap'                       boolean (default on)
147                         global
148 Index: runtime/doc/syntax.txt
149 ===================================================================
150 *** runtime/doc/syntax.txt      (revision 1159)
151 --- runtime/doc/syntax.txt      (working copy)
152 ***************
153 *** 4154,4160 ****
154                 ":s///c"
155                                                         *hl-LineNr*
156   LineNr                Line number for ":number" and ":#" commands, and when 'number'
157 !               option is set.
158                                                         *hl-MatchParen*
159   MatchParen    The character under the cursor or just before it, if it
160                 is a paired bracket, and its match. |pi_paren.txt|
161 --- 4154,4160 ----
162                 ":s///c"
163                                                         *hl-LineNr*
164   LineNr                Line number for ":number" and ":#" commands, and when 'number'
165 !               or 'relativenumber' option is set.
166                                                         *hl-MatchParen*
167   MatchParen    The character under the cursor or just before it, if it
168                 is a paired bracket, and its match. |pi_paren.txt|
169 Index: runtime/doc/tags
170 ===================================================================
171 *** runtime/doc/tags    (revision 1159)
172 --- runtime/doc/tags    (working copy)
173 ***************
174 *** 557,562 ****
175 --- 557,563 ----
176   'noprompt'    options.txt     /*'noprompt'*
177   'nopvw'       options.txt     /*'nopvw'*
178   'noreadonly'  options.txt     /*'noreadonly'*
179 + 'norelativenumber'    options.txt     /*'norelativenumber'*
180   'noremap'     options.txt     /*'noremap'*
181   'norestorescreen'     options.txt     /*'norestorescreen'*
182   'norevins'    options.txt     /*'norevins'*
183 ***************
184 *** 565,570 ****
185 --- 566,572 ----
186   'norightleftcmd'      options.txt     /*'norightleftcmd'*
187   'norl'        options.txt     /*'norl'*
188   'norlc'       options.txt     /*'norlc'*
189 + 'nornu'       options.txt     /*'nornu'*
190   'noro'        options.txt     /*'noro'*
191   'nors'        options.txt     /*'nors'*
192   'noru'        options.txt     /*'noru'*
193 ***************
194 *** 706,711 ****
195 --- 708,714 ----
196   'readonly'    options.txt     /*'readonly'*
197   'redraw'      vi_diff.txt     /*'redraw'*
198   'redrawtime'  options.txt     /*'redrawtime'*
199 + 'relativenumber'      options.txt     /*'relativenumber'*
200   'remap'       options.txt     /*'remap'*
201   'report'      options.txt     /*'report'*
202   'restorescreen'       options.txt     /*'restorescreen'*
203 ***************
204 *** 715,720 ****
205 --- 718,724 ----
206   'rightleftcmd'        options.txt     /*'rightleftcmd'*
207   'rl'  options.txt     /*'rl'*
208   'rlc' options.txt     /*'rlc'*
209 + 'rnu' options.txt     /*'rnu'*
210   'ro'  options.txt     /*'ro'*
211   'rs'  options.txt     /*'rs'*
212   'rtp' options.txt     /*'rtp'*
213 Index: runtime/lang/menu_de_de.latin1.vim
214 ===================================================================
215 *** runtime/lang/menu_de_de.latin1.vim  (revision 1159)
216 --- runtime/lang/menu_de_de.latin1.vim  (working copy)
217 ***************
218 *** 84,96 ****
219   menutrans F&ile\ Settings                             &Datei-Einstellungen
220   
221   " Boolean options
222 ! menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu!      Anzeige\ der\ Zeilen&nummer\ ein-\ und\ ausschalten<Tab>:set\ nu!
223 ! menutrans Toggle\ &List\ Mode<Tab>:set\ list!         &List-Modus\ ein-\ und\ ausschalten<Tab>:set\ list!
224 ! menutrans Toggle\ Line\ &Wrap<Tab>:set\ wrap!         &Zeilenumbruch\ ein-\ und\ ausschalten<Tab>:set\ wrap!
225 ! menutrans Toggle\ W&rap\ at\ word<Tab>:set\ lbr!      Umbruch\ an\ &Wortgrenzen\ ein-\ und\ ausschalten<Tab>:set\ lbr!
226 ! menutrans Toggle\ &expand-tab<Tab>:set\ et!           &Erweiterung\ von\ Tabulatoren\ ein-\ und\ ausschalten<Tab>:set\ et!
227 ! menutrans Toggle\ &auto-indent<Tab>:set\ ai!          &Automatische\ Einrückung\ ein-\ und\ ausschalten<Tab>:set\ ai!
228 ! menutrans Toggle\ &C-indenting<Tab>:set\ cin!         &C-Einrückung\ ein-\ und\ ausschalten<Tab>:set\ cin!
229   
230   " other options
231   menutrans &Shiftwidth                                 &Schiebeweite
232 --- 84,97 ----
233   menutrans F&ile\ Settings                             &Datei-Einstellungen
234   
235   " Boolean options
236 ! menutrans Toggle\ Line\ &Numbering<Tab>:set\ nu!              Anzeige\ der\ Zeilen&nummer\ ein-\ und\ ausschalten<Tab>:set\ nu!
237 ! menutrans Toggle\ relati&ve\ Line\ Numbering<Tab>:set\ rnu!   Anzeige\ der\ relati&ven\ Zeilennummer\ ein-\ und\ ausschalten<Tab>:set\ rnu!
238 ! menutrans Toggle\ &List\ Mode<Tab>:set\ list!                 &List-Modus\ ein-\ und\ ausschalten<Tab>:set\ list!
239 ! menutrans Toggle\ Line\ &Wrap<Tab>:set\ wrap!                 &Zeilenumbruch\ ein-\ und\ ausschalten<Tab>:set\ wrap!
240 ! menutrans Toggle\ W&rap\ at\ word<Tab>:set\ lbr!              Umbruch\ an\ &Wortgrenzen\ ein-\ und\ ausschalten<Tab>:set\ lbr!
241 ! menutrans Toggle\ &expand-tab<Tab>:set\ et!                   &Erweiterung\ von\ Tabulatoren\ ein-\ und\ ausschalten<Tab>:set\ et!
242 ! menutrans Toggle\ &auto-indent<Tab>:set\ ai!                  &Automatische\ Einrückung\ ein-\ und\ ausschalten<Tab>:set\ ai!
243 ! menutrans Toggle\ &C-indenting<Tab>:set\ cin!                 &C-Einrückung\ ein-\ und\ ausschalten<Tab>:set\ cin!
244   
245   " other options
246   menutrans &Shiftwidth                                 &Schiebeweite
247 Index: runtime/syntax/vim.vim
248 ===================================================================
249 *** runtime/syntax/vim.vim      (revision 1159)
250 --- runtime/syntax/vim.vim      (working copy)
251 ***************
252 *** 30,46 ****
253   syn keyword vimOption contained       al antialias autochdir background balloondelay bexpr bk bs casemap cfu cinkeys cmdwinheight commentstring conskey cscopepathcomp csprg cursorcolumn delcombine diffopt ea efm ep et fdc fdo ffs fk foldcolumn foldmethod formatoptions gd go guifont guitabtooltip hid hkp iconstring imd include inex isi js kp linebreak lm lz matchpairs maxmemtot mkspellmem mod mousef mouset nf oft pa path pheader previewheight printmbcharset pvw report rlc ruler sc scrolloff sel shcf shellslash shm showmatch sidescrolloff smartindent softtabstop spellfile splitright ssl statusline suffixes swf syntax tagbsearch tb term textwidth timeoutlen tm tr ttm ttyscroll undolevels vdir viewdir wa wd wi wildmode winfixwidth wiw wrap writedelay
254   syn keyword vimOption contained       aleph ar autoindent backspace ballooneval bg bkc bsdir cb ch cino cmp compatible copyindent cscopeprg csqf cursorline dex digraph ead ei equalalways eventignore fde fdt fileencoding fkmap foldenable foldminlines formatprg gdefault gp guifontset helpfile hidden hl ignorecase imdisable includeexpr inf isident key langmap lines lmap ma matchtime mco ml modeline mousefocus mousetime nrformats ofu para pdev pi previewwindow printmbfont qe restorescreen ro rulerformat scb scrollopt selection shell shelltemp shortmess showmode siso smarttab sol spelllang spr ssop stl suffixesadd switchbuf ta taglength tbi termbidi tf title to ts tty ttytype updatecount ve viewoptions wak weirdinvert wig wildoptions winheight wm wrapmargin ws
255   syn keyword vimOption contained       allowrevins arab autoread backup balloonexpr bh bl bsk ccv charconvert cinoptions cms complete cot cscopequickfix cst cwh dg dip eadirection ek equalprg ex fdi fen fileencodings flp foldexpr foldnestmax fp gfm grepformat guifontwide helpheight highlight hlg im imi incsearch infercase isk keymap langmenu linespace loadplugins macatsui maxcombine mef mls modelines mousehide mp nu omnifunc paragraphs penc pm printdevice printoptions quoteescape revins rs runtimepath scr scs selectmode shellcmdflag shelltype shortname showtabline sj smc sp spellsuggest sps st stmp sw sws tabline tagrelative tbidi termencoding tgst titlelen toolbar tsl ttybuiltin tw updatetime verbose viminfo warn wfh wildchar wim winminheight wmh wrapscan ww
256 ! syn keyword vimOption contained       altkeymap arabic autowrite backupcopy bdir bin bomb bt cd ci cinw co completefunc cp cscopetag csto debug dict dir eb enc errorbells expandtab fdl fenc fileformat fml foldignore foldopen fs gfn grepprg guiheadroom helplang history hls imactivatekey iminsert inde insertmode iskeyword keymodel laststatus lisp lpl magic maxfuncdepth menuitems mm modifiable mousem mps number opendevice paste pex pmbcs printencoding prompt rdt ri 
257   
258   " vimOptions: These are the turn-off setting variants {{{2
259   syn keyword vimOption contained       noacd noallowrevins noantialias noarabic noarshape noautoread noaw noballooneval nobinary nobk nobuflisted nocin noconfirm nocopyindent nocscopeverbose nocuc nocursorline nodg nodisable noeb noedcompatible noendofline noequalalways noesckeys noex noexrc nofk nofoldenable nogdefault nohid nohk nohkmapp nohls noic noignorecase noimc noimd noinf noinsertmode nojoinspaces nolazyredraw nolinebreak nolist nolpl noma nomagic noml nomodeline nomodified nomousef nomousehide nonumber noopendevice nopi nopreviewwindow nopvw noremap norevins norightleft norl noro noru nosb noscb noscs nosft noshelltemp noshortname noshowfulltag noshowmode nosm nosmartindent nosmd nosol nosplitbelow nospr nossl nostartofline noswapfile nota notagrelative notbi notbs noterse notextmode notgst notimeout noto notr nottybuiltin notx novisualbell nowarn noweirdinvert nowfw nowinfixheight nowiv nowrap nowrite nowritebackup
260   syn keyword vimOption contained       noai noaltkeymap noar noarabicshape noautochdir noautowrite noawa nobeval nobiosk nobl nocf nocindent noconsk nocp nocst nocul nodeco nodiff noea noed noek noeol noerrorbells noet noexpandtab nofen nofkmap nogd noguipty nohidden nohkmap nohkp nohlsearch noicon noim noimcmdline noincsearch noinfercase nois nojs nolbr nolisp noloadplugins nolz nomacatsui nomh nomod nomodifiable nomore nomousefocus nonu noodev nopaste nopreserveindent noprompt noreadonly norestorescreen nori norightleftcmd norlc nors noruler nosc noscrollbind nosecure noshellslash noshiftround noshowcmd noshowmatch nosi nosmartcase nosmarttab nosn nospell nosplitright nosr nosta nostmp noswf notagbsearch notagstack notbidi notermbidi notextauto notf notildeop notitle notop nottimeout nottyfast novb nowa nowb nowfh nowildmenu nowinfixwidth nowmnu nowrapscan nowriteany nows
261 ! syn keyword vimOption contained       noakm noanti noarab noari noautoindent noautowriteall nobackup nobin nobioskey nobomb noci nocompatible noconskey nocscopetag nocsverb nocursorcolumn nodelcombine nodigraph 
262   
263   " vimOptions: These are the invertible variants {{{2
264   syn keyword vimOption contained       invacd invallowrevins invantialias invarabic invarshape invautoread invaw invballooneval invbinary invbk invbuflisted invcin invconfirm invcopyindent invcscopeverbose invcuc invcursorline invdg invdisable inveb invedcompatible invendofline invequalalways invesckeys invex invexrc invfk invfoldenable invgdefault invhid invhk invhkmapp invhls invic invignorecase invimc invimd invinf invinsertmode invjoinspaces invlazyredraw invlinebreak invlist invlpl invma invmagic invml invmodeline invmodified invmousef invmousehide invnumber invopendevice invpi invpreviewwindow invpvw invremap invrevins invrightleft invrl invro invru invsb invscb invscs invsft invshelltemp invshortname invshowfulltag invshowmode invsm invsmartindent invsmd invsol invsplitbelow invspr invssl invstartofline invswapfile invta invtagrelative invtbi invtbs invterse invtextmode invtgst invtimeout invto invtr invttybuiltin invtx invvisualbell invwarn invweirdinvert invwfw invwinfixheight invwiv invwrap invwrite invwritebackup
265   syn keyword vimOption contained       invai invaltkeymap invar invarabicshape invautochdir invautowrite invawa invbeval invbiosk invbl invcf invcindent invconsk invcp invcst invcul invdeco invdiff invea inved invek inveol inverrorbells invet invexpandtab invfen invfkmap invgd invguipty invhidden invhkmap invhkp invhlsearch invicon invim invimcmdline invincsearch invinfercase invis invjs invlbr invlisp invloadplugins invlz invmacatsui invmh invmod invmodifiable invmore invmousefocus invnu invodev invpaste invpreserveindent invprompt invreadonly invrestorescreen invri invrightleftcmd invrlc invrs invruler invsc invscrollbind invsecure invshellslash invshiftround invshowcmd invshowmatch invsi invsmartcase invsmarttab invsn invspell invsplitright invsr invsta invstmp invswf invtagbsearch invtagstack invtbidi invtermbidi invtextauto invtf invtildeop invtitle invtop invttimeout invttyfast invvb invwa invwb invwfh invwildmenu invwinfixwidth invwmnu invwrapscan invwriteany invws
266 ! syn keyword vimOption contained       invakm invanti invarab invari invautoindent invautowriteall invbackup invbin invbioskey invbomb invci invcompatible invconskey invcscopetag invcsverb invcursorcolumn invdelcombine invdigraph 
267   
268   " termcap codes (which can also be set) {{{2
269   syn keyword vimOption contained       t_AB t_al t_bc t_ce t_cl t_Co t_cs t_Cs t_CS t_CV t_da t_db t_dl t_DL t_EI t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_fs t_IE t_IS t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_ke t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RI t_RV t_Sb t_se t_Sf t_SI t_so t_sr t_te t_ti t_ts t_ue t_us t_ut t_vb t_ve t_vi t_vs t_WP t_WS t_xs t_ZH t_ZR
270 --- 30,46 ----
271   syn keyword vimOption contained       al antialias autochdir background balloondelay bexpr bk bs casemap cfu cinkeys cmdwinheight commentstring conskey cscopepathcomp csprg cursorcolumn delcombine diffopt ea efm ep et fdc fdo ffs fk foldcolumn foldmethod formatoptions gd go guifont guitabtooltip hid hkp iconstring imd include inex isi js kp linebreak lm lz matchpairs maxmemtot mkspellmem mod mousef mouset nf oft pa path pheader previewheight printmbcharset pvw report rlc ruler sc scrolloff sel shcf shellslash shm showmatch sidescrolloff smartindent softtabstop spellfile splitright ssl statusline suffixes swf syntax tagbsearch tb term textwidth timeoutlen tm tr ttm ttyscroll undolevels vdir viewdir wa wd wi wildmode winfixwidth wiw wrap writedelay
272   syn keyword vimOption contained       aleph ar autoindent backspace ballooneval bg bkc bsdir cb ch cino cmp compatible copyindent cscopeprg csqf cursorline dex digraph ead ei equalalways eventignore fde fdt fileencoding fkmap foldenable foldminlines formatprg gdefault gp guifontset helpfile hidden hl ignorecase imdisable includeexpr inf isident key langmap lines lmap ma matchtime mco ml modeline mousefocus mousetime nrformats ofu para pdev pi previewwindow printmbfont qe restorescreen ro rulerformat scb scrollopt selection shell shelltemp shortmess showmode siso smarttab sol spelllang spr ssop stl suffixesadd switchbuf ta taglength tbi termbidi tf title to ts tty ttytype updatecount ve viewoptions wak weirdinvert wig wildoptions winheight wm wrapmargin ws
273   syn keyword vimOption contained       allowrevins arab autoread backup balloonexpr bh bl bsk ccv charconvert cinoptions cms complete cot cscopequickfix cst cwh dg dip eadirection ek equalprg ex fdi fen fileencodings flp foldexpr foldnestmax fp gfm grepformat guifontwide helpheight highlight hlg im imi incsearch infercase isk keymap langmenu linespace loadplugins macatsui maxcombine mef mls modelines mousehide mp nu omnifunc paragraphs penc pm printdevice printoptions quoteescape revins rs runtimepath scr scs selectmode shellcmdflag shelltype shortname showtabline sj smc sp spellsuggest sps st stmp sw sws tabline tagrelative tbidi termencoding tgst titlelen toolbar tsl ttybuiltin tw updatetime verbose viminfo warn wfh wildchar wim winminheight wmh wrapscan ww
274 ! syn keyword vimOption contained       altkeymap arabic autowrite backupcopy bdir bin bomb bt cd ci cinw co completefunc cp cscopetag csto debug dict dir eb enc errorbells expandtab fdl fenc fileformat fml foldignore foldopen fs gfn grepprg guiheadroom helplang history hls imactivatekey iminsert inde insertmode iskeyword keymodel laststatus lisp lpl magic maxfuncdepth menuitems mm modifiable mousem mps number opendevice paste pex pmbcs printencoding prompt rdt ri relativenumber rnu
275   
276   " vimOptions: These are the turn-off setting variants {{{2
277   syn keyword vimOption contained       noacd noallowrevins noantialias noarabic noarshape noautoread noaw noballooneval nobinary nobk nobuflisted nocin noconfirm nocopyindent nocscopeverbose nocuc nocursorline nodg nodisable noeb noedcompatible noendofline noequalalways noesckeys noex noexrc nofk nofoldenable nogdefault nohid nohk nohkmapp nohls noic noignorecase noimc noimd noinf noinsertmode nojoinspaces nolazyredraw nolinebreak nolist nolpl noma nomagic noml nomodeline nomodified nomousef nomousehide nonumber noopendevice nopi nopreviewwindow nopvw noremap norevins norightleft norl noro noru nosb noscb noscs nosft noshelltemp noshortname noshowfulltag noshowmode nosm nosmartindent nosmd nosol nosplitbelow nospr nossl nostartofline noswapfile nota notagrelative notbi notbs noterse notextmode notgst notimeout noto notr nottybuiltin notx novisualbell nowarn noweirdinvert nowfw nowinfixheight nowiv nowrap nowrite nowritebackup
278   syn keyword vimOption contained       noai noaltkeymap noar noarabicshape noautochdir noautowrite noawa nobeval nobiosk nobl nocf nocindent noconsk nocp nocst nocul nodeco nodiff noea noed noek noeol noerrorbells noet noexpandtab nofen nofkmap nogd noguipty nohidden nohkmap nohkp nohlsearch noicon noim noimcmdline noincsearch noinfercase nois nojs nolbr nolisp noloadplugins nolz nomacatsui nomh nomod nomodifiable nomore nomousefocus nonu noodev nopaste nopreserveindent noprompt noreadonly norestorescreen nori norightleftcmd norlc nors noruler nosc noscrollbind nosecure noshellslash noshiftround noshowcmd noshowmatch nosi nosmartcase nosmarttab nosn nospell nosplitright nosr nosta nostmp noswf notagbsearch notagstack notbidi notermbidi notextauto notf notildeop notitle notop nottimeout nottyfast novb nowa nowb nowfh nowildmenu nowinfixwidth nowmnu nowrapscan nowriteany nows
279 ! syn keyword vimOption contained       noakm noanti noarab noari noautoindent noautowriteall nobackup nobin nobioskey nobomb noci nocompatible noconskey nocscopetag nocsverb nocursorcolumn nodelcombine nodigraph norelativenumber nornu
280   
281   " vimOptions: These are the invertible variants {{{2
282   syn keyword vimOption contained       invacd invallowrevins invantialias invarabic invarshape invautoread invaw invballooneval invbinary invbk invbuflisted invcin invconfirm invcopyindent invcscopeverbose invcuc invcursorline invdg invdisable inveb invedcompatible invendofline invequalalways invesckeys invex invexrc invfk invfoldenable invgdefault invhid invhk invhkmapp invhls invic invignorecase invimc invimd invinf invinsertmode invjoinspaces invlazyredraw invlinebreak invlist invlpl invma invmagic invml invmodeline invmodified invmousef invmousehide invnumber invopendevice invpi invpreviewwindow invpvw invremap invrevins invrightleft invrl invro invru invsb invscb invscs invsft invshelltemp invshortname invshowfulltag invshowmode invsm invsmartindent invsmd invsol invsplitbelow invspr invssl invstartofline invswapfile invta invtagrelative invtbi invtbs invterse invtextmode invtgst invtimeout invto invtr invttybuiltin invtx invvisualbell invwarn invweirdinvert invwfw invwinfixheight invwiv invwrap invwrite invwritebackup
283   syn keyword vimOption contained       invai invaltkeymap invar invarabicshape invautochdir invautowrite invawa invbeval invbiosk invbl invcf invcindent invconsk invcp invcst invcul invdeco invdiff invea inved invek inveol inverrorbells invet invexpandtab invfen invfkmap invgd invguipty invhidden invhkmap invhkp invhlsearch invicon invim invimcmdline invincsearch invinfercase invis invjs invlbr invlisp invloadplugins invlz invmacatsui invmh invmod invmodifiable invmore invmousefocus invnu invodev invpaste invpreserveindent invprompt invreadonly invrestorescreen invri invrightleftcmd invrlc invrs invruler invsc invscrollbind invsecure invshellslash invshiftround invshowcmd invshowmatch invsi invsmartcase invsmarttab invsn invspell invsplitright invsr invsta invstmp invswf invtagbsearch invtagstack invtbidi invtermbidi invtextauto invtf invtildeop invtitle invtop invttimeout invttyfast invvb invwa invwb invwfh invwildmenu invwinfixwidth invwmnu invwrapscan invwriteany invws
284 ! syn keyword vimOption contained       invakm invanti invarab invari invautoindent invautowriteall invbackup invbin invbioskey invbomb invci invcompatible invconskey invcscopetag invcsverb invcursorcolumn invdelcombine invdigraph invrelativenumber invrnu
285   
286   " termcap codes (which can also be set) {{{2
287   syn keyword vimOption contained       t_AB t_al t_bc t_ce t_cl t_Co t_cs t_Cs t_CS t_CV t_da t_db t_dl t_DL t_EI t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_fs t_IE t_IS t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_ke t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RI t_RV t_Sb t_se t_Sf t_SI t_so t_sr t_te t_ti t_ts t_ue t_us t_ut t_vb t_ve t_vi t_vs t_WP t_WS t_xs t_ZH t_ZR
288 Index: runtime/menu.vim
289 ===================================================================
290 *** runtime/menu.vim    (revision 1159)
291 --- runtime/menu.vim    (working copy)
292 ***************
293 *** 275,280 ****
294 --- 275,281 ----
295   
296   " Boolean options
297   an 20.440.100 &Edit.F&ile\ Settings.Toggle\ Line\ &Numbering<Tab>:set\ nu!    :set nu! nu?<CR>
298 + an 20.440.105 &Edit.F&ile\ Settings.Toggle\ relati&ve\ Line\ Numbering<Tab>:set\ rnu! :set rnu! rnu?<CR>
299   an 20.440.110 &Edit.F&ile\ Settings.Toggle\ &List\ Mode<Tab>:set\ list!       :set list! list?<CR>
300   an 20.440.120 &Edit.F&ile\ Settings.Toggle\ Line\ &Wrap<Tab>:set\ wrap!       :set wrap! wrap?<CR>
301   an 20.440.130 &Edit.F&ile\ Settings.Toggle\ W&rap\ at\ word<Tab>:set\ lbr!    :set lbr! lbr?<CR>
302 Index: runtime/optwin.vim
303 ===================================================================
304 *** runtime/optwin.vim  (revision 1159)
305 --- runtime/optwin.vim  (working copy)
306 ***************
307 *** 365,370 ****
308 --- 365,373 ----
309   call append("$", "number\tshow the line number for each line")
310   call append("$", "\t(local to window)")
311   call <SID>BinOptionL("nu")
312 + call append("$", "relativenumber\tshow the relative line number for each line")
313 + call append("$", "\t(local to window)")
314 + call <SID>BinOptionL("rnu")
315   if has("linebreak")
316     call append("$", "numberwidth\tnumber of columns to use for the line number")
317     call append("$", "\t(local to window)")
318 Index: src/proto/misc2.pro
319 ===================================================================
320 *** src/proto/misc2.pro (revision 1159)
321 --- src/proto/misc2.pro (working copy)
322 ***************
323 *** 11,16 ****
324 --- 11,17 ----
325   int dec_cursor __ARGS((void));
326   int dec __ARGS((pos_T *lp));
327   int decl __ARGS((pos_T *lp));
328 + linenr_T get_cursor_rel_lnum __ARGS((win_T *wp, linenr_T lnum));
329   void check_cursor_lnum __ARGS((void));
330   void check_cursor_col __ARGS((void));
331   void check_cursor __ARGS((void));
332 Index: src/edit.c
333 ===================================================================
334 *** src/edit.c  (revision 1159)
335 --- src/edit.c  (working copy)
336 ***************
337 *** 6165,6171 ****
338                     )
339             textwidth -= 1;
340   #endif
341 !       if (curwin->w_p_nu)
342             textwidth -= 8;
343       }
344       if (textwidth < 0)
345 --- 6165,6171 ----
346                     )
347             textwidth -= 1;
348   #endif
349 !       if (curwin->w_p_nu || curwin->w_p_rnu)
350             textwidth -= 8;
351       }
352       if (textwidth < 0)
353 Index: src/ex_cmds.c
354 ===================================================================
355 *** src/ex_cmds.c       (revision 1159)
356 --- src/ex_cmds.c       (working copy)
357 ***************
358 *** 3472,3477 ****
359 --- 3472,3478 ----
360         curbuf->b_p_ma = FALSE;         /* not modifiable */
361         curbuf->b_p_bin = FALSE;        /* reset 'bin' before reading file */
362         curwin->w_p_nu = 0;             /* no line numbers */
363 +       curwin->w_p_rnu = 0;            /* no relative line numbers */
364   #ifdef FEAT_SCROLLBIND
365         curwin->w_p_scb = FALSE;        /* no scroll binding */
366   #endif
367 Index: src/gui.c
368 ===================================================================
369 *** src/gui.c   (revision 1159)
370 --- src/gui.c   (working copy)
371 ***************
372 *** 4362,4368 ****
373         max += W_WIDTH(curwin) - 1;
374   #endif
375         /* The line number isn't scrolled, thus there is less space when
376 !        * 'number' is set (also for 'foldcolumn'). */
377         size -= curwin_col_off();
378   #ifndef SCROLL_PAST_END
379         max -= curwin_col_off();
380 --- 4362,4368 ----
381         max += W_WIDTH(curwin) - 1;
382   #endif
383         /* The line number isn't scrolled, thus there is less space when
384 !        * 'number' or 'relativenumber' is set (also for 'foldcolumn'). */
385         size -= curwin_col_off();
386   #ifndef SCROLL_PAST_END
387         max -= curwin_col_off();
388 Index: src/misc1.c
389 ===================================================================
390 *** src/misc1.c (revision 1159)
391 --- src/misc1.c (working copy)
392 ***************
393 *** 1740,1746 ****
394         col += 1;
395   
396       /*
397 !      * Add column offset for 'number' and 'foldcolumn'.
398        */
399       width = W_WIDTH(wp) - win_col_off(wp);
400       if (width <= 0)
401 --- 1740,1746 ----
402         col += 1;
403   
404       /*
405 !      * Add column offset for 'number', 'relativenumber' and 'foldcolumn'.
406        */
407       width = W_WIDTH(wp) - win_col_off(wp);
408       if (width <= 0)
409 ***************
410 *** 1801,1807 ****
411         col += win_lbr_chartabsize(wp, s, (colnr_T)col, NULL) - 1;
412   
413       /*
414 !      * Add column offset for 'number', 'foldcolumn', etc.
415        */
416       width = W_WIDTH(wp) - win_col_off(wp);
417       if (width <= 0)
418 --- 1801,1807 ----
419         col += win_lbr_chartabsize(wp, s, (colnr_T)col, NULL) - 1;
420   
421       /*
422 !      * Add column offset for 'number', 'relativenumber', 'foldcolumn', etc.
423        */
424       width = W_WIDTH(wp) - win_col_off(wp);
425       if (width <= 0)
426 Index: src/misc2.c
427 ===================================================================
428 *** src/misc2.c (revision 1159)
429 --- src/misc2.c (working copy)
430 ***************
431 *** 469,474 ****
432 --- 469,525 ----
433   }
434   
435   /*
436 +  * Get the line number relative to the actual cursor position, i.e. the
437 +  * difference between line number and cursor position. Only look for lines that
438 +  * can be visible, folded lines don't count.
439 +  */
440 +     linenr_T
441 + get_cursor_rel_lnum(wp, lnum)
442 +     win_T     *wp;
443 +     linenr_T  lnum;               /* line number to get the result for */
444 + {
445 +     linenr_T  cursor = wp->w_cursor.lnum;
446 +     linenr_T  retval = 0;
447
448 + #ifdef FEAT_FOLDING
449 +     if (hasAnyFolding(wp))
450 +     {
451 +       if (lnum > cursor)
452 +       {
453 +           while (lnum > cursor)
454 +           {
455 +               (void)hasFolding(lnum, &lnum, NULL);
456 +               /* if lnum and cursor are in the same fold,
457 +                * now lnum <= cursor */
458 +               if (lnum > cursor)
459 +                   retval++;
460 +               lnum--;
461 +           }
462 +       }
463 +       else if (lnum < cursor)
464 +       {
465 +           while (lnum < cursor)
466 +           {
467 +               (void)hasFolding(lnum, NULL, &lnum);
468 +               /* if lnum and cursor are in the same fold,
469 +                * now lnum >= cursor */
470 +               if (lnum < cursor)
471 +                   retval--;
472 +               lnum++;
473 +           }
474 +       }
475 +       /* else if (lnum == cursor)
476 +        *     retval = 0;
477 +        */
478 +     }
479 +     else
480 + #endif
481 +       retval = lnum - cursor;
482
483 +     return retval;
484 + }
485
486 + /*
487    * Make sure curwin->w_cursor.lnum is valid.
488    */
489       void
490 Index: src/move.c
491 ===================================================================
492 *** src/move.c  (revision 1159)
493 --- src/move.c  (working copy)
494 ***************
495 *** 910,923 ****
496   }
497   
498   /*
499 !  * Compute offset of a window, occupied by line number, fold column and sign
500 !  * column (these don't move when scrolling horizontally).
501    */
502       int
503   win_col_off(wp)
504       win_T     *wp;
505   {
506 !     return ((wp->w_p_nu ? number_width(wp) + 1 : 0)
507   #ifdef FEAT_CMDWIN
508             + (cmdwin_type == 0 || wp != curwin ? 0 : 1)
509   #endif
510 --- 910,923 ----
511   }
512   
513   /*
514 !  * Compute offset of a window, occupied by absolute or relative line number,
515 !  * fold column and sign column (these don't move when scrolling horizontally).
516    */
517       int
518   win_col_off(wp)
519       win_T     *wp;
520   {
521 !     return (((wp->w_p_nu || wp->w_p_rnu) ? number_width(wp) + 1 : 0)
522   #ifdef FEAT_CMDWIN
523             + (cmdwin_type == 0 || wp != curwin ? 0 : 1)
524   #endif
525 ***************
526 *** 943,955 ****
527   
528   /*
529    * Return the difference in column offset for the second screen line of a
530 !  * wrapped line.  It's 8 if 'number' is on and 'n' is in 'cpoptions'.
531    */
532       int
533   win_col_off2(wp)
534       win_T     *wp;
535   {
536 !     if (wp->w_p_nu && vim_strchr(p_cpo, CPO_NUMCOL) != NULL)
537         return number_width(wp) + 1;
538       return 0;
539   }
540 --- 943,956 ----
541   
542   /*
543    * Return the difference in column offset for the second screen line of a
544 !  * wrapped line.  It's 8 if 'number' or 'relativenumber' is on and 'n' is in
545 !  * 'cpoptions'.
546    */
547       int
548   win_col_off2(wp)
549       win_T     *wp;
550   {
551 !     if ((wp->w_p_nu || wp->w_p_rnu) && vim_strchr(p_cpo, CPO_NUMCOL) != NULL)
552         return number_width(wp) + 1;
553       return 0;
554   }
555 ***************
556 *** 1211,1227 ****
557       if (prev_skipcol != curwin->w_skipcol)
558         redraw_later(NOT_VALID);
559   
560   #ifdef FEAT_SYN_HL
561 !     /* Redraw when w_virtcol changes and 'cursorcolumn' is set, or when w_row
562 !      * changes and 'cursorline' is set. */
563 !     if (((curwin->w_p_cuc && (curwin->w_valid & VALID_VIRTCOL) == 0)
564 !               || (curwin->w_p_cul && (curwin->w_valid & VALID_WROW) == 0))
565   # ifdef FEAT_INS_EXPAND
566 !           && !pum_visible()
567   # endif
568 !           )
569 !       redraw_later(SOME_VALID);
570 ! #endif
571   
572       curwin->w_valid |= VALID_WCOL|VALID_WROW|VALID_VIRTCOL;
573   }
574 --- 1212,1233 ----
575       if (prev_skipcol != curwin->w_skipcol)
576         redraw_later(NOT_VALID);
577   
578 +     /* Redraw when w_row changes and 'relativenumber' is set */
579 +     if (((curwin->w_valid & VALID_WROW) == 0 && (curwin->w_p_rnu
580   #ifdef FEAT_SYN_HL
581 !       /* or when w_row changes and 'cursorline' is set. */
582 !                                               || curwin->w_p_cul
583 ! #endif
584 !       ))
585 ! #ifdef FEAT_SYN_HL
586 !       /* or when w_virtcol changes and 'cursorcolumn' is set */
587 !       || (curwin->w_p_cuc && (curwin->w_valid & VALID_VIRTCOL) == 0)
588 ! #endif
589 !       )
590   # ifdef FEAT_INS_EXPAND
591 !           if (!pum_visible())
592   # endif
593 !               redraw_later(SOME_VALID);
594   
595       curwin->w_valid |= VALID_WCOL|VALID_WROW|VALID_VIRTCOL;
596   }
597 Index: src/netbeans.c
598 ===================================================================
599 *** src/netbeans.c      (revision 1159)
600 --- src/netbeans.c      (working copy)
601 ***************
602 *** 3119,3125 ****
603   
604       if (bufno >= 0 && curwin != NULL && curwin->w_buffer == curbuf)
605       {
606 !       int col = mouse_col - W_WINCOL(curwin) - (curwin->w_p_nu ? 9 : 1);
607         long off = pos2off(curbuf, &curwin->w_cursor);
608   
609         /* sync the cursor position */
610 --- 3119,3126 ----
611   
612       if (bufno >= 0 && curwin != NULL && curwin->w_buffer == curbuf)
613       {
614 !       int col = mouse_col - W_WINCOL(curwin)
615 !                 - ((curwin->w_p_nu || curwin->w_p_rnu) ? 9 : 1);
616         long off = pos2off(curbuf, &curwin->w_cursor);
617   
618         /* sync the cursor position */
619 Index: src/normal.c
620 ===================================================================
621 *** src/normal.c        (revision 1159)
622 --- src/normal.c        (working copy)
623 ***************
624 *** 7783,7790 ****
625         }
626         else
627             i = curwin->w_leftcol;
628 !       /* Go to the middle of the screen line.  When 'number' is on and lines
629 !        * are wrapping the middle can be more to the left. */
630         if (cap->nchar == 'm')
631             i += (W_WIDTH(curwin) - curwin_col_off()
632                     + ((curwin->w_p_wrap && i > 0)
633 --- 7783,7791 ----
634         }
635         else
636             i = curwin->w_leftcol;
637 !       /* Go to the middle of the screen line.  When 'number' or
638 !        * 'relativenumber' is on and lines are wrapping the middle can be more
639 !        * to the left.*/
640         if (cap->nchar == 'm')
641             i += (W_WIDTH(curwin) - curwin_col_off()
642                     + ((curwin->w_p_wrap && i > 0)
643 Index: src/option.c
644 ===================================================================
645 *** src/option.c        (revision 1159)
646 --- src/option.c        (working copy)
647 ***************
648 *** 207,212 ****
649 --- 207,213 ----
650   # define PV_LBR               OPT_WIN(WV_LBR)
651   #endif
652   #define PV_NU         OPT_WIN(WV_NU)
653 + #define PV_RNU                OPT_WIN(WV_RNU)
654   #ifdef FEAT_LINEBREAK
655   # define PV_NUW               OPT_WIN(WV_NUW)
656   #endif
657 ***************
658 *** 2018,2023 ****
659 --- 2018,2026 ----
660                             (char_u *)NULL, PV_NONE,
661   #endif
662                             {(char_u *)2000L, (char_u *)0L} SCRIPTID_INIT},
663 +     {"relativenumber", "rnu", P_BOOL|P_VI_DEF|P_RWIN,
664 +                           (char_u *)VAR_WIN, PV_RNU,
665 +                           {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
666       {"remap",     NULL,   P_BOOL|P_VI_DEF,
667                             (char_u *)&p_remap, PV_NONE,
668                             {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT},
669 ***************
670 *** 7318,7323 ****
671 --- 7322,7340 ----
672             curwin->w_leftcol = 0;
673       }
674   
675 +     /* If 'number' is set, reset 'relativenumber'. */
676 +     else if ((int *)varp == &curwin->w_p_nu)
677 +     {
678 +       if (curwin->w_p_nu)
679 +           curwin->w_p_rnu = FALSE;
680 +     }
681 +     /* If 'relativenumber' is set, reset 'number'. */
682 +     else if ((int *)varp == &curwin->w_p_rnu)
683 +     {
684 +       if (curwin->w_p_rnu)
685 +           curwin->w_p_nu = FALSE;
686 +     }
687
688   #ifdef FEAT_WINDOWS
689       else if ((int *)varp == &p_ea)
690       {
691 ***************
692 *** 9028,9033 ****
693 --- 9045,9051 ----
694         case PV_FMR:    return (char_u *)&(curwin->w_p_fmr);
695   #endif
696         case PV_NU:     return (char_u *)&(curwin->w_p_nu);
697 +       case PV_RNU:    return (char_u *)&(curwin->w_p_rnu);
698   #ifdef FEAT_LINEBREAK
699         case PV_NUW:    return (char_u *)&(curwin->w_p_nuw);
700   #endif
701 ***************
702 *** 9213,9218 ****
703 --- 9231,9237 ----
704   #endif
705       to->wo_list = from->wo_list;
706       to->wo_nu = from->wo_nu;
707 +     to->wo_rnu = from->wo_rnu;
708   #ifdef FEAT_LINEBREAK
709       to->wo_nuw = from->wo_nuw;
710   #endif
711 Index: src/option.h
712 ===================================================================
713 *** src/option.h        (revision 1159)
714 --- src/option.h        (working copy)
715 ***************
716 *** 1039,1044 ****
717 --- 1039,1045 ----
718       , WV_LBR
719   #endif
720       , WV_NU
721 +     , WV_RNU
722   #ifdef FEAT_LINEBREAK
723       , WV_NUW
724   #endif
725 Index: src/screen.c
726 ===================================================================
727 *** src/screen.c        (revision 1159)
728 --- src/screen.c        (working copy)
729 ***************
730 *** 420,428 ****
731         check_for_delay(FALSE);
732   
733   #ifdef FEAT_LINEBREAK
734 !     /* Force redraw when width of 'number' column changes. */
735       if (curwin->w_redr_type < NOT_VALID
736 !          && curwin->w_nrwidth != (curwin->w_p_nu ? number_width(curwin) : 0))
737         curwin->w_redr_type = NOT_VALID;
738   #endif
739   
740 --- 420,430 ----
741         check_for_delay(FALSE);
742   
743   #ifdef FEAT_LINEBREAK
744 !     /* Force redraw when width of 'number' or 'relativenumber' column
745 !      * changes. */
746       if (curwin->w_redr_type < NOT_VALID
747 !          && curwin->w_nrwidth != ((curwin->w_p_nu || curwin->w_p_rnu)
748 !                                   ? number_width(curwin) : 0))
749         curwin->w_redr_type = NOT_VALID;
750   #endif
751   
752 ***************
753 *** 861,868 ****
754   #endif
755   
756   #ifdef FEAT_LINEBREAK
757 !     /* Force redraw when width of 'number' column changes. */
758 !     i = wp->w_p_nu ? number_width(wp) : 0;
759       if (wp->w_nrwidth != i)
760       {
761         type = NOT_VALID;
762 --- 863,871 ----
763   #endif
764   
765   #ifdef FEAT_LINEBREAK
766 !     /* Force redraw when width of 'number' or 'relativenumber' column
767 !      * changes. */
768 !     i = (wp->w_p_nu || wp->w_p_rnu) ? number_width(wp) : 0;
769       if (wp->w_nrwidth != i)
770       {
771         type = NOT_VALID;
772 ***************
773 *** 2108,2114 ****
774       /* Build the fold line:
775        * 1. Add the cmdwin_type for the command-line window
776        * 2. Add the 'foldcolumn'
777 !      * 3. Add the 'number' column
778        * 4. Compose the text
779        * 5. Add the text
780        * 6. set highlighting for the Visual area an other text
781 --- 2111,2117 ----
782       /* Build the fold line:
783        * 1. Add the cmdwin_type for the command-line window
784        * 2. Add the 'foldcolumn'
785 !      * 3. Add the 'number' or 'relativenumber' column
786        * 4. Compose the text
787        * 5. Add the text
788        * 6. set highlighting for the Visual area an other text
789 ***************
790 *** 2170,2176 ****
791                                  ScreenAttrs[off + (p) + ri] = v
792   #endif
793   
794 !     /* Set all attributes of the 'number' column and the text */
795       RL_MEMSET(col, hl_attr(HLF_FL), W_WIDTH(wp) - col);
796   
797   #ifdef FEAT_SIGNS
798 --- 2173,2180 ----
799                                  ScreenAttrs[off + (p) + ri] = v
800   #endif
801   
802 !     /* Set all attributes of the 'number' or 'relativenumber' column and the
803 !      * text */
804       RL_MEMSET(col, hl_attr(HLF_FL), W_WIDTH(wp) - col);
805   
806   #ifdef FEAT_SIGNS
807 ***************
808 *** 2196,2213 ****
809   #endif
810   
811       /*
812 !      * 3. Add the 'number' column
813        */
814 !     if (wp->w_p_nu)
815       {
816         len = W_WIDTH(wp) - col;
817         if (len > 0)
818         {
819             int     w = number_width(wp);
820   
821             if (len > w + 1)
822                 len = w + 1;
823 !           sprintf((char *)buf, "%*ld ", w, (long)lnum);
824   #ifdef FEAT_RIGHTLEFT
825             if (wp->w_p_rl)
826                 /* the line number isn't reversed */
827 --- 2200,2226 ----
828   #endif
829   
830       /*
831 !      * 3. Add the 'number' or 'relativenumber' column
832        */
833 !     if (wp->w_p_nu || wp->w_p_rnu)
834       {
835         len = W_WIDTH(wp) - col;
836         if (len > 0)
837         {
838             int     w = number_width(wp);
839 +           long num;
840   
841             if (len > w + 1)
842                 len = w + 1;
843
844 !           if (wp->w_p_nu)
845 !               /* 'number' */
846 !               num = (long)lnum;
847 !           else
848 !               /* 'relativenumber', don't use negative numbers */
849 !               num = (long)abs((int)get_cursor_rel_lnum(wp, lnum));
850
851 !           sprintf((char *)buf, "%*ld ", w, num);
852   #ifdef FEAT_RIGHTLEFT
853             if (wp->w_p_rl)
854                 /* the line number isn't reversed */
855 ***************
856 *** 3286,3294 ****
857             if (draw_state == WL_NR - 1 && n_extra == 0)
858             {
859                 draw_state = WL_NR;
860 !               /* Display the line number.  After the first fill with blanks
861 !                * when the 'n' flag isn't in 'cpo' */
862 !               if (wp->w_p_nu
863                         && (row == startrow
864   #ifdef FEAT_DIFF
865                             + filler_lines
866 --- 3299,3307 ----
867             if (draw_state == WL_NR - 1 && n_extra == 0)
868             {
869                 draw_state = WL_NR;
870 !               /* Display the absolute or relative line number. After the
871 !                * first fill with blanks when the 'n' flag isn't in 'cpo' */
872 !               if ((wp->w_p_nu || wp->w_p_rnu)
873                         && (row == startrow
874   #ifdef FEAT_DIFF
875                             + filler_lines
876 ***************
877 *** 3302,3309 ****
878   #endif
879                             )
880                     {
881                         sprintf((char *)extra, "%*ld ",
882 !                                               number_width(wp), (long)lnum);
883                         if (wp->w_skipcol > 0)
884                             for (p_extra = extra; *p_extra == ' '; ++p_extra)
885                                 *p_extra = '-';
886 --- 3315,3332 ----
887   #endif
888                             )
889                     {
890 +                       long num;
891
892 +                       if (wp->w_p_nu)
893 +                           /* 'number' */
894 +                           num = (long)lnum;
895 +                       else
896 +                           /* 'relativenumber', don't use negative numbers */
897 +                           num = (long)abs((int)get_cursor_rel_lnum(wp,
898 +                                                                   lnum));
899
900                         sprintf((char *)extra, "%*ld ",
901 !                                               number_width(wp), num);
902                         if (wp->w_skipcol > 0)
903                             for (p_extra = extra; *p_extra == ' '; ++p_extra)
904                                 *p_extra = '-';
905 ***************
906 *** 4696,4702 ****
907         else
908             --n_skip;
909   
910 !       /* Only advance the "vcol" when after the 'number' column. */
911         if (draw_state > WL_NR
912   #ifdef FEAT_DIFF
913                 && filler_todo <= 0
914 --- 4696,4703 ----
915         else
916             --n_skip;
917   
918 !       /* Only advance the "vcol" when after the 'number' or 'relativenumber'
919 !        * column. */
920         if (draw_state > WL_NR
921   #ifdef FEAT_DIFF
922                 && filler_todo <= 0
923 ***************
924 *** 9622,9629 ****
925   
926   #if defined(FEAT_LINEBREAK) || defined(PROTO)
927   /*
928 !  * Return the width of the 'number' column.
929 !  * Caller may need to check if 'number' is set.
930    * Otherwise it depends on 'numberwidth' and the line count.
931    */
932       int
933 --- 9646,9653 ----
934   
935   #if defined(FEAT_LINEBREAK) || defined(PROTO)
936   /*
937 !  * Return the width of the 'number' and 'relativenumber' column.
938 !  * Caller may need to check if 'number' or 'relativenumber' is set.
939    * Otherwise it depends on 'numberwidth' and the line count.
940    */
941       int
942 ***************
943 *** 9633,9639 ****
944       int               n;
945       linenr_T  lnum;
946   
947 !     lnum = wp->w_buffer->b_ml.ml_line_count;
948       if (lnum == wp->w_nrwidth_line_count)
949         return wp->w_nrwidth_width;
950       wp->w_nrwidth_line_count = lnum;
951 --- 9657,9669 ----
952       int               n;
953       linenr_T  lnum;
954   
955 !     if (wp->w_p_nu)
956 !       /* 'number' */
957 !       lnum = wp->w_buffer->b_ml.ml_line_count;
958 !     else
959 !       /* 'relativenumber' */
960 !       lnum = wp->w_height;
961
962       if (lnum == wp->w_nrwidth_line_count)
963         return wp->w_nrwidth_width;
964       wp->w_nrwidth_line_count = lnum;
965 Index: src/structs.h
966 ===================================================================
967 *** src/structs.h       (revision 1159)
968 --- src/structs.h       (working copy)
969 ***************
970 *** 169,174 ****
971 --- 169,176 ----
972   #define w_p_list w_onebuf_opt.wo_list /* 'list' */
973       int               wo_nu;
974   #define w_p_nu w_onebuf_opt.wo_nu     /* 'number' */
975 +     int               wo_rnu;
976 + #define w_p_rnu w_onebuf_opt.wo_rnu   /* 'relativenumber' */
977   #ifdef FEAT_LINEBREAK
978       long      wo_nuw;
979   # define w_p_nuw w_onebuf_opt.wo_nuw  /* 'numberwidth' */
980 ***************
981 *** 1890,1896 ****
982                                        recomputed */
983   #endif
984   #ifdef FEAT_LINEBREAK
985 !     int               w_nrwidth;          /* width of 'number' column being used */
986   #endif
987   
988       /*
989 --- 1892,1899 ----
990                                        recomputed */
991   #endif
992   #ifdef FEAT_LINEBREAK
993 !     int               w_nrwidth;          /* width of 'number' and 'relativenumber'
994 !                                      column being used */
995   #endif
996   
997       /*
This page took 0.092288 seconds and 3 git commands to generate.