forked from Fuco1/smartparens
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmartparens-config.el
More file actions
77 lines (57 loc) · 2.79 KB
/
smartparens-config.el
File metadata and controls
77 lines (57 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
;;; smartparens-config.el --- Default configuration for smartparens package
;; Copyright (C) 2013 Matus Goljer
;; Author: Matus Goljer <matus.goljer@gmail.com>
;; Maintainer: Matus Goljer <matus.goljer@gmail.com>
;; Created: 30 Jan 2013
;; Keywords: abbrev convenience editing
;; URL: https://github.com/Fuco1/smartparens
;; This file is not part of GNU Emacs.
;;; License:
;; This file is part of Smartparens.
;; Smartparens is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; Smartparens is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with Smartparens. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This is a default configuration for smartparens package. If you
;; wish to set up everything by yourself, you can instead require
;; smartparens directly.
;; However, some configuration is always loaded by default, most
;; notably the built-in list of supported pairs. If you want to erase
;; this list, simply use (setq sp-pairs nil) and then add your own
;; pairs.
;; For more info, see github readme at
;; https://github.com/Fuco1/smartparens
;;; Code:
(require 'smartparens)
;; do not autoinsert ' pair if the point is preceeded by word. This
;; will handle the situation when ' is used as a contraction symbol in
;; natural language. Nil for second argument means to keep the
;; original definition of closing pair.
(sp-pair "'" nil :unless '(sp-point-after-word-p))
;; emacs is lisp hacking enviroment, so we set up some most common
;; lisp modes too
(sp-with-modes sp--lisp-modes
;; disable ', it's the quote character!
(sp-local-pair "'" nil :actions nil)
;; also only use the pseudo-quote inside strings where it serve as
;; hyperlink.
(sp-local-pair "`" "'" :when '(sp-in-string-p)))
;; NOTE: Normally, `sp-local-pair' accepts list of modes (or a single
;; mode) as a first argument. The macro `sp-with-modes' adds this
;; automatically. If you want to call sp-local-pair outside this
;; macro, you MUST supply the major mode argument.
(--each sp--html-modes
(eval-after-load (symbol-name it) '(require 'smartparens-html)))
(eval-after-load "latex" '(require 'smartparens-latex))
(eval-after-load "lua-mode" '(require 'smartparens-lua))
(eval-after-load "ruby-mode" '(require 'smartparens-ruby))
(eval-after-load "enh-ruby-mode" '(require 'smartparens-ruby))
(provide 'smartparens-config)
;;; smartparens-config.el ends here