Pablo Giménez wrote:
Hello vims.
I have recently begin to use UTF-8 as the default encoding I picked up this
snippet and put it in my vimrc to enable it:
if has("multi_byte")
  if &termencoding == ""
    let &termencoding = &encoding
  endif
  set encoding=utf-8
  setglobal fileencoding=utf-8 bomb
  set fileencodings=ucs-bom,utf-8,latin1
endif

It is working fine, but then I discover that some of my keymaps does't work,
stuff mapped to <M-S-CR> or similar for instance.
Looking at what :map return I got some funny character for these mapping
rather then the correct ones.
So I guessd it was beocause of the encoding, and yesm when I commented the
code used to set utf-8 and restar, vim starts qit latin1 encodingand all
maps are fine.
So how I can use UTF-8 and don't mess my maps???

Pablo,
When you switched to utf-8, your terminal started handling "metafied" characters differently. In a non-utf-8 terminal, for example, hitting M-p would send an 8-bit character with the most significant bit set: i.e., 0xF0 (metafied p). A Unicode terminal, on the other hand, would encode this as the 2 byte utf-8 sequence 0xC3 0xB0. Most programs will not interpret this as metafied p. One way to circumvent the problem is to have the terminal convert metafied characters to escape sequences. e.g.,
Meta-p ==> ESC p

You can do this with xterm resource settings. Here's what I have in my .Xdefaults file:

XTerm*vt100.altSendsEscape: true
XTerm*vt100.altIsNotMeta: true

You can read about both options in the xterm man page. altIsNotMeta may or may not apply to you. It instructs the terminal to treat Alt as a Meta key. The important option here is altSendsEscape. It instructs the terminal to convert metafied characters (e.g., 0xF0) to the 2 byte ASCII sequence created by stripping the 8th bit and prepending an ESC (0x1B). Thus, 0xF0 becomes 0x1B 0x70 (i.e., ESC p).

Hope this helps...
Brett Stahlman

thanks



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

Reply via email to