melioratus / eacl

eacl - Emacs auto complete line(s) by grepping project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

eacl - Emacs auto complete line(s) v1.0.2

Auto complete line(s) by grepping the project.

Screenshot:

https://raw.githubusercontent.com/redguardtoo/eacl/master/eacl-demo.gif

For example, a web developer need create a new component instanc.

Suppose the component has been used in current project before:

<MyComponent
  attr1="v1"
  attr2="v2"
  attr3="v3"
  attr4="v4"
/>
  <Toolbar>
    <Button onClick={ e => console.log(e) }>
      <i className="fa fa-circle" />
    </Button>
  </Toolbar>
</MyComponent>

That developer only need input <MyComponent and run M-x eacl-complete-tag. Magic happens!*

Install

Place eacl.el under your Load Path. Then add (require 'eacl) to your configuration.

Gnu Grep, Emacs 24.3 and ivy are required.

Linux

GNU Grep should be pre-installed.

macOS

Please use HomeBrew to install GNU Grep on macOS.

Then insert (setq eacl-grep-program "ggrep") into ~/.emacs. The bundled BSD Grep on macOS is too outdated to use.

Windows

You can use Cygwin/MSYS2 to install grep program. Don’t forget to add the location of grep into environment variable PATH.

Usage

Multiple commands are provided to grep files in the project to get auto complete candidates.

The keyword to grep is the text from line beginning to current cursor.

Project is automatically detected if Git/Mercurial/Subversion is used.

You can override the default root directory by setting eacl-project-root,

(setq eacl-project-root "~/projs/PROJECT_DIR")

Here are the commands you can use.

M-x eacl-complete-line

Complete the line. You could assign key binding C-x C-l to it.

M-x eacl-complete-statement

Complete the statement which ends with “;”.

For example, input text import and run this command.

M-x eacl-complete-snippet

Complete the snippet which ends with “}”.

For example, input text if and run this command.

M-x eacl-complete-tag

Complete the HTML tag which ends with “>”.

For example, input text <div and run this command.

Bug Report

Check https://github.com/redguardtoo/eacl.

About

eacl - Emacs auto complete line(s) by grepping project


Languages

Language:Emacs Lisp 100.0%