Re: Setting fenc or enc from an autocommand

2009-11-23 Thread Alessandro Antonello
Thanks Tony. You explanation help me a lot. Best regards. Alessandro Antonello --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~

Re: Setting fenc or enc from an autocommand

2009-11-20 Thread Tony Mechelynck
On 25/10/09 04:35, Alessandro Antonello wrote: > > Hi, guys. > > I want to thank you all the ideas. My current setting of 'fenc' is: > > fencs=ucs-bom,latin1,utf-8,utf-16le > fenc=latin1 bomb > > This works fine when I have two or more files opened in VIM with latin1 and > utf-16 encodings. When I

Re: Setting fenc or enc from an autocommand

2009-10-24 Thread Alessandro Antonello
Hi, guys. I want to thank you all the ideas. My current setting of 'fenc' is: fencs=ucs-bom,latin1,utf-8,utf-16le fenc=latin1 bomb This works fine when I have two or more files opened in VIM with latin1 and utf-16 encodings. When I switch out and back utf-16 files VIM recognizes then correctly.

Re: Setting fenc or enc from an autocommand

2009-10-22 Thread pansz
bill lam 写道: >> thread is all about. The suggested utf8-guess pseudo encoding would >> work >> similar to the bomb pseudo encoding but wouldn't simple look at the >> first character but scan the whole buffer. > > I remembered there is a vim script that detect various chinese file > encodings by s

Re: Setting fenc or enc from an autocommand

2009-10-22 Thread Tom Link
> I remembered there is a vim script that detect various chinese file > encodings by scanning its content, but I do not use that.  I don't > remember whether it scans the entire file or just a configurable > number of lines. I guess you mean FencView[1], which seems to use :edit ++enc=ENC to relo

Re: Setting fenc or enc from an autocommand

2009-10-22 Thread bill lam
> thread is all about. The suggested utf8-guess pseudo encoding would > work > similar to the bomb pseudo encoding but wouldn't simple look at the > first character but scan the whole buffer. I remembered there is a vim script that detect various chinese file encodings by scanning its content, bu

Re: Setting fenc or enc from an autocommand

2009-10-22 Thread Tom Link
> Shouldn't new file be saved using encoding according to fenc ? The problem is that if you read a file that doesn't contain any non- utf8 characters, vim assumes it's utf8 encoded. If you then insert international characters and miss to set fenc, you end up with an utf8 encoded file. > > IMHO i

Re: Setting fenc or enc from an autocommand

2009-10-22 Thread pansz
Alessandro Antonello 写道: > Hi, All. > > I gladly appreciate the enthusiastic discussion about ASCII, UTF-8, BOM, etc. > But I still have a question. What is the better way to configure VIM to > recognize some kind of file encodings? Counting that I use Latin1 one on day > bases but, sometimes, I

Re: Setting fenc or enc from an autocommand

2009-10-21 Thread bill lam
On Wed, 21 Oct 2009, Tom Link wrote: > > > set fileencodings=utf-8-bom,ucs-bom,utf-8,default,latin1 > > This will make new file be encoded as utf8 which is not what the user > wanted. He had to reset the value after reading the file. > Shouldn't new file be saved using encoding according to fe

Re: Setting fenc or enc from an autocommand

2009-10-21 Thread Tom Link
> set fileencodings=utf-8-bom,ucs-bom,utf-8,default,latin1 This will make new file be encoded as utf8 which is not what the user wanted. He had to reset the value after reading the file. IMHO it would be nice to have an uft-8-guess pseudo encoding that sets fenc to utf8 if a file includes any sp

Re: Setting fenc or enc from an autocommand

2009-10-21 Thread bill lam
On Thu, 22 Oct 2009, Alessandro Antonello wrote: > There is a better or "easy" way to accomplish the task I mentioned above? does it help if you set fencs to something similar to, set fileencodings=utf-8-bom,ucs-bom,utf-8,default,latin1 -- regards, =

Re: Setting fenc or enc from an autocommand

