Align selected area in emacs

For example, I am writing code

if Foo do # do something end 

And then, I insert a lot of lines into my code.

 if Foo do # do something # do something # do something # do something # do something end 

How to quickly align added lines?

+6
source share
1 answer

Do you want to align the insert automatically or do you want to align it later? For later use, you can use the indent-region function (bound to CM-\ ). For automatic alignment by insertion, you can use the following recipe (I don’t remember where I got it, so I will refer to my configuration) - see lines 45-66. You will need to add more modes to yank-indent-modes , but the particular mode should provide a working indent function.

+6
source

Source: https://habr.com/ru/post/894368/


All Articles