Here's what it looked like: http://i.imgur.com/NTwwB.jpg
Here was the patch. I wrote it back in 2011: https://code.google.com/r/justinvh-vim/source/detail?r=c2479...
Ultimately Bram Moolenaar sent me a reply:
"""
Justin,
I think the audience for this would be too small.
- Bram
"""
However, in 7.3.787 (Jan 2013) a patch was introduced which showed the current line number in :rnu instead of 0. That's definitely in the direction that this patch was going in.
So, I didn't get a patch in, but on the plus side, I did learn a bunch about vim's source code.
Feature request: allow the user to select separate colors for the relative and absolute line numbers, and for the slash. So three separate colors in total. That would make it easier to read.
Another idea is to have relative line numbers on the left side of the screen, and absolute line numbers on the right (or vice-versa).
On a side note, to your second request of left-side/right-side splits for line numbers: my first experimentation was to do just that. Left side was rnu and right side was nu, but the way vim's buffers work out, it wasn't very practical. It also caused headaches for rtl text and so on if I remember correctly.
I'd like to suggest that using absolute line numbers shortens this considerably. For example
:43,48m63
removes lines 43 to 48 and inserts them after line 63 regardless of the current cursor position (no need to move cursor).
Not saying relative line numbers are bad, just, there's a quicker way, at least for the demo use case.
5dd
at the start of the block.I would argue that the author's way is the more idiomatic usage of vim.
What is the rationale behind "relative in normal mode and absolute in insert mode"?
relativenumber is useful for quick navigation with 6j or 10k or defining a target for operators with c6j or d10k. Relative numbers are a tool for better text editing.
number is slightly less useful for navigation when in a large buffer: 6j or v6j are obviously a little better than 4321G or v4321. But I'd argue that the purpose of absolute numbers is more to provide information than to be used as a tool.
I've observed that using one or the other is mostly a matter of taste, though, and needs.
But the "relative in normal mode and absolute in insert mode" part sounds strange.
How are line numbers any useful in insert mode when there's traditionally no editing or cursor movement beyond the same line or maybe a couple of lines above/below?
I recently came across a slightly better take on the rnu vs nu "problem",
https://github.com/vim-scripts/RelOps
that switches to relativenumber when you hit an operator like c or y and puts you back to number when you are done. This sounds a lot more sensible and less arbitrary to me: you get rnu when it's useful (for defining a target for your operator) and nu elsewhere. Still you get to do 4321G, though.
Too bad the author doesn't get as much coverage as this one.
"relative number switches - show numbers in insert mode, relative in normal
autocmd InsertEnter * :set number
autocmd InsertLeave * :set relativenumber
set relativenumber
autocmd InsertEnter,WinLeave * :set norelativenumber
autocmd InsertLeave,WinEnter * :set relativenumber
(Also, :set number does not reset to non-relative numbers anymore for me)That said, VIM patch 7.3.787 provides a 'better' solution by replacing the current line's number with the absolute number (because seeing 0 on the current line provides nothing meaningful) IMHO:
with 'relativenumber' can't see the absolute line number
ftp://ftp.vim.org/pub/vim/patches/7.3/7.3.787That said, put me in the category of crotchety old Vim users (even though I'm only 20) who really don't have a use for this. Potential use cases:
Scrolling: If it's a few lines, I tap j a few times--or guesstimate a number prefix. It's just scrolling--no precision needed. If it's more than a few lines, I use C-d/C-u. If I need to teleport to a line I know about, :<absolute linenum> is fine.
Yanking/Deleting/Changing/Indenting: I turn on visual line mode (V), and proceed as above. Or, depending on the language I'm in, I'll do, for example, yi{ to yank everything in the current block. Or use () judiciously.
So...what's the actual use case for this? Not trying to be critical--I just want to understand how I'd integrate it into my workflow.
The only problem is that it's new in vim 7.3, so there are times where I'm forced to use an older version of vim and can't use the feature. I'll look up 10 lines, see "583" and automatically hit 583k without thinking. Not a big deal, and of course I can just do 583G to fix my mistake, but it's definitely some combination of funny and irritating.
And in case if you ever wondered, why the ESC key is used to change to normal mode, you should read up on the history of the escape key. Therefore I use CTRL-<P> to switch to normal mode, so my hands can stay on the keyboard.
Be a Vim user, not an SPF13 user.
Also, you don't need to remap <Esc> to <C-p> as there's already <C-[> or (the slightly different) <C-c>.
And it's Vundle, not VBundle.
Position the cursor at the start of the function, then d} (delete 1 paragraph forward). Alternatively if you don't have a clean paragraph boundary, use V to start a visual highlight, then move the cursor (up,down,},10down,whatever) to the end, then d to delete.
Then } (move 1 paragraph forward)
Then p to paste
TERM=screen-256color-s cleared it up for me using tmux/urxvt (with 256 colors).
(Also, great plugin!)
[1]: https://github.com/tpope/vim-unimpaired
[2]: http://vim-doc.heroku.com/view?https://raw.github.com/tpope/...
If you haven't tried it, EasyMotion is far, far better and contains much more functionality (covers far more use cases).
Say I want to move 6 lines down. I use 6j, but one of the lines I want to jump over is wrapped and occupies 2 lines in my editor. That will mean my cursor will end up at the line that was previous numbered 5. This behavior drives me nuts.
Here's something a little more complicated, which may or may not be more useful:
http://jeffkreeftmeijer.com/2012/relative-line-numbers-in-vi...
And if you use Mac OSX and latest vim version installed by homebrew, in relative line number mode of vim, instead of 0 it is the row line number.
Hats off to you, sir!