Live data from Hacker News

Numbers.vim - better line numbers for vim

myusuf3.github.com

21–30 of 47 posts

Re: Numbers.vim - better line numbers for vim

#24
post #12

I know some people like line numbers, but personally, I just look at the status bar at the bottom of the buffer. I find line numbers on the side clutter up my view too much. I always use 80 character terminal widths, to make it easier to stick to my PEP8 validation script we run.

I just tried turning off line numbers, and you're right, it's great. They really don't provide enough value to justify taking 4 columns on every vertical split.

I use a pretty large font size for my terminal, and the extra 8 columns finally allows for two 80 column vertical splits on my laptop. Thanks for the suggestion!

Re: Numbers.vim - better line numbers for vim

#25

Do you really need a plugin for this? If you want relative numbers to appear when in normal mode, and absolute line numbers to appear otherwise (e.g., when the window has lost focus), just throw this in your .vimrc: set rnu au InsertEnter * :set nu au InsertLeave * :set rnu au FocusLost * :set nu au FocusGained * :set rnu Here's a gist for posterity. Feel free to fork it, leave comments on what should be changed, etc…

I just have this in my .vimrc which lets you toggle it whatever way you want in edit mode and it stays however you leave it when you toggle modes " use Ctrl+L to toggle the line number counting method function! g:ToggleNuMode() if(&rnu == 1) set nu else set rnu endif endfunc nnoremap :call g:ToggleNuMode()

Quick note: This requires vim 7.3

Re: Numbers.vim - better line numbers for vim

#26

    10 i = i + 1
    20 PRINT i
    30 IF i > 100000 THEN i = 0: GOTO 10
    40 IF INKEY$ = "" THEN 10
    50 PRINT "Bible, Line:", i
http://www.losethos.com/files/BIBLE.TXT

God says... Line:16099

evil, they shall go in thither, and unto them will I give it, and they shall possess it.

1:40 But as for you, turn you, and take your journey into the wilderness by the way of the Red sea.

1:41 Then ye answered and said unto me, We have sinned against the LORD, we will go up and fight, according to all that the LORD our God commanded us.

And when ye had girded on every man his weapons of war, ye were ready to go up into the hill.

1:42 And the LORD said unto me, Say unto them. Go not up, neither fight; for I am not among you; lest ye be smitten before your enemies.

Re: Numbers.vim - better line numbers for vim

#27
post #18

Earlier quoted context omitted.

That's fine for determining what line you're on, but visible line numbers make it much easier to jump to a particular line. I've only recently set number in my .vimrc and wish I'd have done it sooner.

I do that by jumping to the particular line. : or G does that.

I think the point is that it's harder to see what line number you want to jump to if you don't have line numbering on. . . .

Re: Numbers.vim - better line numbers for vim

#28
post #17

Its these kind of things that I wish to see vanilla vim shipped with, without bothering the user much. Yes you can toss some commands and code snippets at me and ask me to use them to get these features. But not having to type commands/snippets and have all goodies out of the box is what modern text editors like sublime text are all about.

If you don't like typing, vim is not the right editor for you!

Re: Numbers.vim - better line numbers for vim

#29
post #27
post #18

Earlier quoted context omitted.

I do that by jumping to the particular line. : or G does that.

I think the point is that it's harder to see what line number you want to jump to if you don't have line numbering on. . . .

Right, the alternative is to just sort of guess how much you need to ctrl-u/d or j and k to get to a specific line. Also, I guess it depends on screen size. I usually have plenty so the line numbers' usefulness outweighs the extra space required, at least for me.

Re: Numbers.vim - better line numbers for vim

#30

Do you really need a plugin for this? If you want relative numbers to appear when in normal mode, and absolute line numbers to appear otherwise (e.g., when the window has lost focus), just throw this in your .vimrc: set rnu au InsertEnter * :set nu au InsertLeave * :set rnu au FocusLost * :set nu au FocusGained * :set rnu Here's a gist for posterity. Feel free to fork it, leave comments on what should be changed, etc…

I just have this in my .vimrc which lets you toggle it whatever way you want in edit mode and it stays however you leave it when you toggle modes " use Ctrl+L to toggle the line number counting method function! g:ToggleNuMode() if(&rnu == 1) set nu else set rnu endif endfunc nnoremap :call g:ToggleNuMode()

Thank you for sharing!
Post reply on HN