Skip to main content
7 votes

Is there a command for tidying trailing parentheses?

i (lispy-tab) from lispy does just that. Below is a screenshot of an ERT test visualization (using xv (lispy-view-test)).
abo-abo's user avatar
  • 14.2k
6 votes

smartparens with strict mode in javascript

Use quoted-insert (C-q) to get around this. E.g. C-q < inserts <. Or, create a key binding to toggle smartparens-strict-mode off and on. This is a waste of keys IMO, but up to you.
Tianxiang Xiong's user avatar
6 votes

Smartparens: do not insert parenthesis pair when point is at the beginning of word

According to the author of smartparens, sp-autoinsert-if-followed-by-word has been deprecated. Instead, one should use the :when and :unless filters to accomplish what I wanted. (See the ...
NVaughan's user avatar
  • 1,481
4 votes

How do I jump out of enclosing parentheses?

Try up-list (which is a built-in Emacs function) It lets me jump out of strings, parens, brackets with any nesting.
Debajit's user avatar
  • 288
4 votes

Automatically formatting brackets

Another, terser, way is to use a smartparens insertion spec. (sp-local-pair 'c-mode "{" nil :post-handlers '(:add ("||\n[i]" "RET")))
PythonNut's user avatar
  • 10.4k
4 votes

smartparens strict mode insert single quote before variable

Specific answer: The default configuration for smartparens should cover this, but perhaps you aren't loading the default config. Make sure that (require 'smartparens-config) is in your .emacs.d ...
crowding's user avatar
  • 190
3 votes
Accepted

automatically close type parens in C++

Have a look at the package smartparens. It can be installed from melpa. You can enable pairs of <> with: (sp-with-modes '(c-mode c++-mode) (sp-local-pair "<" ">")) after (require '...
jue's user avatar
  • 4,596
3 votes
Accepted

Remove extra braces

I use sp-unwrap-sexp. In your example, having sp-unwrap-sexp bind to M-Backspace sp-next-sexp bind to C-M-n sp-down-sexp bind to C-M-d and a cursor in the beginning of the text, I do: C-M-d to ...
Maxim Kim's user avatar
  • 1,766
3 votes

How to disable $ pairing in latex-mode in Spacemacs?

Fun fact: there is LaTeX-mode, and then there is latex-mode. Both are aliases for TeX-latex-mode, which is part of the AUCTeX package. If you look at the default value of sp-pairs, you'll see settings ...
J David Smith's user avatar
3 votes

Disable smartparens in spacemacs

From https://github.com/syl20bnr/spacemacs/issues/1603#issuecomment-213553034: smartparens-global-mode is a global mode. If it is enabled you get smartparens-mode in every buffer. Turning it off does ...
Jaakko Luttinen's user avatar
2 votes

Smartparens: do not insert parenthesis pair when point is at the beginning of word

Type C-q ( to only insert a single opening paren.
John Kitchin's user avatar
  • 11.9k
2 votes

smartparens strict mode insert single quote before variable

What major mode are you using? In emacs-lisp-mode, Smartparens does not automatically close single quotes. To insert a single character, use C-q, quoted-insert, followed by the character. E.g. C-q ' ...
Tianxiang Xiong's user avatar
2 votes

Smartparens strict mode C-w kill line if no active region

Advices suck. Much easier is to just define a new function and bind it to C-w. This is what I use: (defun my-kill-region-or-word (&optional arg) "Kill active region or one word backward." (...
Matus Goljer's user avatar
2 votes
Accepted

Always remove brackets by pairs - fix hungry-delete-mode and smartparens-strict-mode conflict

One approach here is to use a context-specific key binding for the smartparens commands. (See How can I 'layer' a keybinding?). Here is some code to have the smartparens commands for deleting ...
glucas's user avatar
  • 20.6k
2 votes

Remove extra braces

You can try using sp-raise-sexp. From the documentation (C-h f sp-raise-sexp): Unwrap the current list and kill everything inside except next expression. For example, with this: {{text}} You ...
Manuel Uberti's user avatar
2 votes

Is there a way to highlight the (s) expression you are in?

There are a couple of options detailed on the Wiki: https://www.emacswiki.org/emacs/HighlightSexp https://www.emacswiki.org/emacs/HighlightSexps
phils's user avatar
  • 51.6k
2 votes
Accepted

smartparens does not work well in orgmode

The following settings in the user-config in my .spacemacs file makes everything work properly. ;; smartparens (require 'smartparens-config) (sp-local-pair 'org-mode "\\[" "\\]") (sp-local-...
bobsacameno's user avatar
1 vote
Accepted

smartparens, how to copy unbalanced () code blocks?

No, that’s exactly what C-q is designed for. If you want a better way to insert defuns, then use yasnippet (or one of the many other similar packages) instead of copy and paste. This will let you ...
db48x's user avatar
  • 18.3k
1 vote
Accepted

smartparens' (sp-pair "⟨" "⟩" :wrap "C-*") doesn't work

Define your pair before enabling the mode. Try: (require 'smartparens) (sp-pair "⟨" "⟩" :wrap "C-*") (smartparens-mode t) (smartparens-global-mode t)
nega's user avatar
  • 3,276
1 vote
Accepted

Expand parentheses with smartparens

The easiest way I can think of is to open a new line with C-o then RET.
Elia's user avatar
  • 181
1 vote

smartparens how to stop behaviour of inserting backslash \ before I type a single quote '

Here the author suggests setting sp-escape-quotes-after-insert to nil.
jagrg's user avatar
  • 3,954
1 vote
Accepted

how to make smartparens insert "` and "' instead of ``'' in latex-modes

In principle the following lisp code should work in your initialization file. The action :rem for sp-local-pair removes ``'' from the list of pairs and thereafter we add "`"' . Furthermore we remove ...
Tobias's user avatar
  • 33.3k
1 vote
Accepted

smartparens NOT insert pair of LaTeX quotes?

I believe I have it. The goal is to get smartparens to: insert a pair of ``LaTeX quotes'' unless at the beginning of a word, when it inserts the ``opening quote unless at the end of a word, when it ...
Dan's user avatar
  • 33.1k
1 vote

Chomp whitespace when autoclosing with smartparens?

You can do this by providing some post-hooks manually (feel free to contribute useful code :). Another setting is to enable sp-navigate-reindent-after-up which will reformat your sexps when you call ...
Matus Goljer's user avatar
1 vote

Configure smartparens wrapping to work in evil-visual-state?

self-insert-command is intended for characters that do produce themselves. it seems this is not what you want, since you want the current region (visual selection) to be to be wrapped. try something ...
wouter bolsterlee's user avatar
1 vote
Accepted

Error running timer "show-paren-function" when displaying matching line in message/mini buffer

A quick look at the code shows this: blink-matching-open does not return a string - the return value is not the matching text. So message complains that its arg is not a string. blink-matching-open ...
Drew's user avatar
  • 78k
1 vote
Accepted

What is disabling the dash package?

Based on Tobias's suggestion in the comments, I found that package-load-list was getting overridden in my init.el by a code snippet that I'd gotten from someone else. Commenting out that line didn't ...
Violet's user avatar
  • 488
1 vote

Disable smartparens in spacemacs

Since this commit 7d2ff48 there is a dotspacemacs-activate-smartparens-mode variable in the .spacemacs file that can be set to nil to disable smartparens.
lewer's user avatar
  • 111
1 vote

Disable smartparens in spacemacs

Here's how to selectively enable smartparens only in specific modes (defun dotspacemacs/user-config () (require 'smartparens) (remove-hook 'prog-mode-hook #'smartparens-mode) (remove-hook '...
loevborg's user avatar
  • 111

Only top scored, non community-wiki answers of a minimum length are eligible