Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zk-phi/electric-spacing
Insert spaces automatically between user-defined patterns
https://github.com/zk-phi/electric-spacing
emacs
Last synced: 3 days ago
JSON representation
Insert spaces automatically between user-defined patterns
- Host: GitHub
- URL: https://github.com/zk-phi/electric-spacing
- Owner: zk-phi
- Created: 2014-06-03T05:36:16.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-02-28T17:45:38.000Z (over 3 years ago)
- Last Synced: 2024-08-05T06:06:02.596Z (3 months ago)
- Topics: emacs
- Language: Emacs Lisp
- Homepage:
- Size: 548 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.org
Awesome Lists containing this project
README
* electric-spacing.el
空白の自動挿入
insert spaces automatically between user-defined patterns
** Screencast
[[screencast.gif]]
** Installation
Require this script
: (require 'electric-spacing)
and you may enable electric-spacing-mode with =M-x
electric-spacing-mode=. Loading the mode in major-mode-hooks may also
be useful.: (add-hook 'org-mode-hook 'electric-spacing-mode)
** Defining Patterns
You may define a pattern where whitespaces should be inserted, by
adding a regexp-pair to =electric-spacing-regexp-pairs=. For example,
following setting inserts spaces between Japanese and English
characters like: =foo ほげ bar ふが=#+begin_src emacs-lisp
(add-to-list 'electric-spacing-regexp-pairs
'("\\cA\\|\\cC\\|\\ck\\|\\cK\\|\\cH" . "[0-9A-Za-z]"))
(add-to-list 'electric-spacing-regexp-pairs
'("[0-9A-Za-z]" . "\\cA\\|\\cC\\|\\ck\\|\\cK\\|\\cH"))
#+end_srcYou may define a buffer-local pattern by making
=electric-spacing-regexp-pairs= buffer-local before registering the
pattern.: (make-local-variable 'electric-spacing-regexp-pairs)