Tuesday, May 14, 2013

Re: evaluating vim functions in search mappings

Okay, I recognized your point that = is a register and read up on
registers, and now I see what you mean. Also, your point about
indent(line('.')) was right. Thank you!

map ]0 /^\s\{0,^V^R=indent(line('.'))^V^M}\S^V^M
map [0 ?^\s\{0,^V^R=indent(line('.'))^V^M}\S^V^M

cts


---------------------------------------------------------
http://www.creative-telcom-solutions.de/

On 14 Mai, 18:44, Ben Fritz <fritzophre...@gmail.com> wrote:
> On Tuesday, May 14, 2013 7:18:34 AM UTC-5, Charles Smith wrote:
>
> > But I guess it's just not possible to invoke a vim function from
>
> > within \{} - or maybe it's a lost art....
>
> What gave you that idea?
>
> You tried using CTRL-R to get the expression register in a mapping, which can be done, but you forgot to also accept the expression register content to execute the expression by inserting a CTRL-M. So you could either do ^R=somefunc()^M where ^R and ^M are literal CTRL-R and carriage return characters, or even better (in a mapping) use the map syntax <C-R> and <CR>/<C-M>/<Enter>. Even BETTER, is to use an expression mapping. :help :map-<expr>.

--
--
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/groups/opt_out.

No comments: