有谁知道如何让 ctrl+n 和 ctrl+p 在 Mac 上自定义的 Ukelele 布局中的浏览器地址栏中上下导航,就像内置布局一样?
各种浏览器的一个鲜为人知、可能未记录的功能是,您可以在 Mac 的地址栏中使用ctrl+向下导航,使用+p向上导航,就像使用向下/向上箭头和/ -一样。我经常使用这些快捷键,因为它们在 Vim 中是相同的。这适用于 Mac 上的任何内置键盘布局,例如“美国”或“瑞典”。ctrlntabshifttabctrl
我根据美国 QWERTY 在 Ukelele 中创建了这个自定义布局(我删除了一层以满足字符限制):
<?xml version="1.1" encoding="UTF-8"?>
<!DOCTYPE keyboard SYSTEM "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
<!--Created by Ukelele version 396 on 2024-10-10 at 11:25 (EEST)-->
<!--Last edited by Ukelele version 396 on 2024-10-12 at 17:44 (EEST)-->
<keyboard group="126" id="-8526" name="US-SV" maxout="1">
<layouts>
<layout first="0" last="17" mapSet="ANSI" modifiers="Modifiers"/>
<layout first="18" last="18" mapSet="JIS" modifiers="Modifiers"/>
<layout first="21" last="23" mapSet="JIS" modifiers="Modifiers"/>
<layout first="30" last="30" mapSet="JIS" modifiers="Modifiers"/>
<layout first="33" last="33" mapSet="JIS" modifiers="Modifiers"/>
<layout first="36" last="36" mapSet="JIS" modifiers="Modifiers"/>
<layout first="194" last="194" mapSet="JIS" modifiers="Modifiers"/>
<layout first="197" last="197" mapSet="JIS" modifiers="Modifiers"/>
<layout first="200" last="201" mapSet="JIS" modifiers="Modifiers"/>
<layout first="206" last="207" mapSet="JIS" modifiers="Modifiers"/>
</layouts>
<modifierMap id="Modifiers" defaultIndex="0">
<keyMapSelect mapIndex="0">
<modifier keys=""/>
</keyMapSelect>
<keyMapSelect mapIndex="1">
<modifier keys="anyShift"/>
</keyMapSelect>
<keyMapSelect mapIndex="2">
<modifier keys="anyOption"/>
</keyMapSelect>
<keyMapSelect mapIndex="3">
<modifier keys="command"/>
</keyMapSelect>
<keyMapSelect mapIndex="4">
<modifier keys="anyControl"/>
</keyMapSelect>
</modifierMap>
<keyMapSet id="ANSI">
<keyMap index="0">
<key code="0" output="a"/>
<key code="1" output="s"/>
<key code="2" output="d"/>
<key code="3" output="f"/>
<key code="4" output="h"/>
<key code="5" output="g"/>
<key code="6" output="z"/>
<key code="7" output="x"/>
<key code="8" output="c"/>
<key code="9" output="v"/>
<key code="10" output="`"/>
<key code="11" output="b"/>
<key code="12" output="q"/>
<key code="13" output="w"/>
<key code="14" output="e"/>
<key code="15" output="r"/>
<key code="16" output="y"/>
<key code="17" output="t"/>
<key code="18" output="1"/>
<key code="19" output="2"/>
<key code="20" output="3"/>
<key code="21" output="4"/>
<key code="22" output="6"/>
<key code="23" output="5"/>
<key code="24" output="="/>
<key code="25" output="9"/>
<key code="26" output="7"/>
<key code="27" output="-"/>
<key code="28" output="8"/>
<key code="29" output="0"/>
<key code="30" output="]"/>
<key code="31" output="o"/>
<key code="32" output="u"/>
<key code="33" output="["/>
<key code="34" output="i"/>
<key code="35" output="p"/>
<key code="36" output="
"/>
<key code="37" output="l"/>
<key code="38" output="j"/>
<key code="39" output="'"/>
<key code="40" output="k"/>
<key code="41" output=";"/>
<key code="42" output="\"/>
<key code="43" output=","/>
<key code="44" output="/"/>
<key code="45" output="n"/>
<key code="46" output="m"/>
<key code="47" output="."/>
<key code="48" output="	"/>
<key code="49" output=" "/>
<key code="50" output="`"/>
<key code="51" output=""/>
<key code="53" output=""/>
<key code="64" output=""/>
<key code="65" output=""/>
<key code="66" output=""/>
<key code="67" output="*"/>
<key code="69" output="+"/>
<key code="70" output=""/>
<key code="71" output=""/>
<key code="72" output=""/>
<key code="75" output="/"/>
<key code="76" output=""/>
<key code="77" output=""/>
<key code="78" output="-"/>
<key code="79" output=""/>
<key code="80" output=""/>
<key code="81" output="="/>
<key code="82" output="0"/>
<key code="83" output="1"/>
<key code="84" output="2"/>
<key code="85" output="3"/>
<key code="86" output="4"/>
<key code="87" output="5"/>
<key code="88" output="6"/>
<key code="89" output="7"/>
<key code="91" output="8"/>
<key code="92" output="9"/>
<key code="96" output=""/>
<key code="97" output=""/>
<key code="98" output=""/>
<key code="99" output=""/>
<key code="100" output=""/>
<key code="101" output=""/>
<key code="103" output=""/>
<key code="105" output=""/>
<key code="106" output=""/>
<key code="107" output=""/>
<key code="109" output=""/>
<key code="111" output=""/>
<key code="113" output=""/>
<key code="114" output=""/>
<key code="115" output=""/>
<key code="116" output=""/>
<key code="117" output=""/>
<key code="118" output=""/>
<key code="119" output=""/>
<key code="120" output=""/>
<key code="121" output=""/>
<key code="122" output=""/>
<key code="123" output=""/>
<key code="124" output=""/>
<key code="125" output=""/>
<key code="126" output=""/>
</keyMap>
<keyMap index="1">
<key code="0" output="A"/>
<key code="1" output="S"/>
<key code="2" output="D"/>
<key code="3" output="F"/>
<key code="4" output="H"/>
<key code="5" output="G"/>
<key code="6" output="Z"/>
<key code="7" output="X"/>
<key code="8" output="C"/>
<key code="9" output="V"/>
<key code="10" output=""/>
<key code="11" output="B"/>
<key code="12" output="Q"/>
<key code="13" output="W"/>
<key code="14" output="E"/>
<key code="15" output="R"/>
<key code="16" output="Y"/>
<key code="17" output="T"/>
<key code="18" output="!"/>
<key code="19" output="@"/>
<key code="20" output="#"/>
<key code="21" output="$"/>
<key code="22" output="^"/>
<key code="23" output="%"/>
<key code="24" output="+"/>
<key code="25" output="("/>
<key code="26" output="&"/>
<key code="27" output="_"/>
<key code="28" output="*"/>
<key code="29" output=")"/>
<key code="30" output="}"/>
<key code="31" output="O"/>
<key code="32" output="U"/>
<key code="33" output="{"/>
<key code="34" output="I"/>
<key code="35" output="P"/>
<key code="36" output="
"/>
<key code="37" output="L"/>
<key code="38" output="J"/>
<key code="39" output="""/>
<key code="40" output="K"/>
<key code="41" output=":"/>
<key code="42" output="|"/>
<key code="43" output="<"/>
<key code="44" output="?"/>
<key code="45" output="N"/>
<key code="46" output="M"/>
<key code="47" output=">"/>
<key code="48" output="	"/>
<key code="49" output=" "/>
<key code="50" output="~"/>
<key code="51" output=""/>
<key code="53" output=""/>
<key code="64" output=""/>
<key code="65" output=""/>
<key code="66" output=""/>
<key code="67" output="*"/>
<key code="69" output="+"/>
<key code="70" output=""/>
<key code="71" output=""/>
<key code="72" output=""/>
<key code="75" output="/"/>
<key code="76" output=""/>
<key code="77" output=""/>
<key code="78" output="-"/>
<key code="79" output=""/>
<key code="80" output=""/>
<key code="81" output="="/>
<key code="82" output="0"/>
<key code="83" output="1"/>
<key code="84" output="2"/>
<key code="85" output="3"/>
<key code="86" output="4"/>
<key code="87" output="5"/>
<key code="88" output="6"/>
<key code="89" output="7"/>
<key code="91" output="8"/>
<key code="92" output="9"/>
<key code="96" output=""/>
<key code="97" output=""/>
<key code="98" output=""/>
<key code="99" output=""/>
<key code="100" output=""/>
<key code="101" output=""/>
<key code="103" output=""/>
<key code="105" output=""/>
<key code="106" output=""/>
<key code="107" output=""/>
<key code="109" output=""/>
<key code="111" output=""/>
<key code="113" output=""/>
<key code="114" output=""/>
<key code="115" output=""/>
<key code="116" output=""/>
<key code="117" output=""/>
<key code="118" output=""/>
<key code="119" output=""/>
<key code="120" output=""/>
<key code="121" output=""/>
<key code="122" output=""/>
<key code="123" output=""/>
<key code="124" output=""/>
<key code="125" output=""/>
<key code="126" output=""/>
</keyMap>
<keyMap index="2">
<key code="0" output="ä"/>
<key code="1" output="s"/>
<key code="2" output=""/>
<key code="3" output=""/>
<key code="4" output=""/>
<key code="5" output=""/>
<key code="6" output=""/>
<key code="7" output=""/>
<key code="8" output=""/>
<key code="9" output=""/>
<key code="10" output=""/>
<key code="11" output=""/>
<key code="12" output=""/>
<key code="13" output="å"/>
<key code="14" output="€"/>
<key code="15" output=""/>
<key code="16" output=""/>
<key code="17" output=""/>
<key code="18" output=""/>
<key code="19" output=""/>
<key code="20" output=""/>
<key code="21" output=""/>
<key code="22" output=""/>
<key code="23" output=""/>
<key code="24" output=""/>
<key code="25" output=""/>
<key code="26" output=""/>
<key code="27" output="–"/>
<key code="28" output=""/>
<key code="29" output=""/>
<key code="30" output=""/>
<key code="31" output="ö"/>
<key code="32" output=""/>
<key code="33" output=""/>
<key code="34" output="i"/>
<key code="35" output="å"/>
<key code="36" output="
"/>
<key code="37" output=""/>
<key code="38" output=""/>
<key code="39" output=""/>
<key code="40" output=""/>
<key code="41" output=""/>
<key code="42" output=""/>
<key code="43" output=""/>
<key code="44" output=""/>
<key code="45" output=""/>
<key code="46" output=""/>
<key code="47" output=""/>
<key code="48" output="	"/>
<key code="49" output=""/>
<key code="50" output=""/>
<key code="51" output=""/>
<key code="53" output=""/>
<key code="64" output=""/>
<key code="65" output=""/>
<key code="66" output=""/>
<key code="67" output=""/>
<key code="69" output=""/>
<key code="70" output=""/>
<key code="71" output=""/>
<key code="72" output=""/>
<key code="75" output=""/>
<key code="76" output=""/>
<key code="77" output=""/>
<key code="78" output=""/>
<key code="79" output=""/>
<key code="80" output=""/>
<key code="81" output=""/>
<key code="82" output=""/>
<key code="83" output=""/>
<key code="84" output=""/>
<key code="85" output=""/>
<key code="86" output=""/>
<key code="87" output=""/>
<key code="88" output=""/>
<key code="89" output=""/>
<key code="91" output=""/>
<key code="92" output=""/>
<key code="96" output=""/>
<key code="97" output=""/>
<key code="98" output=""/>
<key code="99" output=""/>
<key code="100" output=""/>
<key code="101" output=""/>
<key code="103" output=""/>
<key code="105" output=""/>
<key code="106" output=""/>
<key code="107" output=""/>
<key code="109" output=""/>
<key code="111" output=""/>
<key code="113" output=""/>
<key code="114" output=""/>
<key code="115" output=""/>
<key code="116" output=""/>
<key code="117" output=""/>
<key code="118" output=""/>
<key code="119" output=""/>
<key code="120" output=""/>
<key code="121" output=""/>
<key code="122" output=""/>
<key code="123" output=""/>
<key code="124" output=""/>
<key code="125" output=""/>
<key code="126" output=""/>
</keyMap>
<keyMap index="3">
<key code="0" output="a"/>
<key code="1" output="s"/>
<key code="2" output="d"/>
<key code="3" output="f"/>
<key code="4" output="h"/>
<key code="5" output="g"/>
<key code="6" output="z"/>
<key code="7" output="x"/>
<key code="8" output="c"/>
<key code="9" output="v"/>
<key code="10" output=""/>
<key code="11" output="b"/>
<key code="12" output="q"/>
<key code="13" output="w"/>
<key code="14" output="e"/>
<key code="15" output="r"/>
<key code="16" output="y"/>
<key code="17" output="t"/>
<key code="18" output="1"/>
<key code="19" output="2"/>
<key code="20" output="3"/>
<key code="21" output="4"/>
<key code="22" output="6"/>
<key code="23" output="5"/>
<key code="24" output="="/>
<key code="25" output="9"/>
<key code="26" output="7"/>
<key code="27" output="-"/>
<key code="28" output="8"/>
<key code="29" output="0"/>
<key code="30" output="]"/>
<key code="31" output="o"/>
<key code="32" output="u"/>
<key code="33" output="["/>
<key code="34" output="i"/>
<key code="35" output="p"/>
<key code="36" output="
"/>
<key code="37" output="l"/>
<key code="38" output="j"/>
<key code="39" output="'"/>
<key code="40" output="k"/>
<key code="41" output=";"/>
<key code="42" output="\"/>
<key code="43" output=","/>
<key code="44" output="/"/>
<key code="45" output="n"/>
<key code="46" output="m"/>
<key code="47" output="."/>
<key code="48" output="	"/>
<key code="49" output=" "/>
<key code="50" output="`"/>
<key code="51" output=""/>
<key code="53" output=""/>
<key code="64" output=""/>
<key code="65" output=""/>
<key code="66" output=""/>
<key code="67" output="*"/>
<key code="69" output="+"/>
<key code="70" output=""/>
<key code="71" output=""/>
<key code="72" output=""/>
<key code="75" output="/"/>
<key code="76" output=""/>
<key code="77" output=""/>
<key code="78" output="-"/>
<key code="79" output=""/>
<key code="80" output=""/>
<key code="81" output="="/>
<key code="82" output="0"/>
<key code="83" output="1"/>
<key code="84" output="2"/>
<key code="85" output="3"/>
<key code="86" output="4"/>
<key code="87" output="5"/>
<key code="88" output="6"/>
<key code="89" output="7"/>
<key code="91" output="8"/>
<key code="92" output="9"/>
<key code="96" output=""/>
<key code="97" output=""/>
<key code="98" output=""/>
<key code="99" output=""/>
<key code="100" output=""/>
<key code="101" output=""/>
<key code="103" output=""/>
<key code="105" output=""/>
<key code="106" output=""/>
<key code="107" output=""/>
<key code="109" output=""/>
<key code="111" output=""/>
<key code="113" output=""/>
<key code="114" output=""/>
<key code="115" output=""/>
<key code="116" output=""/>
<key code="117" output=""/>
<key code="118" output=""/>
<key code="119" output=""/>
<key code="120" output=""/>
<key code="121" output=""/>
<key code="122" output=""/>
<key code="123" output=""/>
<key code="124" output=""/>
<key code="125" output=""/>
<key code="126" output=""/>
</keyMap>
<keyMap index="4">
<key code="0" output=""/>
<key code="1" output=""/>
<key code="2" output=""/>
<key code="3" output=""/>
<key code="4" output=""/>
<key code="5" output=""/>
<key code="6" output=""/>
<key code="7" output=""/>
<key code="8" output=""/>
<key code="9" output=""/>
<key code="10" output=""/>
<key code="11" output=""/>
<key code="12" output=""/>
<key code="13" output=""/>
<key code="14" output=""/>
<key code="15" output=""/>
<key code="16" output=""/>
<key code="17" output=""/>
<key code="18" output=""/>
<key code="19" output=""/>
<key code="20" output=""/>
<key code="21" output=""/>
<key code="22" output=""/>
<key code="23" output=""/>
<key code="24" output=""/>
<key code="25" output=""/>
<key code="26" output=""/>
<key code="27" output=""/>
<key code="28" output=""/>
<key code="29" output=""/>
<key code="30" output=""/>
<key code="31" output=""/>
<key code="32" output=""/>
<key code="33" output=""/>
<key code="34" output=""/>
<key code="35" output=""/>
<key code="36" output="
"/>
<key code="37" output=""/>
<key code="38" output=""/>
<key code="39" output=""/>
<key code="40" output=""/>
<key code="41" output=""/>
<key code="42" output=""/>
<key code="43" output=""/>
<key code="44" output=""/>
<key code="45" output=""/>
<key code="46" output=""/>
<key code="47" output=""/>
<key code="48" output="	"/>
<key code="49" output=""/>
<key code="50" output=""/>
<key code="51" output=""/>
<key code="53" output=""/>
<key code="55" output=""/>
<key code="58" output=""/>
<key code="64" output=""/>
<key code="65" output=""/>
<key code="66" output=""/>
<key code="67" output=""/>
<key code="69" output=""/>
<key code="70" output=""/>
<key code="71" output=""/>
<key code="72" output=""/>
<key code="75" output=""/>
<key code="76" output=""/>
<key code="77" output=""/>
<key code="78" output=""/>
<key code="79" output=""/>
<key code="80" output=""/>
<key code="81" output=""/>
<key code="82" output=""/>
<key code="83" output=""/>
<key code="84" output=""/>
<key code="85" output=""/>
<key code="86" output=""/>
<key code="87" output=""/>
<key code="88" output=""/>
<key code="89" output=""/>
<key code="91" output=""/>
<key code="92" output=""/>
<key code="96" output=""/>
<key code="97" output=""/>
<key code="98" output=""/>
<key code="99" output=""/>
<key code="100" output=""/>
<key code="101" output=""/>
<key code="103" output=""/>
<key code="105" output=""/>
<key code="106" output=""/>
<key code="107" output=""/>
<key code="109" output=""/>
<key code="111" output=""/>
<key code="113" output=""/>
<key code="114" output=""/>
<key code="115" output=""/>
<key code="116" output=""/>
<key code="117" output=""/>
<key code="118" output=""/>
<key code="119" output=""/>
<key code="120" output=""/>
<key code="121" output=""/>
<key code="122" output=""/>
<key code="123" output=""/>
<key code="124" output=""/>
<key code="125" output=""/>
<key code="126" output=""/>
</keyMap>
</keyMapSet>
<keyMapSet id="JIS">
<keyMap index="0" baseMapSet="ANSI" baseIndex="0">
<key code="512" output=""/>
</keyMap>
<keyMap index="1" baseMapSet="ANSI" baseIndex="1">
<key code="512" output=""/>
</keyMap>
<keyMap index="2" baseMapSet="ANSI" baseIndex="2">
<key code="512" output=""/>
</keyMap>
<keyMap index="3" baseMapSet="ANSI" baseIndex="3">
<key code="512" output=""/>
</keyMap>
<keyMap index="4" baseMapSet="ANSI" baseIndex="4">
<key code="512" output=""/>
</keyMap>
</keyMapSet>
</keyboard>
选择此布局后,当我在 Chrome 或 Firefox 的地址栏中按 ctrl+n 或 ctrl+p 时没有任何反应。有人知道为什么吗?按键绑定在 Kitty 中运行的 Neovim 中有效,因此它们已正确注册。
我尝试通过以下方式将ctrl+映射n为直接输出“n”:
- <key code="45" output=""/>
+ <key code="45" output="n"/>
<keyMap index="5">
在(层)中ctrl,但那不起作用;然后只输出“n”。我尝试对ctrl+p使用键代码 35 进行同样的操作,结果出现了同样的问题。
我可以通过将ctrl+绑定n到向下箭头键 (

) 并将ctrl+ 绑定p 到向上箭头键 (
) 来解决该问题,如下所示:我不确定这是否是默认 Mac US 布局中的绑定方式,但它的行为似乎完全相同。我现在可以使用ctrl+ n/在 Chrome 的地址栏中向下/向上移动p。