0

I'm using emacs with evil and anaconda mode for Python.

Sometimes I'd like to convert a region or a block of selected lines into a def (or for/while loop, or class). Is there a way to do this conveniently? Right now I have to adjust the indentation of the whole block and then add def name(): at the top and return at the bottom.

  • You could always indent the block by selecting the region, and then using Ctrl+c >, and then add your def and return. You can repeat the keys to indent more. – suvayu Jul 1 '18 at 13:47

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.