Live data from Hacker News

Numbers.vim - better line numbers for vim

myusuf3.github.com

11–20 of 47 posts

Re: Numbers.vim - better line numbers for vim

#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.

Re: Numbers.vim - better line numbers for vim

#13

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()

Re: Numbers.vim - better line numbers for vim

#14

I'm still pondering the "how is this useful?" part... why are absolute numbers useful for you in insert mode?

My exact thought. I absolutely love 'relative line numbering' as it lets me use different VIM commands without having to do math. And as I can go to any line number by typing ': ' [generally reported by debugger or other means], I don't really care about actual line numbers anymore.

In addition, if you have 'set ruler' set, the absolute line number of the current line is displayed at the bottom of the screen when in insert mode.

Re: Numbers.vim - better line numbers for vim

#16
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.

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.

Re: Numbers.vim - better line numbers for vim

#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.

Re: Numbers.vim - better line numbers for vim

#18
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.

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.

Re: Numbers.vim - better line numbers for vim

#20

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…

You don't need one. It's a cost/benefit thing - is it worth having one? Do you really need to use Vim or Emacs or Eclipse, etc? You don't need to.

I can imagine some reasons why it might be useful to have it as a plugin. Making a plugin means giving it a name and a URL (and if it's on vim.org, a place in a well-known directory), and that makes discovery and communication of its existence easier. The fact that it's useful to have a gist for it bears this out, I think. I can't think of why it's that bad a thing to have a plugin for it.

Post reply on HN