Wednesday, August 22, 2012

Re: Using Alt in my keymaps and utf-8



2012/8/22 Erik Christiansen <dvalin@internode.on.net>
On 21.08.12 08:19, Ben Fritz wrote:
> Even though Vim sees the keys as a Unicode character, pressing the
> keys should still execute the mapping.
>
> I don't think Vim can reliably do CTRL+Alt mappings, but I believe
> Alt-{key} mappings normally work fine.
Thanks all for your answers.
I am using Vim with terminals Mrxvt in Linux and iTerm2 in the Mac.
I have the same problem in Gvim as well.

Mostly. Over here, with:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Apr 18 2012 19:32:03)
Included patches: 1-496

these Alt mappings work for me in more cases than not:

" Putting åæø and «» on Alt, is handier than digraphs:
inoremap <expr> <A-a> "\uE5"
inoremap <expr> <A-e> "\uE6"
inoremap <expr> <A-o> "\uF8"
inoremap <expr> <A-<> "\uAB"
inoremap <expr> <A->> "\uBB"

They work fine in insert mode, and for single character replacement,
using "cl", but fail when using "r". e.g.

Applying "cl<A-a>" to "x" gives å, which is correct.
Applying "r<A-a>" to "x" gives á, which is wrong.
As you can see in my first post I a mtryin to map <M-t> to <C-W>v,
So Alt+t will make a vertical split.
But looking at your mapping examples seems I am doing the map wrong.
Probably is because Vim sends the unicode keymao rather than the keymap I expect.
What would be way to, let's say make my Alt-t keymap:
nmap <M-t> <C-W>v
But using unicode?
Thanks

Maybe that has been fixed since patch 496. I've just learnt to use "cl"
instead of "r" - it's more flexible, anyway.

Erik

--
"The Southern Ocean occupies about 22 per cent of the area of the total ocean,
and yet it absorbs about 40 per cent of the carbon dioxide that's stored by the
ocean and about half the heat that's stored by the ocean," climate scientist
Steve Rintoul says.
- http://abc.com.au/news/2011-11-29/southern-ocean-waters-warming/3700532

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



--
Un saludo
Best Regards
Pablo Giménez

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