A feature request (kind of Issue report) - GUI setup, left margin, legitimity,

138 views
Skip to first unread message

Mikhail V

unread,
Sep 27, 2014, 4:12:43 PM9/27/14
to vim...@googlegroups.com
Greetings,
I am totally new to the discussion groups, so i'm sorry in advance if there are already solutions to my problem. And I was not able to attach screenshots, I don't know what is the problem, I press "attach a file" and nothing happens. Tell me please how to do it, then it will be much easier to see what I mean.

I am not sure how to describe my contribution, it is rather a feature request which should solve a serious Usability issue which I suffer from for a long time staring in the Vim window (since I write python programs in it quite a lot) . I used all possible setup options and color setups to push the best out of the readability in Vim, so now it looks as in attached screenshot (issue.png).
So the thing is, afaik, there is no option to setup left margin of the text window, so it is impossible to control the gap between linenumber column ant text area. And equally, when I hide numbers column, the text literally sticks to the window border. Especially bad it looks in Windows version of Vim (I use Courier New font), since the characters somehow stick to the left boundary of the em
square.
This issue was discussed on Stackoverflow in 2011, here is link:
http://stackoverflow.com/questions/7893390/how-to-change-the-left-margin-in-gvim
but still afaik no solution (?), only some weak workarounds or plugins ... So obviously logical solution would be introducing an option, something like "leftmargin" which would just leave empty gap at line beginnings and therefore solve this issue distinctly. See "solution.png" in attachement to see what I want to get with it.
It would be perfect if one could get also a dotted line between areas like in "solution2.png" but I know, it probably contradicts with text-mode nature of vim.
Predicting the counter-critics, that it will look as if there are spaces at line beginnings - I am working with Vim+Python only so in my case I always know where is the left border of my textfile, same as with block text or other code, so I think there almost no examples where it can cause any problems.

Hope I was clear enough in my intention. Thanks in advance for your comments and special thanks to developers for such a great text editor!

Mikhail V

Christian Brabandt

unread,
Sep 27, 2014, 4:51:53 PM9/27/14
to vim...@googlegroups.com
Hi Mikhail!
I haven't seen any of your screenshots, they might got lost when posting
here. How much space would you like to have? For a single column you
could simply add a dummy sign to your window, but if you want more, your
best bet would probably to add some dummy window to the left of you
actual window (which has the advantage of not being fixed-width, so you
can control the "margin" width).

Best,
Christian
--
Wußten Sie schon...
... daß eine Lachmöwe auch auf einer Heulboje sitzen kann?

Manuel Ortega

unread,
Sep 27, 2014, 5:06:22 PM9/27/14
to vim...@googlegroups.com
That would divorce the linenumbers from the file in question, I think.

Sounds like what's wanted is an option that interacts with &numberwidth, namely, that causes the line numbers to be left-aligned rather than right-aligned.  Then the OP could set a huge &numberwidth but make it left-aligned, which would put a big gap between the digits and the text.  As an added bonus, it can be colored using ":hi linenr __bg=blah" to help differentiate the right-hand portion of the number gutter from the text.

-Manny 

Mikhail V

unread,
Sep 27, 2014, 6:42:01 PM9/27/14
to vim...@googlegroups.com
Hallo Christian,
thanks for reply. So I wrote in first paragraph about not being able to attach screenshots. I have placed them now on my student homepage , so you can check out.
http://public.beuth-hochschule.de/~s53452/index.htm

So yes there are few workarounds and I don't say its really that great global mankind problem, but it starts to be annoying after long hours of work and tacking the lines visually. I didn't know about the dummy column trick, I'll check it out. And dummmy window? Wouldn't it cause windows switching incosistence or switching to it at mouseclicks? But sounds interesting though.

Mikhail

Mikhail V

unread,
Sep 27, 2014, 7:06:43 PM9/27/14
to vim...@googlegroups.com
> Then the OP could set a huge &numberwidth but make it left-aligned, which would put a big gap between the digits and the text. 
>
>
> -Manny 

I am sorry, but how do you make the numbers left-aligned? I don't find an option for that.

Mikhail V

unread,
Sep 27, 2014, 9:23:10 PM9/27/14
to vim...@googlegroups.com
just a small update, I have found another discussion of this issue from even earlier date:
http://stackoverflow.com/questions/2531904/how-do-i-increase-the-spacing-of-the-line-number-margin-in-vim

And it was also highly voted, since it really causes problems with code readability. Just in case, I was talking about stock 7.4 version of GUI Windows 32bit Vim. But In my fedora version it is all the same, with only that difference, that fedora's Nimbus font (courier analog) seems to be of a significantly better quality and the characters are correctly centered inside the em square, so the text is not sticking to the left border so badly as with windows' courier. It causes actually another issue - the vertical cursor which is default for input mode is overlapping with characters so instead of "b" i see "o" at the cursor position, for example.

