[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ruby-vim line number

tsuraan

6/17/2005 3:38:00 PM

This might be more appropriate on a vim list, but I'll give it a go here...

Does anyone know a way, using vim-ruby, to determine what line of a
given buffer is currently active?

I'm jumping around in a huge cpp file using ctags, and I thought it
would be really nice to write a ruby script to say what function I'm
currently looking at, but I can't figure out how to get the current
line number into my ruby script. Any ideas?


3 Answers

Kent Sibilev

6/17/2005 4:35:00 PM

0

Try

:ruby p VIM::Window.current.cursor

returns [row, col] array

Kent.

On 6/17/05, tsuraan <tsuraan@gmail.com> wrote:
> This might be more appropriate on a vim list, but I'll give it a go here..
>
> Does anyone know a way, using vim-ruby, to determine what line of a
> given buffer is currently active?
>
> I'm jumping around in a huge cpp file using ctags, and I thought it
> would be really nice to write a ruby script to say what function I'm
> currently looking at, but I can't figure out how to get the current
> line number into my ruby script. Any ideas?
>
>


Ryan Leavengood

6/17/2005 4:46:00 PM

0

Kent Sibilev said:
> Try
>
> :ruby p VIM::Window.current.cursor
>
> returns [row, col] array

There is also a global for the current window, so this works too:

$curwin.cursor

Ryan


tsuraan

6/17/2005 5:08:00 PM

0

On 6/17/05, Ryan Leavengood <mrcode@netrox.net> wrote:
> Kent Sibilev said:
> > Try
> >
> > :ruby p VIM::Window.current.cursor
> >
> > returns [row, col] array
>
> There is also a global for the current window, so this works too:
>
> $curwin.cursor
>
> Ryan
>
>

Ah, I had thought that was for coordinates from the top-left corner of
the screen, not the text buffer. Thanks!

I guess I can get rid of the VIM::evaluate("line('.')") hack now :)