Question

I'm using the Vim plugin in Eclipse, and only thing that would make me more happy would be if I could somehow measure distance from current line to all other lines. It is kinda hard to guess exact number of lines i.e. is that 8 or 9 lines I need to move down? So some kind of modification of the line numbering bar that changes the numbers to be relative (+-) to the current line would be nice to have.

Is there something like this? If not I'm so desperate that I will probably try to build it myself.

Was it helpful?

Solution

Standalone vim has the relativenumber option in version 7.3 that does what you want. I don't know how closely related that is to the eclipse plugin, or how difficult it would be to port over.

Before that option was available, I used to make heavy use of marks instead of guessing relative line numbers. Basically, you mark a line with m followed by a letter of the alphabet, and can move to that line with ' followed by the same letter. Maybe that will help if you don't already know about it.

OTHER TIPS

Install the Relative Line Number Ruler plugin. It shows a relative line number ruler by default, which can be disabled using the context menu on the ruler. The diff/absolute line number ruler can still be displayed if desired.

This is useful if you're using a Vi emulation plugin such as Vrapper.

The relative number plugin can be so slow. I am using this in my vimrc:

let g:RTL = 1

function X_rtl()
    if g:RTL == 0
        set number 
        let g:RTL = 1
    else
        set relativenumber
        let g:RTL = 0
    endif
endfunction

nnoremap <esc><esc> :call X_rtl()<cr>

So if I hit escape twice, it will change numbers to relative, and if I hit it twice again, it will switch back;

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top