Anonymous avatar Anonymous committed 537778d

Added my-wrap-with-paren function to wrap next expression with ()
Added plain-tex-mode into list of latex modes.

Comments (0)

Files changed (1)

files/smartparens.el

 ;; first argument is the opening pair! Here, we want to disable ' pair
 ;; in a bunch of text modes
 (sp-with-tag "'"
-             (sp-add-local-ban-insert-pair 'markdown-mode)
-             (sp-add-local-ban-insert-pair 'tex-mode)
-             (sp-add-local-ban-insert-pair 'latex-mode)
-             (sp-add-local-ban-insert-pair 'text-mode)
-             (sp-add-local-ban-insert-pair 'log-edit-mode)
-             (sp-add-local-ban-insert-pair 'org-mode))
+  (sp-add-local-ban-insert-pair 'markdown-mode)
+  (sp-add-local-ban-insert-pair 'tex-mode)
+  (sp-add-local-ban-insert-pair 'latex-mode)
+  (sp-add-local-ban-insert-pair 'text-mode)
+  (sp-add-local-ban-insert-pair 'log-edit-mode)
+  (sp-add-local-ban-insert-pair 'org-mode))
 
 ;; now, we could've also done just this:
 ;; (sp-add-local-ban-insert-pair "'"
 
 ;;; emacs-lisp-mode(s)
 (sp-with '(emacs-lisp-mode inferior-emacs-lisp-mode lisp-interaction-mode)
-         (sp-add-local-ban-insert-pair "'")
-         (sp-add-local-ban-insert-pair-in-code "`"))
+  (sp-add-local-ban-insert-pair "'")
+  (sp-add-local-ban-insert-pair-in-code "`"))
 
 ;;; markdown-mode
 ;; you can also use the `sp-with' macro. It will automatically add the
 ;; mode to the end of each call. How cool is that!
 (sp-with '(markdown-mode rst-mode)
-         (sp-add-local-pair "`" "`")
-         ;; this also disables '*' in all other modes
-         (sp-add-local-allow-insert-pair "*")
-         (sp-add-tag-pair "2" "**" "**" nil)
-         (sp-add-tag-pair "s" "```scheme" "```" nil))
+  (sp-add-local-pair "`" "`")
+  ;; this also disables '*' in all other modes
+  (sp-add-local-allow-insert-pair "*")
+  (sp-add-tag-pair "2" "**" "**" nil)
+  (sp-add-tag-pair "s" "```scheme" "```" nil))
 
 ;;; tex-mode latex-mode
-(sp-with '(tex-mode latex-mode) ;; yes, this works with lists too!
-         (sp-add-local-allow-insert-pair "$")
-         (sp-add-tag-pair "i" "\"<" "\">" nil))
+(sp-with '(tex-mode plain-tex-mode latex-mode) ;; yes, this works with lists too!
+  (sp-add-local-allow-insert-pair "$")
+  (sp-add-tag-pair "i" "\"<" "\">" nil))
 
 ;;; python-mode
 (sp-with 'python-mode
-         (sp-add-local-ban-insert-pair "`"))
+  (sp-add-local-ban-insert-pair "`"))
 
 ;;; html-mode
 (sp-with '(html-mode sgml-mode)
-         (sp-add-local-allow-insert-pair "<"))
+  (sp-add-local-allow-insert-pair "<"))
+
+;;; custom defuns & macros
+(defun my-wrap-with-paren (&optional arg)
+  (interactive "p")
+  (sp-select-next-thing-exchange arg)
+  (execute-kbd-macro (kbd "(")))
+(define-key sp-keymap (kbd "C-(") 'my-wrap-with-paren)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.