I use autopair-mode globally for intelligent quote/paren/bracket pairing. It helps in most situations, except one.
It's kind of a pain in the ass using Python's multi-quote strings. Typing quote once gives me "|", another quote gets me ""|, a third quote gets me """|", a fourth quote gies """"|, a fifth quote gives me """""|, and a sixth quote finally gets me to """"""|. At which point I need to hop back three spaces to get what I actually wanted the whole time, which is """|""".
Is there a pre-built (or easy) way of getting autopair to have the behavior that hitting quote three times automatically gives me """|""" instead of the quote-shuffle described above?
Adding the following to my .emacs gave me the desired behavior:
(add-hook 'python-mode-hook
#'(lambda ()
(setq autopair-handle-action-fns
(list #'autopair-default-handle-action
#'autopair-python-triple-quote-action))))
Found in the More Tricks section of the documentation linked by immerrr in their comment.
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