Wednesday, April 3, 2013

Re: Is there already a solution for mapping in Terminal (urxvt)?

thanks Tony, thanks LCD 47

I just did some test again, didn't find solution... :(

I think the <alt-j> mapping works here. my problem is the keycode timeout..

Normal mode mapping I have no problem, but Insert mode ....

let's say, I tried followings:
inoremap ^[j <Esc>:m-2<CR>==gi (c-v then alt-j)
or
inoremap <esc>j <Esc>:m-2<CR>==gi

with this mapping when i am in insert mode, and press <alt -j>,
current line moved down, (format ==) then stay in Insert mode.
This works no problem.

The annoying thins is, now I am in Insert mode, I want to press <esc>
back to Normal, and press j, move to next line (Normal mode). vim does
what I mapped above, not back to Normal mode.... even if I have
set timeout timeoutlen=1000 ttimeoutlen=100

why this 100ms doesn't work here... I don't know why.

I tried to add URxvt*meta8:true in ~/.Xresources as well. I could
directly map (Insert mode) <m-j> ... but when I type <alt-j> a "ê"
printed. I think this is what Tony meant. I also read about set
tenc=latin1 could fix it. it do fix it, but I cannot input multi-bytes
characters also utf-8 file with mutl-bytes letter/words cannot be
displayed. e.g. CJK

I also tried the way in
http://vim.wikia.com/wiki/Mapping_fast_keycodes_in_terminal_Vim, didnt
make it work...

any more suggestions? or where I did wrong?



On Wed, Apr 3, 2013 at 10:05 AM, Tony Mechelynck
<antoine.mechelynck@gmail.com> wrote:
> On 03/04/13 09:49, LCD 47 wrote:
>>
>> On 2 April 2013, Kent <kent.yuan@gmail.com> wrote:
>> [...]
>>>
>>> What I want to map is simple, <a-j/k> move current line up/down.
>>
>> [...]
>>
>> The keyboard bindings for <ALT> in urxvt depend on the URxvt.meta8
>> resource. If URxvt.meta8 is false (which is the default), <ALT><key>
>> sends <ESC><key> and thus you need to write your maps for <ESC>mumble:
>>
>> nnoremap <Esc>j "zdd"zp
>> nnoremap <Esc>k k"zdd"zpk
>>
>> If URxvt.meta8 is true, <ALT><key> sends an 8-bit character and sens
>> the Meta flag, which means you have to write your maps for <M-mumble>:
>>
>> nnoremap <M-j> "zdd"zp
>> nnoremap <M-k> k"zdd"zpk
>>
>> In order to change the URxvt.meta8 resource, either add
>>
>> *URxvt.meta8: true
>>
>> to /etc/X11/app-defaults/URxvt (the path may differ on your machine), or
>> add
>>
>> URxvt.meta8: true
>>
>> to ~/.Xresources (and run "xrdb -merge ~/.Xresources" for it to take
>> effect immediatley).
>>
>> The xterm equivalent of URxvt.meta8 is VT100.metaSendsEscape.
>
>
> …or to be precise, !(vt100.metaSendsEscape) of course (the one is true when
> the other is false, to give the same meaning).
>
>>
>> /lcd
>>
>
> Best regards,
> Tony.
> --
> New Hampshire law forbids you to tap your feet, nod your head, or in
> any way keep time to the music in a tavern, restaurant, or cafe.
>
>
> --
> --
> 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
>
> --- You received this message because you are subscribed to the Google
> Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment