简体   繁体   English

Mac Keybord中的Vimrc映射

[英]Vimrc mappings in a mac keybord

I am trying to map a key with the command set filetype=… which could be perl or html etc. 我正在尝试使用命令set filetype=…映射键,该键可能是perl或html等。
Problem: I am using a Mac keyboard and all the Fx keys seem not to respond except 2 which I have already mapped and need them. 问题:我使用的是Mac键盘,除了我已经映射并需要它们的2个键之外,所有Fx键似乎都没有响应。
Eg doing map <F14>:set filetype=perl<CR> or F13 etc not only does nothing it seems to do something weird to the console. 例如,执行map <F14>:set filetype=perl<CR>或F13等不但没有做任何事情,而且似乎在控制台上做了一些奇怪的事情。
How can I map these without affecting other existing mappings? 如何在不影响其他现有映射的情况下映射它们?

Note: 注意:
To be clear: I am using vim remotely doing ssh. 需要明确的是:我正在使用vim远程执行ssh。 My local keyboard is from Mac 我的本地键盘来自Mac

nmap l nmap h This answers your question but I don't advise you to go that way. nmap l nmap h这可以回答您的问题,但我不建议您这样做。

The first problem you'll encounter is that all of your cmdsomething mappings are going to fail in the terminal. 您将遇到的第一个问题是所有cmdsomething映射都将在终端中失败。

The second is that MacVim doesn't support multiple modifiers: you won't be able to have CtrlShiftb, for example. 第二个原因是MacVim不支持多个修饰符:例如,您将无法使用CtrlShiftb。 Well, it will work but the Shift part will be ignored so you will be limited very quicly. 好吧,它会起作用,但是Shift部分将被忽略,因此您将非常受限。

The third problem will be that you'll fail to commit Vim's commands to memory. 第三个问题是您将无法将Vim的命令提交到内存。 The day you'll ssh into a server and use Vim there you'll be lost. 您将ssh放入服务器并在其中使用Vim的那一天会迷路。

So yeah, you CAN do that but (I think that) you SHOULDN'T. 是的,您可以这样做,但(我认为)您不应这样做。

Ensure that there should be space between and :set filetype=perl... 确保和之间:: set filetype = perl ...之间应该有空格。

If that was just a typo, then try this interactively, :map "press control-v and then press F14 key" :set filetype=perl 如果那只是一个错字,请以交互方式尝试::map “按control-v,然后按F14键” :set filetype = perl

BTW, the apple keyboard (on windows) I use does not have F14 key, and I do not remember seeing any function key beyond F12 on any Macbook, maybe this is something new... 顺便说一句,我使用的苹果键盘(在Windows上)没有F14键,而且我不记得在任何Macbook上看到过F12之后的任何功能键,也许这是新的东西...

Also, type ":help function-key" in you vim and if it shows something like this, then you cannot do this. 另外,在vim中键入“:help function-key”,如果显示类似这样的内容,则不能执行此操作。

*function keys 1 to 12 function_key function-key* *功能键1至12 function_key 功能键*

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

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