Quantcast

vim: bind ctrl+shift+aletter

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

vim: bind ctrl+shift+aletter

ping
guys:
is there a way to bind ctrl+shift+p differently that ctrl-p ?
google told me NO, since they are the same "key code".
just double check to experts here as last hope or any close workaround...

--
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: vim: bind ctrl+shift+aletter

Gary Johnson-4
On 2012-08-08, ping wrote:
> guys:
> is there a way to bind ctrl+shift+p differently that ctrl-p ?
> google told me NO, since they are the same "key code".
> just double check to experts here as last hope or any close workaround...

You can find out for yourself by entering insert mode and typing
Ctrl-V followed by each of the key combinations you want to try.
I tried on Linux using vim in a terminal and gvim and both key
combinations produced the same result in both cases:  ^P.  If Vim
doesn't distinguish between the key combinations in that situation,
it can't when you use them in mappings, either.  See

    :help i_CTRL-V

Regards,
Gary

--
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: vim: bind ctrl+shift+aletter

Christian Brabandt
In reply to this post by ping
Hi ping!

On Mi, 08 Aug 2012, ping wrote:

> guys:
> is there a way to bind ctrl+shift+p differently that ctrl-p ?
> google told me NO, since they are the same "key code".
> just double check to experts here as last hope or any close workaround...

Please read the faq:
http://vimhelp.appspot.com/vim_faq.txt.html#faq-20.4
and possibly also Question 20.5

regards,
Christian
--
Tote Goldfische sind praktische Lesezeichen für Bücher aus der  
Leihbücherei. Der wachsende Fischgeruch dient als einfache  
Gedächtnisstütze zur rechtzeitigen Bücherrückgabe!

--
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: vim: bind ctrl+shift+aletter

ping


On 08/09/2012 04:11 PM, Christian Brabandt wrote:

> Hi ping!
>
> On Mi, 08 Aug 2012, ping wrote:
>
>> guys:
>> is there a way to bind ctrl+shift+p differently that ctrl-p ?
>> google told me NO, since they are the same "key code".
>> just double check to experts here as last hope or any close workaround...
>
> Please read the faq:
> http://vimhelp.appspot.com/vim_faq.txt.html#faq-20.4
> and possibly also Question 20.5
>
> regards,
> Christian
>

thanks!
so quick conclusion is:
no way for ctrl-shift-c/v(like in gnome)
fn is the only choice (but not convenient)

side-topic:
speaking of the terminalApp interception, looks xterm is the one has
less (no?) of it, means "vim friendly". isn't it?





=========================================
20.5. Why does mapping the <C-...> key not work?

The only Ctrl-printable-key chords which Vim can reliably detect
(because they
are defined in the ASCII standard) are the following:

         Ctrl-@                 0x00            NUL
         Ctrl-A to Ctrl-Z       0x01 to 0x1A
         Ctrl-a to Ctrl-z       0x01 to 0x1A
         Ctrl-[                 0x1B            ESC
         Ctrl-\                 0x1C
         Ctrl-]                 0x1D
         Ctrl-^                 0x1E
         Ctrl-_                 0x1F
         Ctrl-?                 0x7F            DEL

Most of these, however, already have a function in Vim (and some are
aliases of other keys: Ctrl-H and Bsp, Ctrl-I and Tab, Ctrl-M and Enter,
Ctrl-[ and Esc, Ctrl-? and Del).

The "safest" keys to use in Vim for the {lhs} of a mapping are the F
keys, with or without Shift: <F2> to <F12> and <S-F1> to <S-F12>. (Some
OSes, including mine, intercept Ctrl-Fn and Alt-Fn, which never reach an
application program such as vim or gvim).

You can try other combinations of Ctrl + any key, but they may either
not work everywhere (e.g. the terminal might not pass that key to Vim,
or they might have unintended side effects (e.g. mapping <C-I> means
also to map <Tab>).

--
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: vim: bind ctrl+shift+aletter

Simon Ruderich-2
On Thu, Aug 09, 2012 at 05:16:42PM -0400, ping wrote:
> so quick conclusion is:
> no way for ctrl-shift-c/v(like in gnome)
> fn is the only choice (but not convenient)

That's not entirely correct. You can configure your terminal
emulator to send a different keycode for ctrl-shift-c/v if your
emulator supports it - and then map that other key in Vim
(obviously works only for terminal Vim).

For example rxvt-unicode supports remapping the input. The
following entry in .Xdefaults remaps Ctrl-Shift-c to esc x (just
an example, you could also use the F* keys or any other unused
key):

    URxvt.keysym.Control-0x43: \033x

0x43 is the keycode for upper c. Shift-c or Shift-0x63 (0x63 is
c) doesn't work!

Reload the changes:

    $ xrdb -merge ~/.Xdefaults

Then open a new urxvt window and remap the key in Vim:

    :map <esc>x ...

This should work for any key combination, use xev to get the
keycode for the desired combination. The rxvt man page has
additional information:

    $ man urxvt | less -p '  keysym.sym'

Regards,
Simon
--
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

attachment0 (853 bytes) Download Attachment
Loading...