43

Mac 因拥有大量快捷方式而闻名(或令人遗憾)。然而,与TextMate及其捆绑软件中的快捷方式列表相比,OS X 本身就相形见绌了。

您使用哪些有用的键盘快捷键?

4

30 回答 30

42

这些是我最喜欢的快捷方式:

  • cmd+t开始输入文件名来打开它
  • ctrl+w选择单词
  • cmd+r运行打开的 ruby​​ 或 php 脚本
  • cmd+ opt+m定义一个新的宏
  • cmd+ shift+m运行宏
  • opt切换到垂直选择模式
  • cmd+ opt+a编辑所选行的末端
于 2008-09-19T05:54:01.207 回答
21
  • ctrl+shift+K deletes current line
  • ctrl+shift+J merges current line with the next line
于 2008-09-20T13:58:27.700 回答
12

Esc auto completes common words in the document you are working in.

For example if you are using a function alot called LongFuntionNameThatChecksStuff, you can type Lon and pressEsc and it should auto complete.

于 2011-01-03T17:53:55.957 回答
9

Control-T(ControlT): Transpose (works in most Cocoa-native text fields and areas, but TextMate enhances the behavior).

  • Place your caret between two characters, hit ControlT, and the characters switch places (this is standard Mac behavior). Awesome for typos.

  • Select a word or series of characters on a single line, hit ControlT, and the characters in the selection will now be reversed (not too useful, but this is a TextMate enhancement)

  • Select a series of characters that spans more than one line, hit ControlT, and the lines will reverse. Characters within the line will still be in order. Most useful when selecting whole lines, but still works with partial lines selected, just so long as there is at least one newline character selected (TextMate enhancement).

于 2012-06-09T21:40:27.787 回答
8

My favourites are:

  • option+command+[ to clean up your indentation
  • "lorem", TAB to insert placeholder text
于 2009-02-08T09:58:06.763 回答
7
于 2008-09-19T08:39:26.753 回答
5

shift+ctrl+alt+v sends selected text to pastie.org

also, using the PHP Bundle, try to start writing a function name and do the following:

str + alt + F3 = list of available functions

str + alt + F1 = short description of the function you've just completed.

于 2009-07-16T14:33:24.923 回答
5

Look word up in dictionary, in any Cocoa app (not just Textmate): ctrl + cmd + D

alt text

于 2011-01-03T17:07:59.903 回答
4

Wrap each selected line in markup tags: SHIFT + CONTROL + COMMAND + W

For example, if you have:

  This is a 
  few sample
  list items 

Highlight all three lines and presss SHIFT + CONTROL + COMMAND + W to create:

  <li>This is a </li>
  <li>few sample</li>
  <li>list items</li>
于 2011-01-03T17:21:36.677 回答
4

Generate Lorem ipsum: lorem + TAB

Will generate:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

于 2011-01-03T22:48:08.677 回答
3

Selecting text using alt (via click and drag)

then use ⌘</kbd> + ] to indent (or [ to dedent)

于 2011-01-03T17:06:25.223 回答
3

Delete the current line: CONTROL + SHIFT + K

于 2011-01-03T17:17:26.333 回答
3

Format CSS: CONTROL + Q

Select some CSS and press CONTROL + Q to turn this:

body { background: red; font-size: 10px; color: black; }

Into this:

body {
  background: red;
  font-size: 10px;
  color: black;
}
于 2011-01-03T17:38:33.047 回答
3

Look up property specifications in W3C: CONTROL + H

This works for both HTML and CSS. Place your carrot over whatever property you'd like to look up and press CONTROL + h. This will open a new window listing the W3C info.

For example, place your carrot over background:

body {
  background: red;
}

Hit command + h and you'll see something like:

alt text

于 2011-01-03T17:55:46.260 回答
3

Edit the end of multiple selected lines simultaneously : COMMAND + OPTION + A

于 2011-01-03T22:56:25.590 回答
3

Toggle between {} and do end blocks. Place your cursor on the block arugument (i.e. the word after the keyword do between the two pipes) and press Shift + Control + {

For example, converts:

@post.each do |post|
  puts post.name
end

to:

@post.each { |post| puts post.name }
于 2011-02-25T23:17:56.100 回答
3

CMD + / comments out a line and it's smart enough to format based on language. I use it all the time.

于 2011-09-06T03:54:38.257 回答
2

Close the nearest open html/xml tag: OPTION + COMMAND + PERIOD

For example, if you have:

<div>Lorem ipsum dolor sit amet, consectetur

CONTROL + COMMAND + D will automatically add the closing </div> tag to create:

<div>Lorem ipsum dolor sit amet, consectetur</div>
于 2011-01-03T17:13:58.547 回答
2

Switch between tabs:

  • Left: SHIFT + COMMAND + [
  • Right: SHIFT + COMMAND + ]
于 2011-01-03T17:25:40.017 回答
1

cftextmate包中,您可以键入任何不带开头“<”或关闭“>”的 cfml 标记,然后按 Tab,它会完成整个标记,然后您可以使用 Tab 标记到每个标记属性。我不确定这种快捷方式是否适用于其他语言。

于 2008-09-19T05:16:36.193 回答
1

我刚刚在Bundles > HTML > Entities下找到了一个带有定义的快捷键符号列表- 这对我了解 TextMate 的整个快捷方式很有帮助。

于 2008-09-19T05:35:06.400 回答
1

You can get a really great desktop background here. It has a ton of really useful keyboard shortcuts. I used it for a couple of days before memorizing the most useful ones.

于 2008-11-04T18:30:34.710 回答
1

Wrap selected text in markup tags: SHIFT + CONTROL + W

For example, if you have:

Lorem ipsum dolor sit amet, consectetur

Highlight the text and press SHIFT + CONTROL + W to create:

<p>Lorem ipsum dolor sit amet, consectetur</p>
于 2011-01-03T17:03:08.467 回答
1

Go to File: ⌘</kbd> + T

Find in Project: ⌘</kbd> + SHIFT + F

于 2011-01-03T17:16:07.003 回答
1

Eliminate all whitespace / carriage returns between the location of your caret and the start of the next piece of content: SHIFT + CONTROL + J

For example, if you have:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.

Place your caret at the end of the first paragraph and press SHIFT + CONTROL + J to remove the space in between the paragraphs:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.

于 2011-01-03T17:29:00.533 回答
0

(these are mostly html-related)

  • cmd + option + closes current open html tag
  • shift + cmd + w wrap selection in tags
  • ctrl + return insert escaped line end, i.e. \n or <br> depending on the occasion.
于 2010-04-15T15:50:53.313 回答
0

Copy and Paste Clipboard: ⌘</kbd> + SHIFT + V

于 2011-01-03T17:57:59.740 回答
0

Titleize selected text: CONTROL + OPTION + U

Will turn:

Lorem ipsum dolor sit amet, consectetur adipisicing elit.

Into:

Lorem Ipsum Dolor Sit Amet, Consectetur Adipisicing Elit.

于 2011-01-03T22:50:47.773 回答
0

Downcase selected text: CONTROL + SHIFT + U

Will turn:

Lorem ipsum dolor sit amet, consectetur adipisicing elit.

Into:

lorem ipsum dolor sit amet, consectetur adipisicing elit.

于 2011-01-03T22:52:21.940 回答
0

Upcase selected text: CONTROL + SHIFT + U

Will turn:

Lorem ipsum dolor sit amet, consectetur adipisicing elit.

Into:

LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISICING ELIT.

于 2011-01-03T22:53:47.727 回答