Live data from Hacker News

Numbers.vim - better line numbers for vim

myusuf3.github.com

41–47 of 47 posts

Re: Numbers.vim - better line numbers for vim

#41

As someone with a low-bandwidth connection and that I often work in cafés I hate it when the only description available is through video when there could easily have been text and screenshots.

Even on high bandwidth connections it's annoying. My read speed is much higher bandwidth than videos for things that can be explained in a paragraph or three.

Videos should probably be used when:

1. Your audience is non-technical.

2. A (moving) picture is worth a thousand words (eg, words can't do it justice, but a quick video can).

3. You're not bandwidth constrained (or firewalled).

4. You're not just video'ing text entry, or if you must, you ensure the user can zoom in or enlarge the video to see it (the embedded video can't be enlarged, I had to open it in Youtube to actually see it).

Re: Numbers.vim - better line numbers for vim

#42

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…

One benefit of the plugin approach is that it will get forked and improved and other cool and useful things added to it. It's a central repository for all of that goodness, and keeping it up to date just requires pulling the repo (assuming you're using Pathogen or Vundle), instead of remembering to dig through vim.org/scripts periodically.

TLDR - the plugin approach gains the benefits of software evolution.

Re: Numbers.vim - better line numbers for vim

#43
post #40
post #28

Earlier quoted context omitted.

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

There's a difference in productive typing and typing to set up your editor. I would compare this to the popularity in Ubuntu vs Arch, too.

Well, it's not like it's Eclipse. I've been carrying my .vimrc and other dotfiles around from machine to machine for a decade. Occasionally I make changes, but for the most part there's not a lot of setup with vim for me.

Re: Numbers.vim - better line numbers for vim

#44
post #33

Earlier quoted context omitted.

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.

I still feel like I have to do math (albeit simple math) with relative line numbering. If I want to yank a block of code that's X lines long, I have to look at line X, and add one to the number next to it. E.g., when I want to grab 8 lines, the last line I want to grab has a 7 next to it. I guess I think it'd be more helpful if the numbers were inclusive, and 1-indexed. I'm not sure how to configure that though.

Yes, I wish the numbering was 1-indexed. But by now, I have trained my brain to automatically add one. I would definitely prefer a fix where I don't have to do +1.

Re: Numbers.vim - better line numbers for vim

#45

FWIW, the example you give would be more easily handled with the built in "dap" (delete a paragraph)

Yea, that's what I had in mind while watching the video too. I remember that example as delete around paragraph, to match delete inside paragraph (dip), which differ in how they handle whitespace at the end of the paragraph. Delete inside quotes, di', and delete around quotes, da', work in the same way too.

Re: Numbers.vim - better line numbers for vim

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

Do you use (){}[] and others to move about? I rarely need to know the line number to move to on the screen.

Re: Numbers.vim - better line numbers for vim

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

That only really works well if the line you want is visible.

I've found searching to be much quicker, since I know class/method/variable names more than I know line numbers - we follow reasonably standard names for things in the projects we work on.

Post reply on HN