将缩进区域作为刚性块
De-indent region as rigid block
我想将一个区域向左移动一个制表位,作为一个刚性块(不改变内部行的缩进)。
这里引用相关documentation,但我不明白:
C-x TAB This command is used to change the indentation of all lines
that begin in the region, moving the affected lines as a “rigid” unit.
If called with no argument, the command activates a transient mode for
adjusting the indentation of the affected lines interactively. While
this transient mode is active, typing LEFT or RIGHT indents leftward
and rightward, respectively, by one space. You can also type S-LEFT or
S-RIGHT to indent leftward or rightward to the next tab stop (see Tab
Stops). Typing any other key disables the transient mode, and resumes
normal editing.
我没有看到瞬态模式。如何将区域移动到上一个制表位?
Related answer, to un-indent by 4 spaces
这种 瞬态模式 的行为是在 Emacs 24.4 中引入的。在这种情况下,提交者是 运行 24.3.
在 Emacs 24.3 上,indent-rigidly
无法向前或向后移动 "to the nearest tab stop"。相反,它只能用于移动给定数量的字符。
例如:
- 要将区域向左移动 7 个字符,请使用
C-u - 7 C-x <tab>
- 要将区域向右移动 3 个字符,请使用
C-u 3 C-x <tab>
我想你的目标也可以通过'rectangle operations'来实现。
要将文本块向左移动一个制表位,只需删除左侧的一列制表符,文本块将自动向左移动已删除的长度。
这样做的步骤:
- select您要删除的区域内容。请注意,区域的起点和终点将是矩形的两个顶点。
- 问题
\C-x r d
,或M-x delete-rectangle
。
要将文本块向右移动一个制表位,只需在文本块之前插入一列制表符即可。
- 同上。但是现在矩形的宽度应该为0(即区域的起点和终点在同一列)。
- 问题
\C-x r t <TAB>
,或M-x string-rectangle
。这里<TAB>
是你要插入的内容,可以是其他任何内容。
我想将一个区域向左移动一个制表位,作为一个刚性块(不改变内部行的缩进)。
这里引用相关documentation,但我不明白:
C-x TAB This command is used to change the indentation of all lines that begin in the region, moving the affected lines as a “rigid” unit.
If called with no argument, the command activates a transient mode for adjusting the indentation of the affected lines interactively. While this transient mode is active, typing LEFT or RIGHT indents leftward and rightward, respectively, by one space. You can also type S-LEFT or S-RIGHT to indent leftward or rightward to the next tab stop (see Tab Stops). Typing any other key disables the transient mode, and resumes normal editing.
我没有看到瞬态模式。如何将区域移动到上一个制表位?
Related answer, to un-indent by 4 spaces
这种 瞬态模式 的行为是在 Emacs 24.4 中引入的。在这种情况下,提交者是 运行 24.3.
在 Emacs 24.3 上,indent-rigidly
无法向前或向后移动 "to the nearest tab stop"。相反,它只能用于移动给定数量的字符。
例如:
- 要将区域向左移动 7 个字符,请使用
C-u - 7 C-x <tab>
- 要将区域向右移动 3 个字符,请使用
C-u 3 C-x <tab>
我想你的目标也可以通过'rectangle operations'来实现。
要将文本块向左移动一个制表位,只需删除左侧的一列制表符,文本块将自动向左移动已删除的长度。
这样做的步骤:
- select您要删除的区域内容。请注意,区域的起点和终点将是矩形的两个顶点。
- 问题
\C-x r d
,或M-x delete-rectangle
。
要将文本块向右移动一个制表位,只需在文本块之前插入一列制表符即可。
- 同上。但是现在矩形的宽度应该为0(即区域的起点和终点在同一列)。
- 问题
\C-x r t <TAB>
,或M-x string-rectangle
。这里<TAB>
是你要插入的内容,可以是其他任何内容。