Sunday, October 30, 2016

Re: Setting dynamic value to colorcolumn

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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: