On 01/04/09 06:14, John Beckett wrote:
>
> MisterW wrote:
>> Why then does vim.exe running in a cmd window allow me to map
>> <C-1>  when gvim won't?
>
> George Reilly has just explained that Ctrl-6, Ctrl-2, Ctrl-- are
> special-cased in Windows (which I didn't know). Perhaps there is
> also some special casing for Ctrl-1 ... sorry, I don't know.
>
>>> I know this news is a bit shocking, but I've found that as I
>>> learned more of the Vim way of doing things, my desire to map
>>> commands to weird character combinations has declined.
>>
>> Are you saying you don't make much use of mappings?
>>
>> I'm a long time vim user and I find there's an ever
>> increasing list of things I want to map. I don't consider
>> control 1-10 a wierd char combination, It's a fairly common
>> idiom for switching between tabs and the like.
>
> Sorry for the POV "weird" comment. It is true that I don't make
> much use of key mappings (I certainly have some, but not for
> buffer switching). Sometimes when I'm working on a particular
> project I will put uppercase marks in files I want to quickly
> return to. Or I might have a set of special mappings just for
> the project (and I might use the keypad with stuff like<k1>).
>
> I'm sure you don't need this tip, but FWIW there is a tip that
> maps:
>      ,l       : list buffers
>      ,b ,f ,g : go back/forward/last-used
>      ,1 ,2 ,3 : go to buffer 1/2/3 etc
> http://vim.wikia.com/wiki/Easier_buffer_switching
>
> That is the sort of thing I would do given I can't use Ctrl-2
> etc.
>
> John

The following are actual examples copied from my vimrc:

        map     <F9>    <C-]>
        " using F9, a 'safe' mapping, because my keyboard doesn't
        " gracefully handle Ctrl-]. Nowadays I know that it's
        " Ctrl-AltGr-$ but that's not practical.

        inoremap        <Space>         <Space><Left><Right>
        " redefining a standard key, here to create an undo point

        if version < 700
                cnoreabbrev     h       bot h
        else
                cnoreabbrev     <expr>  h
                \       ((getcmdtype() == ':' && getcmdpos() <= 2)?
                \               'bot h' : 'h')
        endif
        map     <F1>    :bot help<CR>
        " redefines again, to open the help at bottom

        map     µ       :&&<CR>
        " mapping an upper-ASCII key
        " this one redoes the latest :substitute

        map     <F2>    :cnext<CR>
        map     <S-F2>  :cprev<CR>
        " two 'related' F keys, for quickfix navigation

        map     <F11>   <C-W>w
        map     <S-F11> <C-W>W
        imap    <F11>   <C-O><C-W>w
        imap    <S-F11> <C-O><C-W>W
        " 'related' F keys, for split-windows navigation
        " in both Insert/Replace and Normal/Visual

As you can see, I limit myself to {lhs}es chosen among F and Shift-F 
keys, Normal-mode-upper-ASCII, and intentional redefines, so there will 
be no unexpected clash with either existing Vim commands or keys 
snatched by some OS before Vim gets them.

The use of µ may seem "weird" but it is an upper-ASCII key, therefore 
not used by Vim in Normal mode, and passed by every OS to the app as a 
"printable" key (once my national keyboard is configured, of course).


Best regards,
Tony.
-- 
Anything is good if it's made of chocolate.

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

Reply via email to