macOS Shortcuts Collection
- 6 minsAs developers live on keyboards 24/7, we should be aware of any kinds of shortcuts that will benefit productivities.
Between Win and OSX, I arguably think OSX has a better combination of shortcuts, with powerful key mapping tools, it is better than ever.
Read advanced-keymapping, and take keymapping to the next level.
Editing
cmd
+ left
or right
: navigating through beginning and end of a line.
cmd
+ shift
+ left
or right
: select entire line.
cmd
+ top
or bottom
: top or bottom of the file
cmd
+ shift
+ top
or bottom
: select entire file from either top or bottom.
cmd
+ del
: delete content behind cursor on the same line.
alt
+ left
or right
: navigating through word by word.
alt
+ shift
+ left
or right
: select word.
alt
+ del
: delete the entire word, no long need to copy from other places.
alt
+ 8
: bullet.
alt
+ shift
+ k
:
My co-worker Jeff told me the following shortcuts, they work similarly as arrow keys when editing, but not the same when not editing. I only use them in Shell and Vim because I treat them as replacement of my ctrl
+ hjkl
keybinding since I intentionally disabled them in iTerm for better Vim experience. Part of the reason that they are working is that arguably macOS took some concepts from Unix, so these shortcuts were inherited.
ctrl
+ a
: go to beginning of the line when editing.
ctrl
+ e
: go to end of the line when editing.
ctrl
+ n
: go up when editing, i.e. selecting in intellisense.
ctrl
+ p
: go down when editing, i.e. selecting in intellisense.
System
control
+ shift
+ power
: shorter to sleep, longer to shut down.
cmd
+ ~
: cycle through different windows in the current application.(one of my favorite OSX shortcuts, doesn’t exist in Windows)
cmd
+ ,
: open preference of any application.
cmd
+ l
: select address bar in any browser.
cmd
+ w
: close application tab.
cmd
+ shift
+ w
: close all tabs, but application is still running.
cmd
+ q
: completely quit the application.
Chrome
control
+ tab
or control
+ shift
+ tab
: navigating through tabs.
cmd
+ shift
+ b
: toggle bookmark bar.
cmd
+ shift
+ c
: inspect element ready.
cmd
+ alt
+ i
: open developer tool without inspect element ready.
cmd
+ alt
+ j
: open console window.
cmd
+ alt
+ u
: open source.
cmd
+ shift
+ d
: toggle dock side.
cmd
+ shift
+ m
: toggle device view
cmd
+ k
: clear console.
<
and >
: place current tab to the left or right
F2
: Edit as HTML in Chrome developer tool.
Finder
cmd
+ alt
+ l
: downloads.
cmd
+ shift
+ h
: home.
cmd
+ shirt
+ o
: documents.
cmd
+ shirt
+ d
: desktop.
Terminal
control
+ w
: delete a word before the cursor.
control
+ u
: delete entire line.
control
+ k
: deletes the line from the position of the cursor to the end of the line.
control
+ r
: search your command history
control
+ a
: go to the beginning of the line.
control
+ e
: go to the end of the line.
control
+ h
: delete, same as delete
.
control
+ p
: previous command.
control
+ n
: next command.
control
+ l
: clear.
control
+ d
: end of file, works in Shell when wants to exit out an environment.
up
or down
: previous and next command.
-
: go to the previous directory.(very useful)
中文
以前玩魔兽,喜欢快捷键,简单总结一下自己觉得很有用的快捷键。
编辑
cmd
+ left
or right
: 到一行的开始或结尾。
cmd
+ shift
+ left
or right
: 选择整个段落。
cmd
+ top
or bottom
: 去到文件的开始或者结尾。
cmd
+ shift
+ top
or bottom
: 选择文件内的全部内容。
cmd
+ del
: 直接删除一行字。
alt
+ left
or right
: 光标移动词前词后。
alt
+ shift
+ left
or right
: 选择一个词。
alt
+ del
: 直接删除一个词。
alt
+ 8
: •, 小黑点,知道这个命令之后再也不用去别的地方拷贝了。
alt
+ shift
+ k
: , 是个苹果,无意间发现的,蛮有意思的。
系统
control
+ shift
+ power
: 睡眠,锁屏,或者关机。
cmd
+ ~
: 如果一个软件有多个窗口的话,用这个命令切换不同的窗口。(我个人最喜欢的一个命令,windows没有)。
cmd
+ ,
: 打开偏好设置。
cmd
+ l
: 直接选取地址栏。
cmd
+ w
: 关闭软件正在用的tab。
cmd
+ shirt
+ w
: 关闭所有的tab,但是软件还在继续运营。
cmd
+ q
: 关闭软件。
Chrome 浏览器
control
+ tab
or control
+ shift
+ tab
: 前后切换tab。
cmd
+ shift
+ c
: 直接打开 developer tool, 并且 inspect element。
cmd
+ alt
+ i
: 直接打开 developer tool。
cmd
+ k
: 清除console端口。
cmd
+ shift
+ m
: 打开device窗口。
F2
: 编辑 HTML 在 developer tool 打开的情况下。
Finder
cmd
+ alt
+ l
: 下载。
cmd
+ shift
+ h
: 自己的home。
cmd
+ shirt
+ o
: 文件。
cmd
+ shirt
+ d
: 桌面。
终端
control
+ w
: 删除整个词。
control
+ u
: 删除整行。
control
+ a
: 到一行的开始。
control
+ e
: 到一行的结束。
control
+ p
: 上一个命令。
control
+ l
: 清除窗口.
-
: 上一个目录。(这个很有用)