How can I set gvim's window width to 80 columns of text, plus the ones needed to show the line number
Solution 1:
Try this in your ~/.vimrc:
au BufRead * let &numberwidth = float2nr(log10(line("$"))) + 2
\| let &columns = &numberwidth + 80
Every time you load a buffer (i.e., open a file), that will determine the number of columns required to show the largest line number, set the 'numberwidth' option accordingly, and set 'columns' to that number plus 80 for your text.
Solution 2:
I use
set lines=24 columns=84
in my $HOME/.gvimrc which gives me what you want. I rarely (if ever) have files that are longer the 999 lines so it works for me.