Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I like to use rectangle for 2 main purposes, inserting the same text on every line, or killing a column of text (similar to Dave Webb's answer).</p> <p>There are 2 useful shortcuts for these, <code>C-x r k</code> will kill a rectangle, and <code>C-x r t</code> to insert (there are other rectangle commands with a <code>C-x r</code> prefix, but these are the ones I use).</p> <p>So let's say you want to take some code and format it so that you can post it in a Stack Overflow post... you need to prefix with 4 spaces. So, go to the beginning of the first line, <code>C-SPC</code> to mark, then go to the beginning of the last line and <code>C-x r t &lt;SPC&gt; &lt;SPC&gt; &lt;SPC&gt; &lt;SPC&gt; &lt;RET&gt;</code>, and there you have it! Then you can just copy and paste it into Stack Overflow. I have run into more complex situations where this is useful, where you actually have text you want to insert on every line at a particular place.</p> <p>So the other situation like Dave Webb's situation, if you want to kill a rectangle, use <code>C-x r k</code> though, because it's just a lot quicker ;-)</p> <p>Also, according to my <a href="http://refcards.com/docs/gildeas/gnu-emacs/emacs-refcard-a4.pdf" rel="nofollow noreferrer">reference card</a> that I printed out when I first started, you can do the following:</p> <ul> <li><code>C-x r r</code>: copy to a register</li> <li><code>C-x r y</code>: yank a rectangle</li> <li><code>C-x r o</code>: open a rectangle, shifting text right (whatever that means...)</li> <li><code>C-x r c</code>: blank out a rectangle (I assume that means replace it with spaces, but you'd have to try it out to see)</li> <li><code>C-x r t</code>: prefix with text (as described above)</li> <li><code>C-x r k</code>: killing (as described above)</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload