Emacs rectangles

Emacs rectangles

January 14, 2023 | permanent

tags
youtube source

String rectangle or multiple cursors or vertical editing #

  • C-x r t
  • while using evil mode, enter visual mode
  • put the cursor on the top row and column where you want to add new column
  • scroll down vertically to select number of rows

3c21 646f 6374 6874 6d6c 3e3c 2063 6861 7273 202f 3e0a 3c6d 6965 7770 6f72 2277 6964 7468

becomes

3c21 jak 46f 6374 6874 jak d6c 3e3c 2063 jak 861 7273 202f jak e0a 3c6d 6965 jak 770 6f72 2277 jak 964 7468

kill rectangle #

  • C-x r k
  • put the cursor at “j” of top row
  • in visual mode scroll down to the last row and put the cursor at “k”
  • kill-rectangle

3c21 jak 46f 6374 6874 jak d6c 3e3c 2063 jak 861 7273 202f jak e0a 3c6d 6965 jak 770 6f72

becomes

3c21 46f 6374 6874 d6c 3e3c 2063 861 7273 202f e0a 3c6d 6965 770 6f72

Copy and yank(paste) #

  • C-x r k
  • C-x r y

To convert lines to bullets or list #

For string-rectangle you would put point and mark the following way:

v—mark line1 with some text line2 with more text <—point

After M-x: string-rectangle: 1. you will get:

  1. line1 with some text
  2. line2 with more text

Hitting C-c C-c will give you the correct numbering!

Stackoverflow


No notes link to this note

Go to random page

Previous Next