Ruby-vim line number

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?

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?

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 :slight_smile:

···

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