简书链接:原创xcode的快捷键设置导出导入的研究。
文章字数:600,阅读全文大约需要2分钟

为什么要修改快捷键?
  • 公认快捷键不够人性化,不符合科学,会手指脱离f,j坐标
  • 自己的一套快捷键可以轻松上手任意开发工具,何乐而不为?
吐槽

网上全是一堆快捷键的操作教程,然而并没有发现有导入导出的教程,可是作为快捷键修改强迫症患者,从eclipse 到android studio, 都被我定制成了自己的快捷键,可是xcode竟然不支持导出,这完全是受不了的,必须研究,吐槽xcode垃圾也没用,事实上,就运行速度。
我这2手的mac 2016版本秒杀我的window笔记本 中的 cloin c开发工具 ,c代码写完运行n久, 而mac打开软件, 编译 c代码速度都是神速了。

我不知道ma c版本的c lo in开发工具速度如何。。

分析

首先,mac版本的Android studio 清理代码如下;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
终端输入命令:

rm -Rf
~/Library/Preferences/AndroidStudio*

rm ~/Library/Preferences/com.google.android.studio.plist

rm -Rf
~/Library/Application\
Support/AndroidStudio*

rm -Rf
~/Library/Logs/AndroidStudio*

rm -Rf
~/Library/Caches/AndroidStudio*

那么找出Xcode的配置文件我觉得应该不是难事,那么我就直接分析了哈。
结果没分析出来,但是我倒是理解了这个东西和window差不多,弄到了自己用户目录下的隐藏数据目录了。 这个目录隐藏了,

开始教程

我给大家找出来了,顺便贴上代码直接复制 到桌面。
备份快捷键到桌面的终端代码如下:

备份快捷键文件到桌面

1
cp ~/Library/Developer/Xcode/UserData/KeyBindings/Default.idekeybindings  ~/Desktop
还原代码快捷键文件

也是一样的,改一下代码就可以

1
2
cp ~/Desktop/Default.idekeybindings ~/Library/Developer/Xcode/UserData/KeyBindings/Default.idekeybindings

手动拷贝的方法

先把目录显示出来

显示隐藏目录

1
2
3
defaults write com.apple.finder AppleShowAllFiles -bool true 此命令显示隐藏文件

defaults write com.apple.finder AppleShowAllFiles -bool false 此命令关闭显示隐藏文件
进入此目录

命令运行之后需要重新加载Finder:快捷键option+command+esc,选中Finder,重新启动即可
手动进入目录

1
~/Library/Developer/Xcode/UserData/KeyBindings

image.png

