Tuesday, February 10, 2015

Re: obtain current visual selection

On Tuesday, February 10, 2015 at 2:22:35 AM UTC-6, Enno wrote:
> Hello,
>
> There is a thread on StackOverflow labelled
>
> "How to get visually selected text in VimScript"
>
> The naive and stable approach would be
>
> let old_reg = @v
> normal! gv"vy
> let raw_search = @v
> let @v = old_reg
> return raw_search
>
> but that only works if `set nosecure`. If `set secure` then
> the functions become involved. I posted my own take at
>

Can you explain what your problem with the 'secure' option is? I tried this test script, and can echo the return value just fine:

set secure
fun! GetVis()
let old_reg = @v
normal! gv"vy
let raw_search = @v
let @v = old_reg
return raw_search
endfun

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

Post a Comment