VIM: Zero-Indexed Line Numbers in :set number -


Using VIM, it is easy to display line numbers for any file:

  : Set number  

However, line numbering is 1-indexed, this means that the number starts with 1. Generally this is what I want, but my code reports zero-indexed line numbers - that is, a special tool I am using to compile - that line line starts with zero.

How can I change the line numbering of Vim so that the numbers in the buffer can be matched by the errors given by viewing the device, and in addition to a particular number jump matches the device.

That is, if the tool tells me that there is an error on line 98, then I want to jump from that line by typing "98G", not "97G", and this line Really have 97) want to display "98" in the line number list.

Edit:

While I can filter the output of tools, while quite easy it is not a trivial tas because the tool also outputs the hex values ​​corresponding to each line It has the same zero-indexed form, and it is output in informative messages, not just errors, and I have many such projects.

I do not think this is possible; However, handling the output of your external device is just text, it would be very easy to filter out the output such as numbering to match the match is 1-indexed, can you give us an example of your output?

Edit

Alternatively, if you call an external command from Vime, then you can do something like this (basically, a blank Add a line, run the external command, and then delete the empty row):

  command! RunMyExternalProgramme call RunMyExternalProgramme () func! RunMyExternalProgramme () "Let's save the old settings of makeprg: Saves saved makeppr = & amp; mapper" to save the screen layout: saveView = winsaveview () if config_file! = '' "Put the blank line at the beginning of the file: 1put! = '' Change the makeprog and make it to run and run it & amp; makeprg = '/ path / to / program -options etc' to create an empty line 1d Restore the "Save Save" screen layout (optional) Call winrestview (S: saved view) Repeat the old settings of "MEGRG" again and again: saveMakePrg endfunc  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -