Sunday, June 14, 2015

Re: pass vim variable to python script

2015-06-14 18:26 GMT+03:00 Rick Dooling <rpdooling@gmail.com>:
> So let's say I want the current line number in the Vim Buffer
>
> let x=line(".")
>
> And then I want to do something with it inside my Python script.
> How do I refer to it? Or if there is a way to get the current line number using the python vim module? I see vim.current.line but this is a string of the line itself?
>
>
> function! Script()
>
> let x=line(".")
>
> python << EOF
>
> import vim
>
> (how to refer to x?)

:h if_pyth.txt, it contains answers to both questions.

First, there is vim.bindeval/vim.eval.
Second, there is vim.current.window.cursor.

>
>
> EOF
>
> Thanks
>
> Rick
>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: