Shift a region or line in emacs

前端 未结 3 1171
轻奢々
轻奢々 2021-02-02 17:04

I\'m looking for a way in emacs to shift text to the right or to the left by n spaces. A similar functionality that it in vim << or >>

3条回答
  •  粉色の甜心
    2021-02-02 17:24

    To achieve this I usually do a trick:

    • activate CUA mode
    • go to the beginning of line
    • C-RET, now if you move the cursor you should see a rectangular red region
    • Move the cursor down the lines and type space until you've obtained the correct shifting.

    This can be done also programmatically in some way (in the same way).

    EDIT: I've just read the article in emacs wiki, it's the same solution except for the CUA mode that is infinitely more powerful than the "common" rectanguar selection (since it's visual).

提交回复
热议问题