문제

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?

도움이 되었습니까?

해결책

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

다른 팁

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.

I think this is equivalent of what's in your .vimrc.

(global-set-key "(" (lambda () (interactive) (insert "()") (backward-char 1)))

But we like more features in Emacs. Once you try paredit for writing lisp, you'll never go back.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top