On 20/12/08 03:30, Leandro Camargo wrote:
> On Sat, Dec 20, 2008 at 12:17 AM, Tony Mechelynck
> <antoine.mechely...@gmail.com>  wrote:
>> On 20/12/08 00:26, Leandro N. Camargo wrote:
>>> I'm not having success to make these two key mappings to work:
>>>
>>> noremap<silent>   <C-,>   <Esc>:call cursor(line('.'), 1)<CR>i
>>> noremap<silent>   <C-.>   <Esc>:call cursor(line('.'), col('$'))<CR>i
>>>
>>> Since my cmd+arrow(left/right) shortcuts doens't work inside my bash
>>> terminal (I don't have Home/End keys on my macbook) I've tried to make
>>> this workaround at least for vim.
>>>
>>> I've put both inside my .vimrc (and loding into my vim using :source)
>>> and I wasn't succeeded.
>>> I've tried imap and inoremap there as well.
>>>
>>> Anyone know what is the catch?
>>>
>>> Best regards,
>>> Leandro.
>> Among all thinkable Ctrl-printable key combinations, only those for
>> "printable keys" in the range 0x40-0x5F are reliably mappable, plus
>> Ctrl-lowercase letters (because case doesn't matter) and Ctrl-? which
>> maps to 0x7F. The culprit is not Vim, not even vi, but ASCII which
>> defined only those combinations, so only these can be seen (as 0x00-0x1F
>> plus 0x7F) when using "cooked" keyboard input, as Vim does. Of the
>> Ctrl-unprintable key combinations, some of them can be seen, others not;
>> and some of them are ambiguous as to the presence or absence of the Ctrl
>> modifier; it all tepends on your keyboard interface.
>>
>> On the Mac, there are both a Ctrl and a Cmd modifier; one of them is
>> represented as<C-something>, the other as<D-something>. If one of them
>> doesn't work, try the other.
>
> Thanks you all for your thoughts.
> Ben is right about the "," and "." keys over key mappings, the problem
> was due these keys.
> Even regarding Tony thoughts about non-printables chars I'd insist on
> using<C-Left>  and<C-Right>  to do these my desired tasks.
> But as I realized they are already created inside vim for tasks I
> don't even use.
> So my golden question is: can I over these key mappings<C-Left>  and<C-Right> 
>  ?
> Because what I really want is to make something like:
>
> imap<C-Left>  <Esc>bi
> imap<C-Right>  <Esc>wi
> imap<C-S-Left>  <Esc>:call cursor(line('.'), 1)<CR>i
> imap<C-S-Right>  <Esc>:call cursor(line('.'), col('$'))<CR>i
>
> So the first two lines would jump words, and the last two lines would
> go to line edges.
> It's possible? I'd have to overwrite the original key mapping before
> anything. So....? What do you think? Doable?
>
> And I tried with the Command key (<D-Left/Right>) here as Tony
> suggested me but it seems the vim container process (terminal) hooks
> up any key binding starting with the Command key, so it won't work.
>
> >
>

Vim probably won't see Ctrl-comma and Ctrl-dot, or not as distinct from 
plain comma and dot. Of course this means you cannot remap them to 
cursor movement functions in Insert mode, and that even in Normal mode 
you should think twice about overriding some useful commands (such as 
the dot for "repeat last change").

For the {lhs} of Vim mappings, I recommend the F keys, with or without 
Shift, because they are least likely to collide with something else, 
with a very few well-known exceptions, such as F1 = help, and, on some 
platforms, F10 = Menu.


Best regards,
Tony.
-- 
ARTHUR:    Well, it doesn't matter.  Will you go and tell your master that
            Arthur from the Court of Camelot is here.
GUARD #1:  Listen, in order to maintain air-speed velocity, a swallow
            needs to beat its wings 43 times every second, right?
ARTHUR:    Please!
                                   The Quest for the Holy Grail (Monty 
Python)

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to