/emacs-solidity

The official solidity-mode for EMACS

Primary LanguageEmacs Lisp

Emacs Solidity Mode

https://img.shields.io/badge/License-GPL%20v3-blue.svg http://melpa.org/packages/solidity-mode-badge.svg

A simple language mode for the Solidity language. It is a constant work in progress as the language itself also progresses. For information about Solidity check the Tutorial and the Features wiki pages.

Installation

You can simply load the file in your emacs but the recommended way to install it is either via el-get or MELPA.

El-get

If you don’t know how to use el-get you can find more information on its webpage. First install el-get and then (in emacs), press Alt+x (this is in emacs notation written as M-x ) and then type el-get-install. This will prompt you for a package, type solidity-mode and hit enter, this should install all you need.

Melpa

You can also obtain solidity-mode from Melpa as can be seen here.

Configuration

By default solidity-mode associates itself with any files ending in .sol.

If using el-get then you should have a specific package initializing lisp file. If not then you can put these anywhere in your init.el.

Generic configuration

Regardless of where you installed solidity mode from, you need to require the package:

(require 'solidity-mode)

(append that line to your ~/.emacs file)

Provide path to solc binary

The solc binary is assumed to be located at /usr/bin/solc. Wherever that is not the case you would have to manually set the location of the binary like below:

(setq solidity-solc-path "/home/lefteris/ew/cpp-ethereum/build/solc/solc")

Note: This better be set before requiring solidity mode.

[Optional] Flycheck interface

Solidity mode can also interface with flycheck if you have it. Make sure to download and install the flycheck package. Then configure it to either work on all modes or enable it only for solidity mode.

Features

  • Syntax highlighting
  • Indentation
  • On the fly syntax checking with flycheck

More features are planned, which would interface with the solidity libraries.