Reputation: 2161
I think that using Menu key to quit vim's insert mode would be a great thing. It would be also nice to use Super key for that, but I'm not sure if it possible since Super key is a modifier.
Anyway, I couldn't find anything related to this. Looking for your help and thanks in advance!
Upvotes: 3
Views: 2732
Reputation: 15345
I haven't found a way to map it in gVim yet, but I was able to successfully map the Menu key in a urxvt
+screen
+vim
stack by the following method:
quoted-insert
function in Zsh and in Readline-based tools like Bash.^[[29~
at the prompt. (The initial ^[
must be translated to <Esc>
for use in .vimrc
.).vimrc
and add a line like this:imap <Esc>[29~ <Esc>
(or imap <Esc>[29~ <Esc><Esc>
if you don't want it to wait for further input like the Escape key does.)
Note that not all keys return something usable from Ctrl+v. This is a limitation of terminal emulators and can be remedied by remapping the key. You may be able to do that at the level of the terminal emulator rather than for all X apps.
For example, for urxvt
, I had to add the following lines to ~/.Xresources
and run xrdb -merge ~/.Xresources
to apply them:
! Unbreak zsh keys in URxvt
URxvt*keysym.Home: \033[1~
URxvt*keysym.End: \033[4~
(\033
is <Esc>
in ~/.Xresources
syntax.)
Upvotes: 1
Reputation: 19667
Just try using ctrl+[ instead of binding another key. This combination is a standard one in vim, btw.
This is even easier when having rebound capslock into an additional ctrl.
Upvotes: 0
Reputation: 5627
I don't think there's any way you can configure Vim to pay attention to the Menu key as such, but depending on your system there are various ways to turn the Menu key into an Escape key.
If you're using X11 on Linux:
xmodmap -e 'keycode 135 = Escape'
will turn your Menu key into an Escape key for the current session, but is not permanent. To make it permanent under Gnome, you might try adding it under System → Preferences → Startup Applications.xkeycaps
program will give you a GUI for similar remappings.For more information:
http://46dogs.blogspot.com/2008/05/remap-keys-in-ubuntu-804-hardy-heron.html
http://ubuntuforums.org/archive/index.php/t-106209.html
Upvotes: 3