Skip to content

iquiw/smart-semicolon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Semicolon

circleci codecov MELPA

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.

M-x package-install [RET] smart-semicolon [RET]

GitHub

Clone the repository from GitHub.

$ git clone https://github.com/iquiw/smart-semicolon.git

Add the directory to load-path and require smart-semicolon.

(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.

(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.

(add-to-list 'smart-semicolon-trigger-chars ?:)

Or set smart-semicolon-trigger-chars to list of the character to use only the character.

(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.

(add-to-list 'smart-semicolon-block-chars ?,)

Or set smart-semicolon-block-chars to list of the character to use only the character.

(setq smart-semicolon-block-chars '(?,))

Backspace Commands

To treat some command as backspace command, add the command to smart-semicolon-backspace-commands.

(add-to-list 'smart-semicolon-backspace-commands 'my-backspace)

License

Licensed under the GPL 3+ license.

About

Insert semicolon smartly

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors