How to map Ctrl+/ ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to map Ctrl+/ ?

huang zhimin

Hi,

I tried to map Ctrl+/ to ,cc as follows:

nnoremap <C-/> ,cc

but there's no response. Can anyone help me?

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

Reply | Threaded
Open this post in threaded view
|

Re: How to map Ctrl+/ ?

Tim Chase

> I tried to map Ctrl+/ to ,cc as follows:
>
> nnoremap <C-/> ,cc
>
> but there's no response. Can anyone help me?

Two issues occur to me:

1) make sure your vim can see whatever ctrl+/ sends to it.  Check
by issuing "control+v" followed by "control+/" after typing the
mapping.

2) the RHS of your mapping uses "," but you use "n*nore*map".  In
all likely hood, in this case you want "nmap" because you want
the mapped value of ',cc' (coming from some plugin?).  As it
currently stands, your command issues "search the reverse
direction of my last f/F/t/T command (the comma), and then delete
the entire line, leaving me in insert-mode at the current-line's
indentation (the 'cc')".  Which is a bit nonsensical...there's no
reason to move forward/backward if you're going to delete+change
the entire line.

-tim



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

Reply | Threaded
Open this post in threaded view
|

Re: How to map Ctrl+/ ?

Tony Mechelynck
In reply to this post by huang zhimin

On 07/11/09 10:37, flyerhzm wrote:

>
> Hi,
>
> I tried to map Ctrl+/ to ,cc as follows:
>
> nnoremap<C-/>  ,cc
>
> but there's no response. Can anyone help me?
>
> Thanks in advance

You can't map Ctrl-/ in Vim because the only "Ctrl+printable key"
characters which can be reliably mapped in Vim are those defined by the
(already rather old) ASCII standard, which means the only printable keys
which have a Ctrl counterpart are 0x3F to 0x5F plus the lowercase
letters, as follows:

Ctrl+? (0x3F) = DEL (0x7F)
Ctrl+(key 0x40-0x5F) = subtract 0x40 from the printable character
Ctrl+lowercase = Ctrl+ the corresponding uppercase.

Nothing else. No Ctrl+digit and no Ctrl+slash (where / = 0x2F).

BTW, the above also explains why Vim cannot discriminate between

Ctrl-I and Tab (both 0x09, HT)
Ctrl-M and Enter (both 0x0D, CR)
Ctrl-[ and Esc (both 0x1B, ESC)

Non-printable keys, OTOH, may or may not have a mappable Ctrl
counterpart depending on your OS and on what (if anything) your keyboard
interface (and, in Console Vim, your terminal) passes for them. For
instance on my Linux system with KDE window manager, all Ctrl+Fn (and
Alt+Fn) combinations are intercepted by the winmanager (and Ctrl+Alt+Fn
by the kernel IIUC) for its own purposes and never passed to any
application program.


Best regards,
Tony.
--
Whistler's Law:
        You never know who is right, but you always know who is in
charge.

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

Reply | Threaded
Open this post in threaded view
|

Re: How to map Ctrl+/ ?

Bugzilla from mortgat@gmail.com
On Sat, Nov 7, 2009 at 16:09, Tony Mechelynck <[hidden email]> wrote:

On 07/11/09 10:37, flyerhzm wrote:
>
> Hi,
>
> I tried to map Ctrl+/ to ,cc as follows:
>
> nnoremap<C-/>  ,cc
>
> but there's no response. Can anyone help me?

If you are using numeric pad, try mapping <C-kPlus> and <C-kMinus>

>
> Thanks in advance


--
Benoit Mortgat
39, cours Albert Thomas
69003 Lyon, France
+33 4 27 78 31 27 / +33 6 17 15 41 58

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

Reply | Threaded
Open this post in threaded view
|

Re: How to map Ctrl+/ ?

Tony Mechelynck

On 10/11/09 17:51, Benoit Mortgat wrote:

> On Sat, Nov 7, 2009 at 16:09, Tony Mechelynck
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>
>     On 07/11/09 10:37, flyerhzm wrote:
>      >
>      > Hi,
>      >
>      > I tried to map Ctrl+/ to ,cc as follows:
>      >
>      > nnoremap<C-/>  ,cc
>      >
>      > but there's no response. Can anyone help me?
>
>
> If you are using numeric pad, try mapping <C-kPlus> and <C-kMinus>
>
>      >
>      > Thanks in advance

Experiment shows that

        press and hold Ctrl
        press and release / _in numeric keypad_
        release Ctrl

will be seen by gvim (at least, gvim with GTK2 GUI running in X11 with
kdm winmanager) as <C-/> i.e. Ctrl+slash (whatever that be).

Whether Console Vim can see it may depend on the terminal it's running in.


Best regards,
Tony.
--
God made machine language; all the rest is the work of man.

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

Reply | Threaded
Open this post in threaded view
|

Re: How to map Ctrl+/ ?

panshizhu

Tony Mechelynck 写道:

>
> Experiment shows that
>
> press and hold Ctrl
> press and release / _in numeric keypad_
> release Ctrl
>
> will be seen by gvim (at least, gvim with GTK2 GUI running in X11 with
> kdm winmanager) as <C-/> i.e. Ctrl+slash (whatever that be).
>
> Whether Console Vim can see it may depend on the terminal it's running in.
>
>
> Best regards,
> Tony.

I'm using Kubuntu 8.04+KDE 3.5.10, in my Konsole I map <C-_> (the
underscore) and it works for <C-/>.

It depends on the terminal program though.


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