2015-04-26 20:42 GMT+03:00 lith <minilith@gmail.com>:
> Hi!
>
> What's the best way to create a function that creates functions?
>
> I currently construct a string with the vim code, put that into a register, and then evaluate the register. See https://github.com/tomtom/tcomment_vim/blob/master/plugin/tcomment.vim#L165 for an example.
It is very strange to do this via a register. Just use `execute join(fn, "\n")`.
Also note that `let @t=t` does *not* restore register correctly. E.g. try
call setreg('a', ['a', 'b', 'c'], 'b1')
echo getregtype('a') " Echoes ^V1
let @a=@a
echo getregtype('a') " Echoes v: register type is determined
automatically at `let @a` and is never block
. Also
let reg = ["a\n", "b"]
call setreg('a', reg)
let @a=@a
echo reg ==# getreg('a', 1, 1) " Echoes 0: NUL cannot be restored
via `let @a`
.
>
> This works well but seems to cause serious problems in certain situations with certain installations. See here for an example report: https://github.com/tomtom/tcomment_vim/issues/140
>
> Is this a known issue with certain versions of gvim?
>
> Is there an alternative way to achieve this that doesn't cause the problem reported above?
>
> Regards,
> Tom
>
> --
> --
> 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:
Post a Comment