简体   繁体   English

对于Vim编辑器,如何在Mac OS X上的.vimrc中映射功能键?

[英]For the Vim editor, how do I map a function key in .vimrc on Mac OS X?

I'm trying to map f11 to a command within vim, with a line in .vimrc such as: 我正在尝试将f11映射到vim中的命令,并在.vimrc中添加一行,例如:

map <F11> :exe '!ctags -R --python-kinds=-i -f ./tags ' . shellescape(system('python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"'))<CR>

But if you hit F11 it just turns up the volume. 但是,如果您按下F11键,只会提高音量。 Is it possible to remap keys that have OS-wide functions in OSX? 是否可以在OSX中重新映射具有OS范围功能的键?

I don't want to remap any more commonly used key here because regenerating tags takes awhile. 我不想在这里重新映射任何更常用的键,因为重新生成标签需要一些时间。

You have two options that I know of: 我知道您有两个选择:

1) Enable the regular use of the function keys, ie. 1)启用功能键的常规使用,即。 f1 - f12 no longer executes the OSX specific command such as decrease volume. f1-f12不再执行OSX特定命令,例如减小音量。 Instead you will have to hold the fn key press the f key. 相反,您将必须按住fn键并按f键。 I have this set up on my computer and I've successfully mapped the function keys in Vim / MacVim. 我已经在计算机上进行了设置,并且已经成功映射了Vim / MacVim中的功能键。 To do this go to System preferences --> Keyboard and check of the Use all F1, F2,... 为此,请转到System preferences --> Keyboard然后选中Use all F1, F2,...

2) Use fn + F11 to execute the command. 2)使用fn + F11执行命令。

6 years later... 六年后...

Check out https://github.com/Pyroh/Fluor/releases 查看https://github.com/Pyroh/Fluor/releases

It allows you to change the behavior of the function keys based on the app that is currently active. 它允许您根据当前活动的应用程序更改功能键的行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM