odeke-em / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

Width of line numbers in :hardcopy is hard coded #165

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The width of the line numbers (when enabled) in :hardcopy appears to be hard 
coded through #define PRINT_NUMBER_WIDTH 8 in the file structs.h. It would be 
preferrable to have this setting available in printoptions.

When printing small, 1-page files with <=50 lines, reserving 6 character widths 
for line numbers is IMHO excessive, and in some cases it causes long lines 
below 80 characters to wrap with otherwise default settings.

Suggested solution:
Add a new option to printoptions named numberwidth, which takes a non-negative 
integer as parameter, and use this to set the padding of line numbers when 
printing through :hardcopy. Alternatively, make :hardcopy respect the existing 
option :set numberwidth. The latter would be less preferable, because that 
option is not intended to affect printing. Defaults should be set so it matches 
current behavior.

While the suggested solution above resolves the issue, I'd like to make some 
additional suggestions on how it could be improved.

Suggested improvement:
Add the possibility to supply the parameter * to the suggested numberwidth 
option in popt, which would cause the line numbers in :hardcopy to fit the 
largest line number. If the largest line number is 999, 3 character widths 
would be reserved for line numbers.

Suggested improvement:
Add an option to printoptions to change the padding between the line number and 
the line itself.

Suggested improvement:
Provide an option to have line numbers outside the margin. Some consider it 
good typographic style to leave bullets and numbers of lists outside the margin.

Here's a visual example of the suggestion:
|        12345  |# This is a line of text
^ Edge          ^ Margin

As opposed to the current behavior, which would look like
|               | 12345  # This is a line of text
^ Edge          ^ Margin

I'd be willing to submit patches for individual parts of this report if I get 
some pointers on where to start, or manage to find the necessary information 
myself.

Original issue reported on code.google.com by dale.oys...@gmail.com on 3 Sep 2013 at 1:20