Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autocomplete parentheses in SLIME

Tags:

emacs

lisp

slime

I'm learning Common Lisp using SLIME. Is there a way to autocomplete parentheses so that when I type an open paren, a closed one is automatically added? I'm more of a vim guy, so in mv ~/.vimrc I have:

inoremap ( ()< Left >

So when I type an open paren, vim automatically adds the closed paren and puts my cursor in between the parens. Is there a way to do this with SLIME?

like image 735
Phil Braun Avatar asked Nov 19 '25 18:11

Phil Braun


2 Answers

If you're working with CL or other lisps, I can recommend to install & use the paredit - it helps a lot to write & manipulate s-expressions

like image 123
Alex Ott Avatar answered Nov 22 '25 06:11

Alex Ott


If you have Emacs 24 you can use built-in electric-pair-mode. You can activate it at request with M-x electric-pair-mode, or turn it on by default putting

(electric-pair-mode +1)

in your .emacs.

like image 24
giordano Avatar answered Nov 22 '25 06:11

giordano



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!