Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/chansey97/company-yasnippet-autoparens

A company-mode script for auto-parenthesis
https://github.com/chansey97/company-yasnippet-autoparens

company-mode emacs lisp parentheses yasnippet

Last synced: about 2 months ago
JSON representation

A company-mode script for auto-parenthesis

Awesome Lists containing this project

README

        

# company-yasnippet-autoparens
A company-mode script for auto-parenthesis

### What problem does company-yasnippet-autoparens solve?

Most of completion systems for Emacs do not support automatic parentheses. For example, by default, when typing `add-ho`, the completion list will show `add-hook` instead of `(add-hook)`. This is sometimes annoying. The company-yasnippet-autoparens solves the problem, it can make `add-hook - > (add-hook)` appear in the completion list.

### Demo

1. Any text input, a parentheses version will be added to the completion list.

2. It can combine various backends, e.g. dabbrev.

3. Some other examples that combine with yasnippet.

Note that company-yasnippet-autoparens supports any s-exp languages, not just Elisp. It even can support non s-exp languages, if using `company-yasnippet-autoparens-2.el`.

4. Non s-exp languages.

### Usage

1. If you have installed `company` and `yasnippet`, uninstall them.
2. Clone this repository and unzip it to your emacs configuration path.
3. Add the following code to your configuration file.
```
(require 'yasnippet)
(yas-global-mode 1)

(require 'company)
(global-company-mode 1)
(setq company-idle-delay 0.1)
(setq company-minimum-prefix-length 1)
(setq company-dabbrev-char-regexp "\\sw\\|_\\|-\\|!\\|\\?\\|*\\|+\\|=\\|>\\|<")
(setq company-backends '((company-capf
company-dabbrev
company-yasnippet-autoparens
company-yasnippet)))
```