最后分享我的配置文件其实我的打开内容如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Menu Key Bindings</key>
<dict>
<key>Key Bindings</key>
<array>
<dict>
<key>Action</key>
<string>moveCurrentLineDown:</string>
<key>Alternate</key>
<string>NO</string>
<key>CommandGroupID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.MoveLineDown</string>
<key>CommandID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.MoveLineDown</string>
<key>Group</key>
<string>Editor Menu for Asset Catalog Comparison</string>
<key>GroupID</key>
<string>Xcode.IDESourceCodeComparisonEditor.MenuDefinition.Editor</string>
<key>GroupedAlternate</key>
<string>NO</string>
<key>Keyboard Shortcut</key>
<string>^s</string>
<key>Navigation</key>
<string>NO</string>
<key>Parent Title</key>
<string>Structure</string>
<key>Title</key>
<string>Move Line Down</string>
</dict>
<dict>
<key>Action</key>
<string>moveCurrentLineDown:</string>
<key>Alternate</key>
<string>NO</string>
<key>CommandGroupID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.MoveLineDown</string>
<key>CommandID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.MoveLineDown</string>
<key>Group</key>
<string>Editor Menu for Playground</string>
<key>GroupID</key>
<string>Xcode.IDEPegasusPlaygroundEditor.MenuDefinition.Editor</string>
<key>GroupedAlternate</key>
<string>NO</string>
<key>Keyboard Shortcut</key>
<string>^s</string>
<key>Navigation</key>
<string>NO</string>
<key>Parent Title</key>
<string>Structure</string>
<key>Title</key>
<string>Move Line Down</string>
</dict>
<dict>
<key>Action</key>
<string>moveCurrentLineDown:</string>
<key>Alternate</key>
<string>NO</string>
<key>CommandGroupID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.MoveLineDown</string>
<key>CommandID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.MoveLineDown</string>
<key>Group</key>
<string>Editor Menu for Source Code</string>
<key>GroupID</key>
<string>Xcode.IDEPegasusSourceEditor.MenuDefinition.Editor</string>
<key>GroupedAlternate</key>
<string>NO</string>
<key>Keyboard Shortcut</key>
<string>^s</string>
<key>Navigation</key>
<string>NO</string>
<key>Parent Title</key>
<string>Structure</string>
<key>Title</key>
<string>Move Line Down</string>
</dict>
<dict>
<key>Action</key>
<string>moveCurrentLineDown:</string>
<key>Alternate</key>
<string>NO</string>
<key>CommandGroupID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.MoveLineDown</string>
<key>CommandID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.MoveLineDown</string>
<key>Group</key>
<string>Editor Menu for Source Code Comparison</string>
<key>GroupID</key>
<string>Xcode.IDESourceCodeComparisonEditor.MenuDefinition.Editor</string>
<key>GroupedAlternate</key>
<string>NO</string>
<key>Keyboard Shortcut</key>
<string>^s</string>
<key>Navigation</key>
<string>NO</string>
<key>Parent Title</key>
<string>Structure</string>
<key>Title</key>
<string>Move Line Down</string>
</dict>
<dict>
<key>Action</key>
<string>moveCurrentLineUp:</string>
<key>Alternate</key>
<string>NO</string>
<key>CommandGroupID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.MoveLineUp</string>
<key>CommandID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.MoveLineUp</string>
<key>Group</key>
<string>Editor Menu for Asset Catalog Comparison</string>
<key>GroupID</key>
<string>Xcode.IDESourceCodeComparisonEditor.MenuDefinition.Editor</string>
<key>GroupedAlternate</key>
<string>NO</string>
<key>Keyboard Shortcut</key>
<string>^w</string>
<key>Navigation</key>
<string>NO</string>
<key>Parent Title</key>
<string>Structure</string>
<key>Title</key>
<string>Move Line Up</string>
</dict>
<dict>
<key>Action</key>
<string>moveCurrentLineUp:</string>
<key>Alternate</key>
<string>NO</string>
<key>CommandGroupID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.MoveLineUp</string>
<key>CommandID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.MoveLineUp</string>
<key>Group</key>
<string>Editor Menu for Playground</string>
<key>GroupID</key>
<string>Xcode.IDEPegasusPlaygroundEditor.MenuDefinition.Editor</string>
<key>GroupedAlternate</key>
<string>NO</string>
<key>Keyboard Shortcut</key>
<string>^w</string>
<key>Navigation</key>
<string>NO</string>
<key>Parent Title</key>
<string>Structure</string>
<key>Title</key>
<string>Move Line Up</string>
</dict>
<dict>
<key>Action</key>
<string>moveCurrentLineUp:</string>
<key>Alternate</key>
<string>NO</string>
<key>CommandGroupID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.MoveLineUp</string>
<key>CommandID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.MoveLineUp</string>
<key>Group</key>
<string>Editor Menu for Source Code</string>
<key>GroupID</key>
<string>Xcode.IDEPegasusSourceEditor.MenuDefinition.Editor</string>
<key>GroupedAlternate</key>
<string>NO</string>
<key>Keyboard Shortcut</key>
<string>^w</string>
<key>Navigation</key>
<string>NO</string>
<key>Parent Title</key>
<string>Structure</string>
<key>Title</key>
<string>Move Line Up</string>
</dict>
<dict>
<key>Action</key>
<string>moveCurrentLineUp:</string>
<key>Alternate</key>
<string>NO</string>
<key>CommandGroupID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.MoveLineUp</string>
<key>CommandID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.MoveLineUp</string>
<key>Group</key>
<string>Editor Menu for Source Code Comparison</string>
<key>GroupID</key>
<string>Xcode.IDESourceCodeComparisonEditor.MenuDefinition.Editor</string>
<key>GroupedAlternate</key>
<string>NO</string>
<key>Keyboard Shortcut</key>
<string>^w</string>
<key>Navigation</key>
<string>NO</string>
<key>Parent Title</key>
<string>Structure</string>
<key>Title</key>
<string>Move Line Up</string>
</dict>
</array>
<key>Version</key>
<integer>3</integer>
</dict>
<key>Text Key Bindings</key>
<dict>
<key>Key Bindings</key>
<dict>
<key></key>
<array>
<string>deleteToMark:</string>
<string>deleteForward:</string>
</array>
<key>$@X</key>
<string>capitalizeWord:</string>
<key>$W</key>
<string>insertNewline:</string>
<key>^d</key>
<string>deleteLine:</string>
<key>^u</key>
<string>moveToLeftEndOfLine:</string>
</dict>
<key>Version</key>
<integer>3</integer>
</dict>
</dict>
</plist>

编码内容格式是utf-8
image.png