Re: Retrieve Blocked Text in Visual Mode with Python?
- "Dennis Craven" <dcraven@...> wrote:
> On Sat, 2006-25-02 at 23:53 +0200, Yakov Lerner wrote::he python-eval
> > On Sat, 25 Feb 2006 16:37:58 -0500, "Dennis Craven" <dcraven@...>
> > said:
> > > Hello,
> > >
> > > Is there a way using the Python module/interface to get the currently
> > > highlighted text? I didn't see a way using the information given in the
> > > vim-python documentation. If not, can it be acquired with vim script and
> > > passed to a Python function?
> > >
> > > Even if it's just the lines that are highlighted, that would be fine too
> > > (ie. linewise-visual only?). I can easily get the entire buffer, and I
> > > see reference to a "range", but I'm not sure how to use that range in
> > > the example above to get say, the range of lines that are currently
> > > highlighted.
> > :vmap <f2> :MyCommand<cr>
> > :command -range MyCommand :call MyFunction(<line1>,<line2>)
> > function MyFunction(line1,line2)
> > echo "ok, visual range is ".line1."..".:line2"
> > endfu
> I guess my question is more one of using these variables within Python
> now that they are populated in the Vim script.
let you access vim variable from python code
http://www.fastmail.fm - Choose from over 50 domains or use your own