emacs: Orgmode, how to make a list from a block of lines

前端 未结 4 1734
盖世英雄少女心
盖世英雄少女心 2021-02-01 07:02

Is there a way to covert such block of lines

line1  
line2 
linen

into

1. line1
2. line2
n. linen

Using Emac

4条回答
  •  日久生厌
    2021-02-01 07:26

    don't know if there is a direct way, haven't heard of it yet at least. But one approach would be to use string-rectangle (C-x r t) to prepand 1. to all lines and then hit C-c C-c to update the numbering.

    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
    1. line2 with more text
    

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

    Easier because it gives you visual feedback is to enable CUA-mode and use C-return to create a rectangle selection, then you can start typing on all lines in parallel. See also this video on youtube.

提交回复
热议问题