Giter Site home page Giter Site logo

smart-semicolon's Introduction

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.

smart-semicolon's People

Contributors

iquiw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

emacsmirror

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.