Setting dynamic value to colorcolumn

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting dynamic value to colorcolumn

Fabien Meghazi-2
Hi,

I'm sorry for my vimL ignorance but how can I append a value to colorcolumn ?

    :let &colorcolumn+=getcurpos()[4]

gives me

     Wrong variable type for +=

I guess it's because I should add a list to a list but I don't know how to express it.

--

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Setting dynamic value to colorcolumn

Gary Johnson-4
On 2016-10-30, Fabien Meghazi wrote:

> Hi,
>
> I'm sorry for my vimL ignorance but how can I append a value to colorcolumn ?
>
>     :let &colorcolumn+=getcurpos()[4]
>
> gives me
>
>      Wrong variable type for +=
>
> I guess it's because I should add a list to a list but I don't know how to
> express it.

'colorcolumn' is string containing a comma-separated list of column
numbers.  It is not a list in the sense of ":help 41.8".

In the context of the :let command, += means to arithmetically add,
not add to a list or append to a string, so your command is
attempting to increment the vaule of a string.  Try this instead:

    :let &colorcolumn.=','.getcurpos()[4]

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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Setting dynamic value to colorcolumn

Fabien Meghazi-2
On Sun, Oct 30, 2016 at 6:27 PM, Gary Johnson <[hidden email]> wrote:
    :let &colorcolumn.=','.getcurpos()[4]

Thanks 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 [hidden email].
For more options, visit https://groups.google.com/d/optout.