Skip to content

Commit

Permalink
doc: added macos shortcuts (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
djdjz7 authored Nov 18, 2024
1 parent d87bbae commit 4cb008c
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 1 deletion.
56 changes: 55 additions & 1 deletion basic/07-drive-your-computer-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,48 @@ Windows 下打开任务管理器检查有无不必要启动项,加以禁止即

- macOS

TODO!
如果你有 Windows 的使用经历,那么大部分情况下,你可以将 macOS 下的 `Option` 键视为 Windows 下的 `Alt` 键,将 Command 键视为 Windows 下的 `Ctrl` 键。

下面是一些常用的 macOS 快捷键:

- `Command+C`: 复制(或者用 Apple 一向的逻辑:拷贝)
- `Command+V`: 粘贴
- `Command+X`: 剪切
- `Command+A`: 全选
- `Command+Z`: 撤销
- `Command+Shift+Z / Command+Y`: 重做
- `Command+F`: 查找
- `Command+Shift+3`: 全屏幕截图
- `Command+Shift+4`: 选区截图
- `Command+Shift+5`: 完整的截图工具。窗口截图和录屏都可以在这里找到
- `Command+Tab`: 切换应用
- `Command+Q`: 退出当前应用
- `Command+W`: 关闭当前窗口
- `Command+M`: 最小化当前窗口
- `Command+Space`: 打开聚焦搜索
- `Option-Command-Esc`: 打开 `强制退出应用程序` 窗口,类似于 Windows 下的任务管理器
- `Control+左右方向键`: 切换虚拟桌面

一些地方也可能会使用图标表示相应的修饰键,例如:

| 修饰键 | 图标 |
| ------- | :-----------------: |
| Command | <MacOSCommandKey /> |
| Option | <MacOSOptionKey /> |
| Shift | <MacOSShiftKey /> |
| Control | <MacOSControlKey /> |

::: tip
事实上,上述快捷键不一定是绝对的,例如:

- 在多标签页的程序(VS Code、浏览器等)中,`Command+W` 用于关闭当前标签页,当没有标签页可以关闭时,关闭窗口。
- 一般情况下,重做对应的快捷键是 `Command+Shift+Z`,但是在某些第三方程序,例如 Microsoft Word 中,`Command+Y` 也可以用于重做。
- 访达下,`Command+C` 表示把文件复制复制(Copy,拷贝)到剪贴板,而 `Command+D` 表示在当前位置创建副本(Duplicate,复制)。至于 `Command+X`,在选择文件的情况下你不能使用这个快捷键,换句话说:你没法剪切一个文件。
- 访达下还有一个特殊的快捷键 `Command+Shift+G`,用于快速定位到你指定的文件夹 ~~(对自己敲路径的手速有自信的话,快来试试吧)~~
- 多提一嘴:在 Mac 的原装键盘上你可能找不到 `Del` 键,事实上,那个像是退格键的按键被 Apple 称之为 `Delete`。如果你想要删除后边的一个字符用 `Fn+Delete`,删除文件时用 `Command+Backspace`,删除一个对象?随缘吧,可能是 `Delete` 键本身,也可能根本没有快捷键。
- 你可以在 [Apple 支持](https://support.apple.com/zh-cn/102650) 找到更完整的快捷键参考列表,也可以在顶端菜单栏找到当前应用的快捷键。

:::

#### Shell 快捷键 {#shell-shortcut}

Expand All @@ -135,3 +176,16 @@ Windows 下打开任务管理器检查有无不必要启动项,加以禁止即
`Ctrl+L`: 清除屏幕,并重新打印当前行。

还有其他很多快捷键,有兴趣的同学可以网上搜索或者看 bash 的 man 手册。

::: tip
上面这些 `Ctrl` 键在 macOS 下对应 `Control` 键,这与 macOS 全局对应 `Command` 键有所区别。

不过这也带来了一些好处,例如:代表复制的 `Command+C` 在终端下不会与 `Control+C` 冲突,无需担心复制的时候一不小心把程序给终止了。
:::

<script setup>
import MacOSCommandKey from "../components/MacOSCommandKey.vue"
import MacOSOptionKey from "../components/MacOSOptionKey.vue"
import MacOSShiftKey from "../components/MacOSShiftKey.vue"
import MacOSControlKey from "../components/MacOSControlKey.vue"
</script>
25 changes: 25 additions & 0 deletions components/MacOSCommandKey.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<template>
<svg
width="52"
height="51"
viewBox="0 0 52 51"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M43.0485 0.70176C41.0117 0.296615 38.9005 0.50455 36.9818 1.29927C35.0632 2.09399 33.4233 3.4398 32.2696 5.16652C31.1158 6.89323 30.5 8.9233 30.5 11L30.5 16.5H21.5V11C21.5 8.9233 20.8842 6.89323 19.7304 5.16652C18.5767 3.4398 16.9368 2.09399 15.0182 1.29927C13.0996 0.50455 10.9884 0.296615 8.95156 0.70176C6.91475 1.1069 5.04383 2.10693 3.57538 3.57538C2.10693 5.04383 1.1069 6.91476 0.70176 8.95156C0.296615 10.9884 0.50455 13.0996 1.29927 15.0182C2.09399 16.9368 3.4398 18.5767 5.16652 19.7304C6.89323 20.8842 8.9233 21.5 11 21.5H16.5V29.5H11C8.9233 29.5 6.89323 30.1158 5.16652 31.2696C3.4398 32.4233 2.09399 34.0632 1.29927 35.9818C0.50455 37.9005 0.296615 40.0117 0.70176 42.0485C1.1069 44.0853 2.10693 45.9562 3.57538 47.4246C5.04384 48.8931 6.91476 49.8931 8.95156 50.2982C10.9884 50.7034 13.0996 50.4955 15.0182 49.7007C16.9368 48.906 18.5767 47.5602 19.7304 45.8335C20.8842 44.1068 21.5 42.0767 21.5 40V34.5H30.5V40C30.5 42.0767 31.1158 44.1068 32.2696 45.8335C33.4233 47.5602 35.0632 48.906 36.9818 49.7007C38.9004 50.4955 41.0116 50.7034 43.0484 50.2982C45.0853 49.8931 46.9562 48.8931 48.4246 47.4246C49.8931 45.9562 50.8931 44.0853 51.2982 42.0485C51.7034 40.0117 51.4955 37.9005 50.7007 35.9818C49.906 34.0632 48.5602 32.4233 46.8335 31.2696C45.1068 30.1158 43.0767 29.5 41 29.5H35.5V21.5H41C43.0767 21.5 45.1068 20.8842 46.8335 19.7304C48.5602 18.5767 49.906 16.9368 50.7007 15.0182C51.4955 13.0996 51.7034 10.9884 51.2982 8.95156C50.8931 6.91476 49.8931 5.04383 48.4246 3.57538C46.9562 2.10693 45.0853 1.10691 43.0485 0.70176ZM35.5 34.5V40C35.5 41.0878 35.8226 42.1512 36.4269 43.0556C37.0313 43.9601 37.8903 44.6651 38.8952 45.0813C39.9002 45.4976 41.0061 45.6065 42.073 45.3943C43.1399 45.1821 44.1199 44.6583 44.8891 43.8891C45.6583 43.1199 46.1821 42.1399 46.3943 41.073C46.6065 40.0061 46.4976 38.9002 46.0813 37.8952C45.6651 36.8903 44.9601 36.0313 44.0556 35.4269C43.1512 34.8226 42.0878 34.5 41 34.5H35.5ZM30.5 29.5V21.5H21.5V29.5H30.5ZM16.5 34.5H11C9.91221 34.5 8.84884 34.8226 7.94437 35.4269C7.0399 36.0313 6.33495 36.8903 5.91867 37.8952C5.50239 38.9002 5.39347 40.0061 5.60569 41.073C5.8179 42.1399 6.34173 43.1199 7.11092 43.8891C7.88011 44.6583 8.86011 45.1821 9.92701 45.3943C10.9939 45.6065 12.0998 45.4976 13.1048 45.0813C14.1098 44.6651 14.9687 43.9601 15.5731 43.0556C16.1774 42.1512 16.5 41.0878 16.5 40V34.5ZM35.5 16.5V11C35.5 9.91221 35.8226 8.84884 36.4269 7.94437C37.0313 7.0399 37.8903 6.33495 38.8952 5.91867C39.9002 5.50239 41.0061 5.39347 42.073 5.60569C43.1399 5.8179 44.1199 6.34173 44.8891 7.11092C45.6583 7.88011 46.1821 8.86012 46.3943 9.92701C46.6065 10.9939 46.4976 12.0998 46.0813 13.1048C45.6651 14.1098 44.9601 14.9687 44.0556 15.5731C43.1512 16.1774 42.0878 16.5 41 16.5H35.5ZM16.5 16.5V11C16.5 9.91221 16.1774 8.84884 15.5731 7.94437C14.9687 7.0399 14.1098 6.33495 13.1048 5.91867C12.0998 5.50239 10.9939 5.39347 9.92701 5.60569C8.86011 5.8179 7.88011 6.34173 7.11092 7.11092C6.34173 7.88011 5.8179 8.86011 5.60569 9.92701C5.39347 10.9939 5.50239 12.0998 5.91867 13.1048C6.33495 14.1098 7.0399 14.9687 7.94437 15.5731C8.84884 16.1774 9.91221 16.5 11 16.5H16.5Z"
fill="currentColor"
/>
</svg>
</template>

<style scoped>
svg {
display: inline;
height: 0.8em;
width: 0.8em;
vertical-align: baseline;
}
</style>
14 changes: 14 additions & 0 deletions components/MacOSControlKey.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template>
<svg width="39" height="48" viewBox="0 0 39 48" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2 21.5L19.5 4L37 21.5" stroke="currentColor" stroke-width="5" />
</svg>
</template>

<style scoped>
svg {
display: inline;
height: 0.8em;
width: 0.8em;
vertical-align: baseline;
}
</style>
15 changes: 15 additions & 0 deletions components/MacOSOptionKey.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<svg width="53" height="47" viewBox="0 0 53 47" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 2H15.5L37 44.5H53" stroke="currentColor" stroke-width="5" />
<path d="M32 2H53" stroke="currentColor" stroke-width="5" />
</svg>
</template>

<style scoped>
svg {
display: inline;
height: 0.8em;
width: 0.8em;
vertical-align: baseline;
}
</style>
18 changes: 18 additions & 0 deletions components/MacOSShiftKey.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<svg width="56" height="59" viewBox="0 0 56 59" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M7 23.5L28 3.5L49 23.5H38.5V56.5H17.5V23.5H7Z"
stroke="currentColor"
stroke-width="5"
/>
</svg>
</template>

<style scoped>
svg {
display: inline;
height: 0.8em;
width: 0.8em;
vertical-align: baseline;
}
</style>

0 comments on commit 4cb008c

Please sign in to comment.