Mac中Xcode、文本编辑器逆天复制 竖选文本 垂直选文本

https://blog.csdn.net/Mo_Mo123/article/details/52348790

可能你会遇到这种需求,我想复制每一行的某一部分内容,如下

const NSTextAlignment TTTTextAlignmentLeft = NSTextAlignmentLeft;
const NSTextAlignment TTTTextAlignmentCenter = NSTextAlignmentCenter;
const NSTextAlignment TTTTextAlignmentRight = NSTextAlignmentRight;
const NSTextAlignment TTTTextAlignmentJustified = NSTextAlignmentJustified;
const NSTextAlignment TTTTextAlignmentNatural = NSTextAlignmentNatural;

上面是我找的一段代码,假如我想复制前面一列的const NSTextAlignment,怎么办呢? 
传统方法是: 
conmand+C,command+V重复五次 
稍快一点的方法是: 
按住command,在每一行选择五次,然后进行一次conmand+C,command+V 
当然上面的两种方法对于Mac用户已经司空见惯,根本称不上逆天。

下面我就来介绍一下一个逆天的方法:

  • 首先应该是一下当前软件是否支持这种用法
  • 做法如下: 
    按住option键,如果光标变成十字选择线,说明支持,否则说明当前软件不支持。

如果支持具体做法如下: 
按下option键,待光标变成十字线后去选择,然后conmand+C,command+V 

You can save time by using multiple cursors when editing files. For example, use multiple cursors to change the parameters of common method calls or select all the types in variable declarations that appear on adjacent but separate lines.

To select a column of text, Option-drag across the lines.

You can enter multiple cursor mode by inserting multiple cursors, selecting a range of text across lines, or selecting multiple strings in the file.

Insert multiple cursors: Press and hold Control-Shift, click each location where you want to insert a cursor, then release Control-Shift. If you need to remove a cursor, click it before you release Control-Shift. While you are in multiple cursor mode, the cursors are all blinking.

Before you start editing, you can reposition the cursors:

  • To move the cursors left, right, up, or down, use the arrow keys.
  • To move the cursors forward or backward by word, press Option-right or Option-left.

Select a range of text across lines: Press and hold Option (pointer changes to a Plus (+)), then drag over the text you want to select. Alternatively, select multiple lines of text, then choose Editor > Selection > Split Selection By Lines. A cursor is inserted on each line at the beginning of the selection.

Before you start editing with multiple cursors, you can modify the selection:

  • To extend the selection by a line, press Control-Shift-up or Control-Shift-down.
  • To extend the selection by a word, press Option-Shift-right or Option-Shift-left.

Select multiple strings: Press and hold Control-Shift, double-click or select the strings, then release Control-Shift. To add a string, Control-Shift-double-click or Control-Shift-drag.

Cancel multiple cursor editing: Press Escape or click anywhere in the file.

For more keyboard shortcuts, go to View specific actions or keyboard shortcuts.

Was this help page useful? Send feedback.

猜你喜欢

转载自blog.csdn.net/allanGold/article/details/81707143