Thursday, February 12, 2015

Re: why does showbreak setting works only after _vimrc is reloaded?

On Thursday, February 12, 2015 at 7:55:07 AM UTC-6, FlashBurn wrote:
> I run gVim on Windows 7. I have my showbreak set as follows
>
> set showbreak=…
>
> However for some reason when my line is too long I see the following symbol:
> ¿
>
> I have to reload my _vimrc file in order to display …
>
> Does anybody know what is the issue and what I'm doing wrong?
>
> Any help is appreciated.

I'm going to make a guess, but I don't know what your settings are, so this is just a guess.

Probably, your Vim is starting up using the default encoding in Windows, which is probably an 8-bit encoding like cp1252 (and Vim will use Latin1).

You probably set encoding to utf-8 in your .vimrc somewhere, to better support characters like '…'

But since Vim started in a different encoding, it does not read the bytes correctly in "set showbreak=…" when parsing your .vimrc. Therefore, it uses some other character (or an unknown character). But when you re-source your .vimrc, it reads the bytes correctly.

If this is the cause, then possible fixes include:

1. Place an appropriate "scriptencoding" command in your .vimrc, to tell Vim how to read the bytes in the file. For example, "scriptencoding utf-8".
2. Use the escape syntax of strings and a :let command, instead of a :set command, somewhere AFTER setting Vim's 'encoding' option. For example:
let &showbreak="\u2026"

If this does not sound like the cause, then what is your 'encoding' value set to, and where does that setting occur in relation to your showbreak setting?

--
--
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