For example I write code
if Foo do
# do something
end
And then, I paste in my code many lines.
if Foo do
# do something
# do something
# do something
# do something
# do something
end
How I can fast align added lines?
align-regexp First, we align the text. Select the text first, then press Ctrl + u then call align-regexp , with the regexp . * \([0-9,]+\). * then choose -1 for group, 1 for spacing, and n for repeat.
In Emacs, to justify text, first you'll need to define the region of text that you want justified. Place the cursor at the beginning of the text that you want justified and press C-@ to set the mark. Then move your cursor to the end of the text to be justified. This should justify your text across 70 columns.
Do you want to align automatically on insert, or you want to align it later? For later you can use indent-region
function (bound to C-M-\
). For automatic align on insert you can use following recipe (I don't remember where I took it, so I'll refer to my config) - see lines 45-66. You will need to add more modes to yank-indent-modes
, but concrete mode should provide working indent function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With