mapping special keys from thinkpad keyboard

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

mapping special keys from thinkpad keyboard

Razvan Rotaru
Hi,

Is it possible to use some special keys from a ThinkPad keyboard for mappings? What I am looking for is to map the back and forward keys (above the <Left> and <Right> keys) to :tabnext and :tabprevious.

Thanks,
Razvan


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

Re: mapping special keys from thinkpad keyboard

Tim Chase
> Is it possible to use some special keys from a ThinkPad
> keyboard for mappings? What I am looking for is to map the
> back and forward keys (above the<Left>  and<Right>  keys) to
> :tabnext and :tabprevious.

The generic answer is "if (g)vim can see them, you can map them".
  The question then becomes, can (g)vim see them?

The easiest test is to go into insert (or command-line) mode,
type control+V (assuming you haven't sourced the mswin.vim
abomination), and then press either your Back or Forward button
to see what (g)vim inserts.  If *nothing* shows up, you'll have
to jump through OS-level key-remapping hoops to get vim to see it
as a key.  On the other hand, if some escape sequence shows up,
you can map that escape sequence, something like

   :nnoremap <esc>[123;45;678k :tabnext<cr>

where "<esc>" is 5 literal characters, and the rest is whatever
sequence the control+V inserts.

You don't mention what OS you're running (on X systems, you
should be able use xev to see what key sequences X sees, and
setxkbmap to nudge them around if they aren't already producing
something in xev; in other OSes, YMMV), or whether you're running
vim or gvim.  I have some similar keys on my Lenovo G570, running
Debian, and Fluxbox sees them as XF86AudioPrev and XF86AudioNext
which I have mapped/intercepted to talk to xmms2 instead of
passing them to individual applications.  On Win32 or Mac OS X, I
can't be of much help.

-tim

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

Re: mapping special keys from thinkpad keyboard

Razvan Rotaru
I'm using Win7 as OS.

Unfortunately, when I press Control-V in insert mode and then press the back key, nothing happens (with mswin.vim unloaded). Sigh.
So, do you (or somebody else) know where I can get more info on OS-level key mappings?

Thanks for the detailed reply.
Regards,
Razvan


From: Tim Chase <[hidden email]>
To: [hidden email]
Cc: Razvan Rotaru <[hidden email]>; "[hidden email]" <[hidden email]>
Sent: Wednesday, March 21, 2012 11:36 PM
Subject: Re: mapping special keys from thinkpad keyboard

> Is it possible to use some special keys from a ThinkPad
> keyboard for mappings? What I am looking for is to map the
> back and forward keys (above the<Left>  and<Right>  keys) to
> :tabnext and :tabprevious.

The generic answer is "if (g)vim can see them, you can map them".  The question then becomes, can (g)vim see them?

The easiest test is to go into insert (or command-line) mode, type control+V (assuming you haven't sourced the mswin.vim abomination), and then press either your Back or Forward button to see what (g)vim inserts.  If *nothing* shows up, you'll have to jump through OS-level key-remapping hoops to get vim to see it as a key.  On the other hand, if some escape sequence shows up, you can map that escape sequence, something like

  :nnoremap <esc>[123;45;678k :tabnext<cr>

where "<esc>" is 5 literal characters, and the rest is whatever sequence the control+V inserts.

You don't mention what OS you're running (on X systems, you should be able use xev to see what key sequences X sees, and setxkbmap to nudge them around if they aren't already producing something in xev; in other OSes, YMMV), or whether you're running vim or gvim.  I have some similar keys on my Lenovo G570, running Debian, and Fluxbox sees them as XF86AudioPrev and XF86AudioNext which I have mapped/intercepted to talk to xmms2 instead of passing them to individual applications.  On Win32 or Mac OS X, I can't be of much help.

-tim

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

Re: mapping special keys from thinkpad keyboard

Tim Chase
On 03/22/12 07:25, Razvan Rotaru wrote:
> I'm using Win7 as OS.
>
> Unfortunately, when I press Control-V in insert mode and then
> press the back key, nothing happens (with mswin.vim unloaded).
> Sigh. So, do you (or somebody else) know where I can get more
> info on OS-level key mappings?

It sounds like Windows is intercepting the key and not passing it
to the application (or passing it as some other message-type
rather than a keyboard event).  You might have some sort of
Thinkpad utility installed that allows you to change the behavior
globally so that it sends some recognizable sequence.  Sadly, I'm
afraid that's not something Windows makes particularly easy to do
(though might be possible through some 3rd-party utility) if it's
even possible at all.

-tim

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