Re: setlocal enc=utf8 and mappings
Hi Tony :) * A.J.Mechelynck <[EMAIL PROTECTED]> dixit: > DervishD wrote: > >Am I doing anything wrong? Should I set another thing so even > >with > >"enc=utf8" my high-bit-set-mapleader still works? Should I set > >"mapleader" to the utf8 value? > > Regarding your Subject: 'encoding' is a global option; it defines how > the characters are represented internally in memory for _all_ buffers. Yes, I forgot, sorry O:)) > When you store a mapping, it is stored in the 'encoding' current at > the moment the mapping is defined. If that 'encoding' is Latin1, the > letter ç (small c-cedilla) is stored as the single byte 0xE7. That's what I assumed. > After ":set encoding=utf-8", the byte 0xE7 is invalid unless it is > immediately followed by two bytes in the range 0x80-0xBF. The small > c-cedilla is still the codepoint U+00E7 but that codepoint is now > represented in memory as the two bytes 0xC3 0xA7. > > Therefore, you should set 'encoding' early in your vimrc, as follows: And this I cannot do... I wanted to avoid considering ASCII files as utf-8, therefore my "fileencodings" is empty. By default, "enc" is latin1, and I only change it, by hand (well, with a mapping) the 1 in 1 times I edit an utf-8 file that doesn't have a BOM mark. I do this by setting, manually, "enc". My error was to consider "enc" local to the buffer and not global. So it looks like I will have to choose an ASCII-7 mapleader (my first option) OR add new mappings as soon as I "set enc=utf-8" using a new value for leader. None of the solutions is a great deal, anyway. Thanks a lot for your fast and good answer, as always :)) Raúl Núñez de Arenas Coronado -- Linux Registered User 88736 | http://www.dervishd.net It's my PC and I'll cry if I want to... RAmen!
Re: setlocal enc=utf8 and mappings
DervishD wrote: Hi all :) I'm having a problem that I know how to solve, but I wonder if I'm doing the right thing... Some weeks ago I asked a couple of things about encodings on the list, and based on the answers, I finally did a proper setup to edit UTF-8 files from time to time in my latin1 terminal, while at the same time treating new ASCII files as latin1 and not utf-8. This works OK. But now my problem is the following. I've chosen "ç" as my mapleader. This is due its position in my keyboard. BUT, its code in latin1 is 0xe7 and, in utf8 it's 0xc3+0xa7. This means (and this is my problem) that if I set "setlocal enc=utf8", I'm no longer able to use it as my mapleader as-is. I still generate "ç" when I press it, of course, and vim translates it onto something my terminal understands as "ç". I assumed that it was doing the same for mappings, but it is not. Am I doing anything wrong? Should I set another thing so even with "enc=utf8" my high-bit-set-mapleader still works? Should I set "mapleader" to the utf8 value? Thanks a lot in advance :) Raúl Núñez de Arenas Coronado Regarding your Subject: 'encoding' is a global option; it defines how the characters are represented internally in memory for _all_ buffers. When you store a mapping, it is stored in the 'encoding' current at the moment the mapping is defined. If that 'encoding' is Latin1, the letter ç (small c-cedilla) is stored as the single byte 0xE7. After ":set encoding=utf-8", the byte 0xE7 is invalid unless it is immediately followed by two bytes in the range 0x80-0xBF. The small c-cedilla is still the codepoint U+00E7 but that codepoint is now represented in memory as the two bytes 0xC3 0xA7. Therefore, you should set 'encoding' early in your vimrc, as follows: set nocompatible if has("unix") language messages C else language messages en endif runtime vimrc_example.vim if has("multi_byte") if &enc !~? '^u' if &tenc == "" let &tenc = &enc endif set enc=utf-8 endif set fencs=ucs-bom,utf-8,latin1 setglobal bomb fenc=latin1 else echomsg "Multi-byte support not compiled-in" endif ... let mapleader = "\" ... map abc call myFunctionABC() ... Best regards, Tony. -- In specifications, Murphy's Law supersedes Ohm's.
setlocal enc=utf8 and mappings
Hi all :) I'm having a problem that I know how to solve, but I wonder if I'm doing the right thing... Some weeks ago I asked a couple of things about encodings on the list, and based on the answers, I finally did a proper setup to edit UTF-8 files from time to time in my latin1 terminal, while at the same time treating new ASCII files as latin1 and not utf-8. This works OK. But now my problem is the following. I've chosen "ç" as my mapleader. This is due its position in my keyboard. BUT, its code in latin1 is 0xe7 and, in utf8 it's 0xc3+0xa7. This means (and this is my problem) that if I set "setlocal enc=utf8", I'm no longer able to use it as my mapleader as-is. I still generate "ç" when I press it, of course, and vim translates it onto something my terminal understands as "ç". I assumed that it was doing the same for mappings, but it is not. Am I doing anything wrong? Should I set another thing so even with "enc=utf8" my high-bit-set-mapleader still works? Should I set "mapleader" to the utf8 value? Thanks a lot in advance :) Raúl Núñez de Arenas Coronado -- Linux Registered User 88736 | http://www.dervishd.net It's my PC and I'll cry if I want to... RAmen!