Align selected region in emacs
For example I write code
if Foo do
# do something
end
And then, I paste in my code many l开发者_高级运维ines.
if Foo do
# do something
# do something
# do something
# do something
# do something
end
How I can fast align added lines?
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.
精彩评论