Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iquiw/smart-semicolon
Insert semicolon smartly
https://github.com/iquiw/smart-semicolon
electricity emacs
Last synced: 3 months ago
JSON representation
Insert semicolon smartly
- Host: GitHub
- URL: https://github.com/iquiw/smart-semicolon
- Owner: iquiw
- Created: 2017-08-19T06:01:08.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-10-17T14:22:20.000Z (over 3 years ago)
- Last Synced: 2024-08-05T06:05:50.924Z (6 months ago)
- Topics: electricity, emacs
- Language: Emacs Lisp
- Size: 25.4 KB
- Stars: 10
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Smart Semicolon
===============[![circleci](https://circleci.com/gh/iquiw/smart-semicolon.svg?style=svg)](https://circleci.com/gh/iquiw/smart-semicolon)
[![codecov](https://codecov.io/gh/iquiw/smart-semicolon/branch/master/graph/badge.svg)](https://codecov.io/gh/iquiw/smart-semicolon)
[![MELPA](https://melpa.org/packages/smart-semicolon-badge.svg)](https://melpa.org/#/smart-semicolon)About
-----This is a minor mode to insert semicolon smartly, like Eclipse does.
When `smart-semicolon-mode` is enabled, typing ; inserts
semicolon at the end of line if there is no semicolon there.If there is semicolon at the end of line, typing ; inserts
semicolon at the point.After smart semicolon insert, backspace command reverts the behavior as if
; is inserted normally.Setup
-----### Depends ###
* Emacs 26
### Installation ###
#### MELPA ####
Package install from [MELPA](https://melpa.org).
M-x `package-install` [RET] `smart-semicolon` [RET]
#### GitHub ####
Clone the repository from GitHub.
``` console
$ git clone https://github.com/iquiw/smart-semicolon.git
```Add the directory to `load-path` and require `smart-semicolon`.
``` emacs-lisp
(add-to-list 'load-path "/path/to/smart-semicolon")
(require 'smart-semicolon)
```### Configuration ###
Add `smart-semicolon-mode` to some major mode hooks where you want to
enable `smart-semicolon`.``` emacs-lisp
(add-hook 'c-mode-common-hook #'smart-semicolon-mode)
```#### Trigger Characters ####
To trigger the smart insert by other character than semicolon, add the
character into `smart-semicolon-trigger-chars`.``` emacs-lisp
(add-to-list 'smart-semicolon-trigger-chars ?:)
```Or set `smart-semicolon-trigger-chars` to list of the character to use only
the character.``` emacs-lisp
(setq smart-semicolon-trigger-chars '(?:))
```#### Block Characters ####
To block smart semicolon insert when some character exists at eol, add the
character into `smart-semicolon-block-chars`.``` emacs-lisp
(add-to-list 'smart-semicolon-block-chars ?,)
```Or set `smart-semicolon-block-chars` to list of the character to use only
the character.``` emacs-lisp
(setq smart-semicolon-block-chars '(?,))
```#### Backspace Commands ####
To treat some command as backspace command, add the command to
`smart-semicolon-backspace-commands`.``` emacs-lisp
(add-to-list 'smart-semicolon-backspace-commands 'my-backspace)
```License
-------Licensed under the GPL 3+ license.