Christian Brabandt

unread,
Sep 28, 2014, 8:00:33 AM9/28/14
to vim...@googlegroups.com
Hi Mikhail!

On Sa, 27 Sep 2014, Mikhail V wrote:

I see, you want that the normal text starts 1 additional column after
the line numbering. I don't think this is possible (not even with the
workarounds mentioned so far). Sorry.

Best,
Christian
--
Hart ist Hart. Weich ist Weich. Aber immer weich ist hart.

Christian Brabandt

unread,
Sep 28, 2014, 8:39:22 AM9/28/14
to vim...@googlegroups.com
Here is a simple patch, that adds the 'numbershift' option by which you
can specify how much to shift the main text right of the number column
(only works when either 'number' or 'relativenumber' is set).

Best,
Christian
--
Die Kritik an anderen hat noch keinem die eigene Leistung erspart.
-- Noël Coward
normal_text_shift.diff

Mikhail V

unread,
Sep 28, 2014, 1:04:27 PM9/28/14
to vim...@googlegroups.com
> > I see, you want that the normal text starts 1 additional column after
>
> > the line numbering. I don't think this is possible (not even with the
>
> > workarounds mentioned so far). Sorry.
>
>
>
> Here is a simple patch, that adds the 'numbershift' option by which you
>
> can specify how much to shift the main text right of the number column
>
> (only works when either 'number' or 'relativenumber' is set).
>
Glad that it is clear what the idea is. Thanks for the patch, though I am not currently ready to build, probably try it later. It sounds like a solution, but will make sense only if I have LineNr background color same as text background color. Just to summarise my intentions, how I see it should be optimal (for me, but I believe also for many others):
- I like the linenumbers being right-aligned and turned on
- I like when the left margin is solid, I made example with 1 character margin, but in many situations I want also much bigger margin (after numbers, same color as text bg!). So I could significantly reduce eye-strain at long-term work.
So obvious solution to implement that would be introducing an option, as said, like "leftmargin". This would be, imo, big step in usability improvement.
Hope it will come true for the standard release sometime.

Mikhail

Christian Brabandt

unread,
Sep 28, 2014, 3:13:44 PM9/28/14
to vim...@googlegroups.com
For now an updated patch is put here:
https://github.com/chrisbra/vim-mq-patches/blob/master/normal_text_shift

The new config option is now called 'leftmargin'.

Best,
Christian
--
Was die Menschen Zivilisation nennen, ist der Zustand gegenwärtiger
Sitten; was sie Barbarei nennen, das sind die Sitten der
Vergangenheit.
-- Anatole France

Mikhail V

unread,
Sep 29, 2014, 7:52:44 PM9/29/14
to vim...@googlegroups.com
Guten Tag Christian,

I have managed to compile with this patch under windows with msvs Express 2008. New feature works exactly how I expected. Thank you very much for the effort.
I must say however after playing with it for a while I discovered some artefacts are appearing along the text border. I placed screenshot again on my site:
http://public.beuth-hochschule.de/~s53452/index.htm

So those dots are obviosly parts of the characters' hinting, e.g. from lower-left serifs of letter A, which are swarming up on the left neighbor char squares. Those appear when I scroll through the text up/down with the arrow keys. Furthermore , there is a noticeable slowdown of screen redraw by scrolling. Oddly, scrolling with the mouse wheel or dragging scrollbar with mouse or clicking up/down on the scrollbar arrows does not cause any slowdown and does not cause any artefacts! I cannot give 100% guarantee that slowdowns are caused by this patch, but there is nothing like that in my installed version of vim.

Regards,
Mikhail

Mikhail V

unread,
Sep 29, 2014, 8:02:53 PM9/29/14
to vim...@googlegroups.com
small followup. Just noticed that moving cursor around wrapped line is totally buggy now. I Didn't see that earlier since I keep wrapping off all the time, just turned it on now to check... So... this all needs a bit more effort I suppose :)

Mikhail

Christian Brabandt

unread,
Oct 10, 2014, 4:59:04 PM10/10/14
to vim...@googlegroups.com
Hi Mikhail!

On Mo, 29 Sep 2014, Mikhail V wrote:

> small followup. Just noticed that moving cursor around wrapped line is totally buggy now. I Didn't see that earlier since I keep wrapping off all the time, just turned it on now to check... So... this all needs a bit more effort I suppose :)

Didn't see that. There was a problem with breakindent. I fixed that now.
Also there is another problem for small windows with long wrapped lines.
Not sure what this is. I see if I can fix that.

Best,
Christian
--
Reply all
Reply to author
Forward
0 new messages