XVim2: Relativenumber not work.
XVim2 work for me,
but when I set up my .xvimrc
as below,
set relativenumber
the relative number not appear in my Xcode9. Did I miss something?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 20 (5 by maintainers)
Do we have any movement on this issue? Would love to have relative numbers support on 9.2. Thanks to all the contributors for their hard work, XVIM is a really amazing tool.
+1 for relative numbers
Hi, just want to say I really enjoy XVim2 and Vim mode is an absolute must for me when using an editor. Also as mentioned earlier in this thread, I’ve also grown custom to the relative line numbers and it’s quite shitty when they’re not there.
That being said I have tried over the last couple of days to find a way to get it working in this project, but I think I need some help from somebody with a bit more experience in both Obj-C (haven’t touched it in five years I think) and the type of project XVim2 is. My experience is solely with iOS apps, so I feel I’m lacking the fundamental stuff here.
Okay, so I have managed to scrap together a somewhat really buggy thingy, that in my opinion is better than not having any form of relative line numbering at all. It has the following bugs/features:
Line Wrapping
is turned off. Line wrapping screws up the math for calculating which line it is, based on the Y coordinate.relativenumber
setting in.xvimrc
Okay so please test if you wish, and pretty please help me solve this by submitting code or pointers. Anything is appreciated. I really wish to see relative numbers fully functioning in the XVim2 project.
Fork/branch: https://github.com/kentrh/XVim2/tree/relative-line-numbers Code: https://github.com/kentrh/XVim2/blob/relative-line-numbers/XVim2/XVim/XVimWindow.m#L519 Screenshot:
Unfortunately, I haven’t had the time to look into this again. Sorry 😞
I think so, relative numbers not being displayed is no longer an issue.
@kentrh This is amazing! Thank you very much for you work! Please feel free to claim the bounty at https://www.bountysource.com/issues/50244706-relativenumber-not-work
Should this issue be closed now that @kentrh’s excellent work has been merged?
@kentrh YOU. ARE. A. LEGEND!
Thank you so much for this. I’d love to get you a drink, have you got a PayPal or somewhere similar where to send it?
I checked out your branch, run
make
and took it for a quick spin. I noticed a few things:Not working on first launch. You mentioned this in your comment but I wanted to report that the only way I found to enable it was to run
:set relativenumber
from normal modeNot respecting font size. This is a minor detail, but, as you can see below, the font size of the number is not the same as they were originally. I suppose there must be a way to read the font size and apply it to the new views your code adds.
Line number goes to
1
when on one-before-the-last lineI’ll be using it more today and report here with other findings.
This is super promising. As far as I’m concerned, unless someone spots a bug, it should make it into
develop
ASAP.It’s an optional feature, so even if it’s not super polished it’s okay. Also, I think it’s fair to say that most of the users of XVim are tinkerer and can understand the complexity of getting this kind of stuff working.
Again, thank you so much! ❤️ You are awesome!
I’m trying to look into this, but I have no idea of what I’m doing?
What’s a good place to start?
@kr15hna suggested:
How can we get a reference to that class? So far in my reverse engineering I’ve been able to see the subviews of
XVimIDEPegasusSourceEditorView
.Among them I can see a
ChangeGutterMarginView
, which I think matches this:https://github.com/XVimProject/XVim2/blob/76852cf78332f53252eadb4f281f6530fbd2cb5f/XVim2/Xcode10/IDESourceEditor/_TtC15IDESourceEditorP33_7E074BCA936D0EABA73257D5271D839D22ChangeGutterMarginView.h#L9-L21
I might be wrong though. I tried to call
isFlipped
on it and it didn’t work, but I don’t know why:Any ideas if I’m on the right track?
Ideally I’d like to: