Live data from Hacker News

Relative Line Numbers in Vim

jeffkreeftmeijer.com

31–40 of 40 posts

Re: Relative Line Numbers in Vim

#31

I have used (and like) relative line numbers for a while now. However, when using MacVim full-screen on large (high resolution) screens, the relativenumber and cursorline slow down redraws considerably on my Macs, to the point where it annoys me a lot. Does anyone else have the same experience and perhaps a solution?

Not sure what cursorline is, but relativenumber redraws pretty slowly when scrolling a lot (like jjjjjjjjj) in gVim on a pretty powerful Windows 7 machine. Haven't noticed anything on my linux netbook, but it runs a newer vim version.

Re: Relative Line Numbers in Vim

#32
Vim 7.3.918 (the version I have installed here on Arch Linux) shows the absolute number of the current line, along with relative line numbers for the other rows. No need for such toggle functions.

Re: Relative Line Numbers in Vim

#33

Earlier quoted context omitted.

Polite translation: Take the time to learn how to setup vim yourself and it will reward you 10 fold.

Haha. Yes, that's what I meant. Thanks for your help. I see two slightly overlapping trends: 1. Alice is intrigued by all the fuss about Vim and tries her best to wrap her head around it by reading online material and "The Fucking Manual" and getting her hands dirty. Because she knows that she can't be as productive as with her previous editor in an afternoon, she learns Vim on the side. Another benefit of that metho…

I came to vim as an Alice. Everyone swore by vim, so I thought I should learn it, despite it being kinda fiddly for a text editor. It took me another couple of years to switch over completely, a couple more before I started to actually enjoy using it, and a couple more before I started to care about being efficient with my keystrokes.

Once you drink the cool-aid, there's nothing quite like it. Sometimes I think that scooting around a text file in vim is my favorite thing about coding.

Re: Relative Line Numbers in Vim

#37
post #29

Earlier quoted context omitted.

Relative line numbers for LIFE! :D d3j (delete 3 down) and y3j (yank 3 down) do the same things, but relative. I don't even need to look at the relative numbers anymore really. For short hops I just guess. I'm right most of the times.

Absolute line numbers are more convenient for me. Relative line numbers didn't give me any advantage after I learned about the G command. That command is also useful for going to the bottom of the file (G) or to the top of the file (1G). With absolute line numbers I don't have the line numbers changing all the time, which was distracting. It's also easier to open files at a specific line.

gg will take you to the top of the file too

Re: Relative Line Numbers in Vim

#38
Maybe this is not in spirit of VIM, but I set my key repeat to very low value. Minimal setting you can set through mac options is 83 ms - if you press and hold a key it generates a key press every 83 ms. I set up a key repeat to 25 ms through KeyRemap4MacBook (and delay until repeat 150 ms). If I want to generate 1-4 clicks I just press the key repeatedly, otherwise I hold a key.

After some time I got used to it and I can select blocks of text of size 5-10 faster than I would using movement with number (I don't have to move my fingers away, I don't have to calculate or look at the relative distance). Advantage is that it works well outside of vim as well.

Re: Relative Line Numbers in Vim

#39
post #36
post #9

Relative line numbers may be useful at first, but they quickly show their limitation when one needs to jump to a specific line.

Excuse me, I meant when one needs to know in which line he is .

You should upgrade to patch 787 or above if you can:

http://i.imgur.com/xJ4r75B.png

Re: Relative Line Numbers in Vim

#40
post #29

Earlier quoted context omitted.

Absolute line numbers are more convenient for me. Relative line numbers didn't give me any advantage after I learned about the G command. That command is also useful for going to the bottom of the file (G) or to the top of the file (1G). With absolute line numbers I don't have the line numbers changing all the time, which was distracting. It's also easier to open files at a specific line.

gg will take you to the top of the file too

Thanks, learned something new.
Post reply on HN