禁用Vim内置的F1帮助键

这个F1简直太误事了。谁用vim进帮助需要按F1的?
因此已经被列为了我的vimrc中必须禁用掉的一个keymap.

F1 is really annoying but sadly nothing of all these worked for me. I use ubuntu and still when I press F1 it brings up the GNOME terminal manual window!!! Any thoughts?

If it brings up Gnome help and not Vim help, it means your Gnome window manager snatches it before Vim has a chance to see it. The solution, if any, is somewhere in your Gnome (and/or WM and/or Compiz and/or ...) settings. — Tonymec 17:37, April 9, 2010 (UTC)
Ok Τonymec thank you very much. Finally what I did to fix it is the following. First of all with xev utility I found out that the keycode of F1 is 67. Then I issued the command xmodmap -e "keycode 67 = Escape". That was it. F1 behaves like Escape now

http://vim.wikia.com/wiki/Disable_F1_built-in_help_key

对于gvim来说,单纯地 noremap , inoremap 等基本没用,因为操作系统会先捕获到这个事件,然后help又弹出来了。

Arch用户:

1
sudo pacman -S xorg-xmodmap xorg-xev xkeycaps

PS: XKeyCaps is a graphical front-end to xmodmap.

xev 查得f1的键盘码为 67
xmodmap -e "keycode 67 = Escape"
完事。不过这样修改了,重启后配置又没了。
要永久保存的话:

1
xmodmap -pke > ~/.Xmodmap

If you are using GDM, XDM or KDM, there is no need to source your ~/.Xmodmap manually as these display managers source that file if it is present, whereas startx does not. Therefore, to activate your custom table when starting Xorg, add the following:

~/.xinitrc

1
2
3
if [ -s ~/.Xmodmap ]; then
    xmodmap ~/.Xmodmap
fi

see https://wiki.archlinux.org/index.php/xmodmap

更多
No Responses Post a comment

Leave a Reply

Note: You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS