Parenthesis edit in emacs for python

966 Views Asked by At

I am using the elpy package on emacs for using python. Is there a possibility to have something like Paredit to close parentheses and brackets for python?

2

There are 2 best solutions below

0
On BEST ANSWER

With the caveat that I'm not very familiar with Python, I'd say try smartparens first. It's highly configurable, and if you load the smartparens-config module (i.e., (require 'smartparens-config)), it will automatically set up defaults for each programming language it supports (including Python) that are usually pretty decent.

In my opinion, the big advantage smartparens seems to have over things like paredit is that it's flexible enough to be useful in most programming modes and even non-programming modes, so you can set up a common interface for everything you do.

6
On

For specifically closing brackets (])}), you can try general-close.

For automatically pairing brackets, there are many options; start at by looking at autopairs on the Emacs wiki.