2009-10-21 Thread Alessandro Antonello
Hi, All. I gladly appreciate the enthusiastic discussion about ASCII, UTF-8, BOM, etc. But I still have a question. What is the better way to configure VIM to recognize some kind of file encodings? Counting that I use Latin1 one on day bases but, sometimes, I need to work with UTF-8 or UTF-16le.

Re: Setting fenc or enc from an autocommand

2009-10-21 Thread Matt Wozniski
On Wed, Oct 21, 2009 at 1:49 AM, Christian Brabandt wrote: > > On Wed, October 21, 2009 12:54 am, Matt Wozniski wrote: >> bash-3.2$ echo 'int main() { printf("Matt\n"); }' > print_my_name.c >> bash-3.2$ gcc print_my_name.c -o print_my_name > [...] >> bash-3.2$ ./print_my_name >> Matt Wozniski > >

Re: Setting fenc or enc from an autocommand

2009-10-20 Thread Christian Brabandt
On Wed, October 21, 2009 12:54 am, Matt Wozniski wrote: > bash-3.2$ echo 'int main() { printf("Matt\n"); }' > print_my_name.c > bash-3.2$ gcc print_my_name.c -o print_my_name [...] > bash-3.2$ ./print_my_name > Matt Wozniski Now that is a really smart printf routine. ;) SCNR, Christian -- :wq

Re: Setting fenc or enc from an autocommand

2009-10-20 Thread Matt Wozniski
Note that this message contains some embedded utf-8 zero-width non-breaking spaces. If you can't see them good. :) You should be able to figure out where they are from context, though. On Tue, Oct 20, 2009 at 1:26 PM, Tony Mechelynck wrote: > > On 20/10/09 05:17, pansz wrote: >> If you us

Re: Setting fenc or enc from an autocommand

2009-10-20 Thread Tony Mechelynck
On 20/10/09 10:58, Christian Brabandt wrote: > > On Tue, October 20, 2009 1:25 am, Tony Mechelynck wrote: > >> As for using UTF-8 with BOM, I have no statistics on it about what >> other people do, but I found it to be (as the FAQ quoted above said) >> an excellent signature to mean that a file is

Re: Setting fenc or enc from an autocommand

2009-10-20 Thread Tony Mechelynck
On 20/10/09 05:17, pansz wrote: > > Tony Mechelynck 写道: >> As for using UTF-8 with BOM, >> I have no statistics on it about what other people do, but I found it to >> be (as the FAQ quoted above said) an excellent signature to mean that a >> file is in UTF-8. This ought not to conflict with shell

Re: Setting fenc or enc from an autocommand

2009-10-20 Thread Tony Mechelynck
On 20/10/09 07:08, bill lam wrote: > > On Tue, 20 Oct 2009, Tony Mechelynck wrote: >> What makes you think so? On the contrary, I believe that use of a BOM >> with any Unicode text (including UTF-8) will become more frequent as >> conformant applications become the rule rather than the exception.

Re: Setting fenc or enc from an autocommand

2009-10-20 Thread Christian Brabandt
On Tue, October 20, 2009 1:25 am, Tony Mechelynck wrote: > As for using UTF-8 with BOM, I have no statistics on it about what > other people do, but I found it to be (as the FAQ quoted above said) > an excellent signature to mean that a file is in UTF-8. I had occasionally problems, when a plugi

Re: Setting fenc or enc from an autocommand

2009-10-19 Thread bill lam
On Tue, 20 Oct 2009, Tony Mechelynck wrote: > What makes you think so? On the contrary, I believe that use of a BOM > with any Unicode text (including UTF-8) will become more frequent as > conformant applications become the rule rather than the exception. > I respect your choice of using utf8

Re: Setting fenc or enc from an autocommand

2009-10-19 Thread Tony Mechelynck
On 20/10/09 03:22, bill lam wrote: > > On Tue, 20 Oct 2009, Tony Mechelynck wrote: >> @bill lam: I am not at all convinced that "everyone on Linux uses UTF-8" >> and also not that "no one uses it with a BOM". These assertions sound to >> me like wishful thinking, overgeneralizations, and the same

