Numbers.vim - better line numbers for vim
myusuf3.github.com
myusuf3.github.com
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. The above has worked for me on Mac OS X for years, but there's a chance I didn't set it up the "right way". Leave comments on this gist and I'll update as necessary: " use Ctrl+L to toggle the line number counting method
function! g:ToggleNuMode()
if(&rnu == 1)
set nu
else
set rnu
endif
endfunc
nnoremap <C-L> :call g:ToggleNuMode()<cr>TLDR - the plugin approach gains the benefits of software evolution.
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.
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).
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'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.
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!
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.
while in insert mode you would simply want to see what line you are one and for collaboration with others. In cases where you might want jump to a line like :15.
There is also a NumberToggle function if you ever need to switch on the go.
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.