Home Tags About

Column operations in Emacs

27 Feb 2012
emacs

In Emacs, columns are called rectangles.

C-x r r
Copy rectangle to region.
C-x r i
Insert region.
C-x r k
Kill the text of the region-rectangle, saving its contents as the “last killed rectangle” (kill-rectangle).
C-x r d
Delete the text of the region-rectangle (delete-rectangle).
C-x r y
Yank the last killed rectangle with its upper left corner at point (yank-rectangle).
C-x r o
Insert blank space to fill the space of the region-rectangle (open-rectangle). This pushes the previous contents of the region-rectangle rightward.
C-x r c
Clear the region-rectangle by replacing all of its contents with spaces (clear-rectangle).
M-x delete-whitespace-rectangle
Delete whitespace in each of the lines on the specified rectangle, starting from the left edge column of the rectangle.
C-x r t string
Replace rectangle contents with string on each line (string-rectangle).
M-x string-insert-rectangle string
Insert string on each line of the rectangle.