LoginSignup
6
2

More than 5 years have passed since last update.

smartparensで言語ごとの設定

Last updated at Posted at 2017-09-28

smartparensでの言語ごとの設定

pareditを使ってたけど、シングルクオートなどを括弧として扱わないようにする方法が分からなかったので、smartparensに移行した。
そのついでに設定方法も調べたのでメモしておく。

lisp-mode
(require 'smartparens)

(sp-with-modes '(lisp-mode lisp-interaction-mode slime-mode)
   (sp-local-pair "'" nil :actions nil)
   (sp-local-pair "`" nil :actions nil))

(provide 'smartpares-lisp)

lisp用の設定だとこんな感じにした。直接lisp用の設定ファイル中に書いてもよかったけど、smartparensにあったサンプルを参考にして分割してみた。実際に使う場合は(require 'smartparens-lisp)とする必要がある。
sp-local-pairは特定のmodeだけで有効になるpairを設定できて、既存のpairを上書きするらしい。
他にもactionを設定することでpairの補完を自由に拡張できるようになっていたり、unlessキーワードなんかもあるので文字列中ではpairの補完をしないようにしたりもできるようなので、使いやすくしていきたい。

pareditで使っていた機能は元々存在していたので、キーバインドを設定したりは問題なくできた。
pareidtのキーバインドを使うようにする設定もあるらしい。

6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2