Re: Setting fenc or enc from an autocommand

2009-10-19 Thread pansz
Tony Mechelynck 写道: > As for using UTF-8 with BOM, > I have no statistics on it about what other people do, but I found it to > be (as the FAQ quoted above said) an excellent signature to mean that a > file is in UTF-8. This ought not to conflict with shell scripts, which > cannot have any BOM

Re: Setting fenc or enc from an autocommand

2009-10-19 Thread bill lam
On Tue, 20 Oct 2009, Tony Mechelynck wrote: > @bill lam: I am not at all convinced that "everyone on Linux uses UTF-8" > and also not that "no one uses it with a BOM". These assertions sound to > me like wishful thinking, overgeneralizations, and the same sort of There are of course some who i

Re: Setting fenc or enc from an autocommand

2009-10-19 Thread Tony Mechelynck
On 19/10/09 08:29, pansz wrote: > > Tony Mechelynck 写道: >> - If you want one particular file to be recognized as UTF-8 not only by >> Vim but also by other programs (let's say by other Windows editors such >> as WordPad; or by browsers if the files are in HTML, CSS or even >> plaintext) it helps i

Re: Setting fenc or enc from an autocommand

2009-10-19 Thread bill lam
On Mon, 19 Oct 2009, pansz wrote: > > Tony Mechelynck 写道: > > - If you want one particular file to be recognized as UTF-8 not only by > > Vim but also by other programs (let's say by other Windows editors such > > as WordPad; or by browsers if the files are in HTML, CSS or even > > plaintext)

Re: Setting fenc or enc from an autocommand

2009-10-18 Thread pansz
Tony Mechelynck 写道: > - If you want one particular file to be recognized as UTF-8 not only by > Vim but also by other programs (let's say by other Windows editors such > as WordPad; or by browsers if the files are in HTML, CSS or even > plaintext) it helps if you use ":setlocal bomb" (or maybe

Re: Setting fenc or enc from an autocommand

2009-10-18 Thread Tony Mechelynck
On 23/09/09 07:56, pansz wrote: > > Tom Link 写道: >> Hi, >> >> Is there a way to set the fenc option from an autocommand so that I >> would get the same effect as if I opened the file with :edit + >> +enc=utf8 FILENAME >> >> The background: I usually use (f)enc=latin1 but would like to edit the >>

Re: Setting fenc or enc from an autocommand

2009-09-23 Thread lith
Hi, Thanks you both for your tips. > fencs=ucs-bom,utf-8,latin1 The problem with that is, as you (pansz) explained, is that this defaults to utf8 for new files. In the past I sometimes ended up with utf8 encoded files that caused some trouble when editing/processing with non-unicode aware progr

Re: Setting fenc or enc from an autocommand

2009-09-23 Thread Matt Wozniski
On Wed, Sep 23, 2009 at 1:07 AM, Tom Link wrote: > > Hi, > > Is there a way to set the fenc option from an autocommand so that I > would get the same effect as if I opened the file with :edit + > +enc=utf8 FILENAME > > The background: I usually use (f)enc=latin1 but would like to edit the > files

Re: Setting fenc or enc from an autocommand

2009-09-22 Thread pansz
Tom Link 写道: > Hi, > > Is there a way to set the fenc option from an autocommand so that I > would get the same effect as if I opened the file with :edit + > +enc=utf8 FILENAME > > The background: I usually use (f)enc=latin1 but would like to edit the > files in a certain directory with fenc=utf

Setting fenc or enc from an autocommand

2009-09-22 Thread Tom Link
Hi, Is there a way to set the fenc option from an autocommand so that I would get the same effect as if I opened the file with :edit + +enc=utf8 FILENAME The background: I usually use (f)enc=latin1 but would like to edit the files in a certain directory with fenc=utf8. I currently reopen the fil