Thursday, February 13, 2020

Re: nested expr in a mapping

On 2020-02-13, M Kelly wrote:
> Hi,
>
> Is it posible to nest conditionals in a mapping, something like, just for
> demonstration:
>
> vnoremap <expr> vv (strlen(@y) == 1) ? ':let ...' : '("vcl" =~ getregtype("*"))
> ? 'some foo' : 'some bar' ' <bar> some more ...
>
> Can we do this ?

Yes. See

:help 41.3
:help expr1
:help :map-<expr>
:help matchup.txt " lines 896-900 for some examples

> Do I use ''' (3 single quotes) to embed quotes ?  (and then 5
> for a 2nd level embed ...) ... ?

No. Expressions are not nested using quotes. You may use
parentheses if you wish, or just use the precedence rules.

It would be easier to help you if we knew what you had tried, the
actual results, and what you expected.

Regards,
Gary

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200214042128.GC9366%40phoenix.

No comments: