The @David comment made me work a bit with goose, eventually finding this link: Add line numbers to source code in vim
For my purposes, what I needed was not necessarily permanent numbering, but simply temporary. Quickly insert / delete line numbers, and then resort to standard numbering. In this case, I did not think to simply insert and then delete my own line numbering. The following works well. And the possibilities are endless for the numbering (see, for example, https://stackoverflow.com/a/3129/ )
%!awk '{print NR,$0}'
For your own vi-solution, to add numbers, then (from https://stackoverflow.com/questions/83301/... ), line numbers will be inserted below, and then a space:
:%s/^/\=line('.').' '/
Then (thanks to Lance) https://stackoverflow.com/a/166268/how-to-store-create-string-command-in-javascript/232632#232632
:%s/^[0-9]* //
If there is something in vim that I am missing, this can do constant numbering based on 0, please let me know.
Paul
source share