Wednesday, July 20, 2011

Re: where does Win7's VIM read my .vimrc files from?

On 20/07/11 01:03, Linda W wrote:
>> John Trammell wrote:
>>> fileencodings=ucs-bom,utf-16le,utf-8,default,latin1
>> ----
>> That does it!...thanks!...
> ---
> I Prematurely spoke, since it worked wtih utf-16le, but I later found
> that I couldn't read normal utf-8 files! So...it really didn't.

Yeah, usually I leave it at something not very different from the
default, in my case I use

:set fileencodings=ucs-bom,utf-8,latin1

and when I need to edit something in some "outlandish" encoding, I use
++enc (e.g. ++enc=utf-16le or ++enc=Windows-1252 or whatever)
immediately after the command name (and before the filename). The
relevant help subject is

:help ++opt

>
> The only solution (gonna have to remember this -- maybe a macro
> in my vimrc!)
>
>>> You can always leave fileencodings as-is, and use :e ++enc=utf-16le to
>>> work around the problem without messing with options.
>> ---
>> Didn't know about that one...and now, probably won't remember it cuz I
>> won't need it for a real long time (until I run into some other weird
>> format), and by
>> then...I'll ...well maybe I'll remember it.... :-).... (but I wouldn't
>> promise!)
> ---
> Gonna have to remember it, it's the only one that works!
>
>
> (Unless one has some fileencodings order that would work...but seems like
> there are few illegal sequences to detect, either under utf-16le, or
> utf-8).

You might try :set fencs=ucs-bom,utf-8,utf-16le,latin1

which should work better than with UTF-16le before UTF-8, because UTF-8
has very strict rules about which byte sequences are acceptable, so it
is extremely unlikely bordering on impossible that you'll ever find a
nonzero-length UTF-16 file (in any endianness) which contains from start
to end no single byte sequence which is invalid for UTF-8. However the
danger with this setting is that Vim might misdetect latin1 files,
thinking that they are in UTF-16.

>
> Just wanted to give anyone an update, as I returned to this string to
> 'remember'
> the ":e ++enc=utf-16le", when I found I needed it again (so soon).
>
> so time to add it to some vimrc macro or comment...
>
> linda
>
>
>

Best regards,
Tony.
--
"You know, it's at times like this when I'm trapped in a Vogon
airlock with a man from Betelgeuse and about to die of asphyxiation in
deep space that I really wish I'd listened to what my mother told me
when I was young!"
"Why, what did she tell you?"
"I don't know, I didn't listen!"
-- Douglas Adams, "Hitchhiker's Guide to the Galaxy"

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

No comments: