Now that you’ve started your journey on the Typography Express by using round
double quotes, take a seat and extend that to your apostrophes as well. This
snippet binds a round apostrophe to the ' key, but also inserts a pair of
single round quotes with a prefix.
Finally, like the previous one, it also falls back on self-insert-command
inside a code block.
(define-keyorg-mode-map"'"#'endless/apostrophe);; (eval-after-load 'markdown-mode;; '(define-key markdown-mode-map "'";; #'endless/apostrophe))(defunendless/apostrophe(opening)"Insert ’ in prose or `self-insert-command' in code.
With prefix argument OPENING, insert ‘’ instead and
leave point in the middle.
Inside a code-block, just call `self-insert-command'."(interactive"P")(if(and(derived-mode-p'org-mode)(org-in-block-p'("src""latex""html")))(call-interactively#'self-insert-command)(if(looking-at"['’][=_/\\*]?")(goto-char(match-end0))(if(nullopening)(insert"’")(insert"‘’")(forward-char-1)))))
Prettify your Apostrophes
02 Mar 2015, by Artur Malabarba.Typography post series
Now that you’ve started your journey on the Typography Express by using round double quotes, take a seat and extend that to your apostrophes as well. This snippet binds a round apostrophe to the ' key, but also inserts a pair of single round quotes with a prefix.
Finally, like the previous one, it also falls back on
self-insert-command
inside a code block.Tags: writing, keybind, org-mode, init.el, emacs,
New on Elpa: Spinner.el, mode-line spinners and progress-bars »
« Visit Directory inside a Set of Directories
Related Posts
A few paredit keys that take over the world in writing
Fill and unfill paragraphs with a single key in keybind
Disable Mouse only inside Emacs in keybind
Content © 2019, All rights reserved. Icons under CC3.0.